1) You would never want ints, unless you understand fixed point math<div><br></div><div>2) You could use floats and doubles, however it would be involved</div><div><br></div><div>3) What you really want is to make MatScalar to be float. Then use </div>
<div> doubles for the residual calculation.</div><div><br></div><div> Matt<br><br><div class="gmail_quote">On Tue, Jun 29, 2010 at 11:39 AM, Luke Bloy <span dir="ltr"><<a href="mailto:luke.bloy@gmail.com">luke.bloy@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#ffffff" text="#000000">
Aron,<br>
<br>
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.<br><font color="#888888">
<br>
-Luke</font><div><div></div><div class="h5"><br>
<br>
On 06/29/2010 11:30 AM, Aron Ahmadia wrote:
<blockquote type="cite">
<div dir="ltr">
<div>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. </div>
<div><br>
</div>
<div>A </div>
<br>
<div class="gmail_quote">On Tue, Jun 29, 2010 at 6:21 PM, Umut Tabak <span dir="ltr"><<a href="mailto:u.tabak@tudelft.nl" target="_blank">u.tabak@tudelft.nl</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<div>Luke Bloy wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Thanks for the response. Thats unfortunate as i use many different
types of matrices that i would like use with petsc.<br>
<br>
I'm not much of a c++ whiz,<br>
</blockquote>
</div>
me neither ;)
<div><br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
but i'm curious if something like an adaptor would be possible that
would make a<br>
(float *) behave like a (petscscalar *) as far as petsc was concerned?
Thoughts?<br>
</blockquote>
</div>
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.<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
</div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>
</div>