How to compute eigenvalues of a known linear function? In Julia, there is a package https://jutho.github.io/LinearMaps.jl/dev/ to compute the matrix representation of given function, then we can compute eigenvalues of the final matrix.

And in MATLAB, function eigs can also directly compute eigenvalues of a linear function.

    d = eigs(Afun,n,___) specifies a function handle Afun instead of a matrix. The second input n gives the size of matrix A used in Afun. You can optionally specify B, k, sigma, opts, or name-value pairs as additional input arguments.

enter image description here So how to realize them in Mma? This is my approach:

LinearMapMatrix[map_Association, dimension_] := 
 Module[{vectorin, linearfunction, transformmatrix}, 
  vectorin = Normal[map][[1, 1]]; linearfunction = map[vectorin]; 
  transformmatrix = 
   Transpose[ParallelMap[linearfunction, IdentityMatrix[dimension]]]

But it costs a lot of Ram. If I want a matrix representation with huge dimension, this function would burn down the running notebook. Are there some better methods?

Update: an example https://www.tensors.net/exact-diagonalization This webpage gives an example. The goal is to compute eigenvalue of a linear map. But the big linear map does not have clear representation now, it can be understood as multiple times matrix dot product on local Hilbert space. With function LinearMaps in Julia or function LinearOperator in Python, matrix representation of the linear map can be given.

  • 3
    $\begingroup$ Have you tried defining your linear function in terms of a SparseArray? Or does this still consume too much RAM? $\endgroup$
    – Roman
    Jul 27 '21 at 12:22
  • 3
    $\begingroup$ Could you add an example function you'd like analyzed? $\endgroup$
    – Chris K
    Jul 27 '21 at 12:42
  • $\begingroup$ You could generate a sparse-matrix representation of your linear function with SparseArray[SparseArray@*linearfunction /@ IdentityMatrix[dimension, SparseArray]] and (if needed) transposing the result. This is only useful if your function is indeed sparse. $\endgroup$
    – Roman
    Jul 27 '21 at 13:41
  • 1
    $\begingroup$ I do not really want to close this post because I can feel that it is an interesting one (+1 up). My "vote for close" should be regarded as the same opinion of @ChrisK 's comment (+1 up), but with a stronger attitude. $\endgroup$ Jul 27 '21 at 14:52
  • 3
    $\begingroup$ It is indeed a curious omission in Mathematica. The back-end of Mathematica's Arnoldi-method eigensolver is ARPACK, which interfaces natively with a linear function, not with a (sparse) matrix. For some reason, WR decided not to expose this interface. $\endgroup$
    – Roman
    Jul 27 '21 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.