<div dir="ltr">Yes, but do you understand what you mean by<div><br></div><div> 1/sqrt(c)</div><div><br></div><div>where c is complex? If so, cast 1 to complex.</div><div><br></div><div> Matt<br><br><div class="gmail_quote">
On Wed, Apr 7, 2010 at 1:03 PM, Umut Tabak <span dir="ltr"><<a href="mailto:u.tabak@tudelft.nl">u.tabak@tudelft.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Matthew Knepley wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
My guess is that you want<br>
<br>
PetscReal xTMx;<br>
<br>
<br>
</blockquote></div>
Dear Matthew,<br>
<br>
Thanks for the quick reply, Not sure, here is the code for the related part, I used a VecTDot before that so I need PetscScalar I guess.<br>
<br>
PetscErrorCode ierr;<br>
Vec x, Bx;<br>
int rSz, cSz;<br>
PetscScalar xTMx;<br>
ierr = MatGetSize(modalMat.getMatrix(), &rSz, &cSz); CHKERRQ(ierr);<br>
// create the vectors to be used<br>
ierr = VecCreate(MPI_COMM_SELF, &x); CHKERRQ(ierr);<br>
ierr = VecCreate(MPI_COMM_SELF, &Bx); CHKERRQ(ierr);<br>
ierr = VecSetSizes(x, rSz, PETSC_DECIDE); CHKERRQ(ierr);<br>
ierr = VecSetSizes(Bx, rSz, PETSC_DECIDE); CHKERRQ(ierr);<br>
VecSetFromOptions(x);<br>
VecSetFromOptions(Bx);<br>
//<br>
for(int k=0; k<nev; k++)<br>
{<br>
// retrive the mode vector<br>
MatGetColumnVector(modalMat.getMatrix(), x, k);<br>
MatMult(B, x, Bx);<br>
VecTDot(Bx, x, &xTMx);<div class="im"><br>
VecScale(x, 1/sqrt(xTMx));<br>
<br></div>
Best regards,<br><font color="#888888">
Umut<br>
</font></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></div>