ERROR: UndefVarError: eigvecs not defined


#1

I am trying to follow the examples of the linear algebra documentation:

https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#Linear-Algebra-1

But when I try to compute the eigenvalues or eigenvectors I get:

ERROR: UndefVarError: eigvecs not defined

I am literally copying and pasting the example into the REPL, so either there it is not clear that some package must be loaded before using these functions, or there is a bug. I am using v1.0

Thank you very much.


#2

It is a stdlib so using LinearAlgebra is first needed. Perhaps that should be more explicit.


#3

Thanks Kristoffer. That was indeed the problem.

For newbies like me facing this question: add

using LinearAlgebra

to the code.

I remark that the manual is not clear on that. It says that Julia provides native implementations of many linear algebra functions, and exemplifies with tr(A), det(A), which work out of the box, and then exemplifies with eigvals(A), eigvecs(A), which result in that error.

In other words, it is just that the manual is not clear in the sense that it suggests that the functions are usable out of the box, and does not indicate that a package must be used, and which is the name of the package.

To be clear, I am referring to this page:

https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#Linear-Algebra-1

Thank you very much again.


#4

I made a PR to the docs: https://github.com/JuliaLang/julia/pull/29188