git-svn-id: https://svn.dealii.org/branches/branch_petscscalar_complex@32959
0785d39b-7218-0410-832d-
ea1e28bc413d
* Return the scalar product of two
* vectors. The vectors must have the
* same size.
+ *
+ * For complex valued vector, this gives
+ * $\left(v^\ast,vec\right)$.
*/
PetscScalar operator * (const VectorBase &vec) const;
PetscScalar result;
- const int ierr = VecDot (vector, vec.vector, &result);
+ //For complex vectors, VecDot() computes
+ // val = (x,y) = y^H x,
+ //where y^H denotes the conjugate transpose of y.
+ //Note that this corresponds to the usual "mathematicians" complex inner product where the SECOND argument gets the complex conjugate.
+ const int ierr = VecDot (vec.vector, vector, &result);
AssertThrow (ierr == 0, ExcPETScError(ierr));
return result;
{
const PetscScalar wi = std::complex<double> (5.0-i,2.5*(i%6));
w(i) = wi;
- product += vi*wi;
+ product += PetscConj(vi)*wi;
}
}
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams