# Normalization of eigenvectors in Arpack

**URL:** <https://discourse.julialang.org/t/normalization-of-eigenvectors-in-arpack/108492>\
**Category:** General Usage\
**Created:** [January 8, 2024, 1:24am UTC](https://discourse.julialang.org/t/normalization-of-eigenvectors-in-arpack/108492 "2024-01-08T01:24:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [January 8, 2024, 1:24am UTC](https://discourse.julialang.org/t/normalization-of-eigenvectors-in-arpack/108492/1 "2024-01-08T01:24:40Z")

</div>

I call `eigs` from two separate packages. In the first, `eigs` returns vectors normalized to unit length, in the second they are normalized relative to the second matrix in the pencil (mass). Obviously, both matrix pencils in these calls are the same (and the eigenvalues match).

Anyone has an idea what the logic is?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 8, 2024, 3:30am UTC](https://discourse.julialang.org/t/normalization-of-eigenvectors-in-arpack/108492/2 "2024-01-08T03:30:59Z")

</div>

Is it a Hermitian pencil with a positive-definite mass matrix? Did you tell the `eigs` package that? (If so, the mass-weighted norm is arguably the right choice.)

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [January 8, 2024, 4:07am UTC](https://discourse.julialang.org/t/normalization-of-eigenvectors-in-arpack/108492/3 "2024-01-08T04:07:30Z")

</div>

That is a good point: I remembered now that Arpack is very picky and needs to be told explicitly with `Symmetric`. I will check that tomorrow.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [January 8, 2024, 4:22pm UTC](https://discourse.julialang.org/t/normalization-of-eigenvectors-in-arpack/108492/4 "2024-01-08T16:22:09Z")

</div>

The matrix pencil is precisely symmetric. And, even when I use the type conversion to `Symmetric` on the matrices, eigenvectors are still returned normalized to unit length.

I managed to find the culprit: one needs to set `explicittransform=:none` for the eigenvectors to be normalized with respect to the mass. In fact, it was in my own issue I raised in 2021. (And which I forgot. 🙄)

> <https://github.com/JuliaLinearAlgebra/Arpack.jl/issues/130>
>
> I have two symmetric PD sparse matrices, and I call 
> \`\`\`
> d, v, nconv = eigs(Sy…mmetric(K+OmegaShift\*M), Symmetric(M); nev=neigvs, which=:SM)
> \`\`\`
> Clearly it is reasonable to expect the results to be normalized relative to the matrix \`B\`. This however does not happen
> since the designation of the matrices as symmetric is lost due to \`explicittransform\` being set internally to \`:shiftinvert\`.   
> This is a violation of backward compatibility.

I believe this to be a bug. However, I do not have high hopes that this will be fixed: the maintainers of Arpack seem to have all turned to other things.
