> El 13 oct 2016, a las 5:26, Bikash Kanungo <bik...@umich.edu> escribió:
> I facing the following issue. I'm trying to use orthogonalize a set of
> vectors (all complex) with a non-standard inner product (.i.e. with
> BVSetMatrix). Let's call the basis vector to be BV and the matrix to be B.
> After certain number of iterations, I'm getting an error "The inner product
> is not well defined: nonzero imaginary part". I investigated this further.
> What I did was obtain the vec (column) which was throwing the error. Let's
> call the vec to be x and its column ID in BV to be j. I obtained x^H*B*x in
> two different ways: (1). by first getting y=B*x and then performing
> VecDot(x,y, dotXY), and (2) by using BVNormColumn(BV, j, NORM_2, normj). I'm
> doing this check even before calling the BVOrthogonalize routine.
> In principle, the value from (1) should be the square of the value from (2).
> For the iterations where I'm successful to perform the orthogonalization this
> check is satisfied. However, for the iteration where it fails with the above
> error, the value from (2) is zero. I'm unable to understand why this is the
Please note that to compute x^H*y you have to call VecDot(y,x,dot), with y
first. Anyway, this does not matter for what you are reporting.
Probably the call for (2) is aborting due to an error, so it does not return a
value. Add CHKERRQ(ierr) after it. In general, it is always recommended to add
this to every PETSc/SLEPc call, also in Fortran code (although SLEPc Fortran
examples do not have it).
One possible explanation for the error "The inner product is not well defined"
is that the matrix is not exactly Hermitian, that is B^H-B is tiny but not
zero. If this is the case, I would suggest explicitly making it Hermitian.
Also, things could go bad if matrix B is ill-conditioned.