[petsc-users] ublas sparse matrix bindings?

Matthew Knepley knepley at gmail.com
Tue Jun 29 12:43:36 CDT 2010


1) You would never want ints, unless you understand fixed point math

2) You could use floats and doubles, however it would be involved

3) What you really want is to make MatScalar to be float. Then use
    doubles for the residual calculation.

   Matt

On Tue, Jun 29, 2010 at 11:39 AM, Luke Bloy <luke.bloy at gmail.com> wrote:

>  Aron,
>
> Thanks for the reply. Thats unfortunate i was hoping to use petsc/slepc on
> matrices of doubles and of ints within the same application. I was hoping to
> keep the ints for a smaller memory footprint as I'm already in the >10g
> range. but it seems like that is possible.
>
> -Luke
>
>
> On 06/29/2010 11:30 AM, Aron Ahmadia wrote:
>
>  You couldn't simply template the dereference, you would need to have a
> way to reformat the data into single/double-precision, and PETSc assumes you
> are giving it a raw C pointer.  This would have the effect of potentially
> generating an expensive data copy every time you need to hand your object to
> PETSc.  I think you would be much better served by deciding ahead of time
> whether you will need a single or double-precision PETSc and writing your
> code accordingly with that assumption.
>
>  A
>
> On Tue, Jun 29, 2010 at 6:21 PM, Umut Tabak <u.tabak at tudelft.nl> wrote:
>
>> Luke Bloy wrote:
>>
>>> Thanks for the response. Thats unfortunate as i use many different types
>>> of matrices that i would like use with petsc.
>>>
>>> I'm not much of a c++ whiz,
>>>
>>  me neither ;)
>>
>>  but i'm curious if something like an adaptor would be possible that would
>>> make a
>>> (float *) behave like a (petscscalar *) as far as petsc was concerned?
>>> Thoughts?
>>>
>>  I am not sure if these kinds of pointer conversions are safe if you do
>> not know that what 'petscscalar *' really is, you might check the docs.
>>
>
>


-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100629/24385f3e/attachment.htm>


More information about the petsc-users mailing list