# Re: [petsc-users] BVNormColumn

```Hi Jose,

Thanks for the pointers. Here's what I observed on probing it further:```
```

1. The ||B - B^H|| norm was 1e-18. So I explicitly made it Hermitian by
setting B = 0.5(B+B^H). However, this didn't help.
2. Next, I checked for the conditioning of B by computing the ratio of
the highest and lowest eigenvalues. The conditioning of the order 1e-9.
3. I monitored the imaginary the imaginary part of VecDot(y,x, dotXY)
where y = B*x and noted that only when the imaginary part is more than
1e-16 in magnitude, the error of "The inner product is not well defined" is
flagged. For the first few iterations of orhtogonalization (i.e., the one
where orthogonization is successful), the values of VecDot(y,x, dotXY) are
all found to be lower than 1e-16. I guess this small imaginary part might
be the cause of the error.

Let me know if there is a way to bypass the abort by changing the tolerance
for imaginary part.

Regards,
Bikash

On Thu, Oct 13, 2016 at 4:48 AM, Jose E. Roman <jro...@dsic.upv.es> wrote:

>
> > El 13 oct 2016, a las 5:26, Bikash Kanungo <bik...@umich.edu> escribiÃ³:
> >
> > Hi,
> >
> > 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 case.
> >
> > Thanks,
> > Bikash
>
> 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.
>
> Jose
>
>

--
Bikash S. Kanungo
PhD Student
Computational Materials Physics Group
Mechanical Engineering
University of Michigan
```