Smallest Eigenvalue of a Moler Matrix [Again]

#1

I am referring to help I received from Andreas Noack 10 months ago.
https://discourse.julialang.org/t/smallest-eigenvalue-of-a-moler-matrix/10510
I wanted to compute the smallest eigenvalue of Moler matrices with high precision. The example was a Moler matrix of dimension 100.

using MatrixDepot
A = matrixdepot("moler", 100);
eigmin(A)
## 2.7755575615628914e-16

The smallest eigenvalue is by far not correct. The proposed solution was to convert A to a matrix of “big” numbers.

using LinearAlgebra
eigvals(Hermitian(big.(A)))

All this was running smoothly with Julia version 0.6, using the LinearAlgebra package at that time. Now when I repeat the calculations with Julia 1.1 there is an error saying

eigvals(Hermitian(big.(A)))
## ERROR: MethodError: no method matching 
## eigvals!(::Hermitian{BigFloat,Array{BigFloat,2}})

Has this feature of LinearAlgebra.eigvals() handling big numbers been dropped when integrating the package into Base Julia? What else can/should I do?

Thanks for any help.

#2

This functionality has, like many others, been moved out of Base into a separate package. In your case the package is GenericLinearAlgebra.jl.

You can simply ] add GenericLinearAlgebra and using GenericLinearAlgebra and everything should work as expected.

4 Likes
#3

Thanks a lot.
How could I have known without asking on this site?

‘GenericLinearAlgebra’ is not known on the “Registered Packages” page on julialang.org, nor on “Julia Observer” in the categories ‘Mathematics’, ‘LinearAlgebra’, ‘Numerical Linear Algebra’, or ‘Numerical Analysis’.

#4

Just use Julia v0.7 and you will get a deprecation warning.

Although I am not sure how to produce a deprecation warning specifically mentioning GenericLinearAlgebra.

Anyways, I use a docker image for it, for example:

░ tgal@staticbox:~
░ 13:15:46 > docker run -it julia:0.7
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0 (2018-08-08 06:46 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-pc-linux-gnu

julia> eigvals()
WARNING: Base.eigvals is deprecated: it has been moved to the standard library package `LinearAlgebra`.
Add `using LinearAlgebra` to your imports.
 in module Main
#5

I don’t think that 0.7 would have helped in this case. The warnings/error message one gets isn’t indicating GenericLinearAlgebra at all.

@Hans_W_Borchers Unfortunately I don’t think you could have known (unless you would’ve worked through the corresponding github issues). Julia 1.0 isn’t very old and some moves of features haven’t been documented properly. Basically the issue is that the documentation of these features doesn’t belong into the Julia docs anymore - since the features are in packages now - and hence isn’t easily accessible anymore. This is a general problem. What we really need is a tool that allows one to search not only in the Julia docs but docs of some important packages as well. I believe some people are working on it. I’m not sure how intensively though.

2 Likes
#6

Yes you are right, but maybe the Docker hint is something to pick up :wink:

#7

Turns out the explanation in my accepted answer isn’t quite correct - although the proposed solution is correct. I assumed this feature was in Base but, in fact, never was. In the discourse thread you linked it was suggested to use an external package LinearAlgebra.jl. In version 0.7 Julia got a LinearAlgebra standard library which, although identical in name, was different in functionality. The external package LinearAlgebra.jl was renamed to GenericLinearAlgebra.jl which is more precise and avoids the name overlap.

Hence, you could have known by just clicking the old link in the linked discourse thread again. You would’ve then noticed that the name of the package changed.

1 Like