# Order of eigenvectors by using eigvecs()

**URL:** <https://discourse.julialang.org/t/order-of-eigenvectors-by-using-eigvecs/95048>\
**Category:** New to Julia\
**Tags:** linearalgebra, eigenvectors\
**Created:** [February 22, 2023, 11:23pm UTC](https://discourse.julialang.org/t/order-of-eigenvectors-by-using-eigvecs/95048 "2023-02-22T23:23:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jisutich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jisutich/32/33342_2.png) [@jisutich](https://discourse.julialang.org/u/jisutich)\
**Post date:** [February 22, 2023, 11:23pm UTC](https://discourse.julialang.org/t/order-of-eigenvectors-by-using-eigvecs/95048/1 "2023-02-22T23:23:06Z")

</div>

Hi,

I have a very simple question. Suppose I have a Hermitian matrix `A` and I want to calculate its eigenvectors. I can use `eigvecs(A)` and the columns of it are the eigenvectors. But I want to know what is the order of these eigenvectors. Suppose I want to ask them to order based on the eigenvalues. The eigenvector corresponding to the smallest eigenvalue is the leftmost column and the eigenvector corresponding to the largest eigenvalue is the rightmost column. What should I do?

Thanks

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [February 22, 2023, 11:33pm UTC](https://discourse.julialang.org/t/order-of-eigenvectors-by-using-eigvecs/95048/2 "2023-02-22T23:33:59Z")

</div>

This comes from the documentation of `eigen`, which the documentation of `eigvecs` redirected me to:

```plaintext
By default, the eigenvalues and vectors are sorted lexicographically by (real(λ),imag(λ)).
A different comparison function by(λ) can be passed to sortby, or you can pass sortby=nothing to leave the eigenvalues in an arbitrary order.
Some special matrix types (e.g. Diagonal or SymTridiagonal) may implement their own sorting convention and not accept a sortby keyword.

```

---

<div class="post-metadata">

**Author:** ![jisutich](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jisutich/32/33342_2.png) [@jisutich](https://discourse.julialang.org/u/jisutich)\
**Post date:** [February 27, 2023, 10:47pm UTC](https://discourse.julialang.org/t/order-of-eigenvectors-by-using-eigvecs/95048/3 "2023-02-27T22:47:41Z")

</div>

Thanks.
