Eigenvalues of pair of two large matrices

2 views (last 30 days)
Rehan Jamshed
Rehan Jamshed on 30 Dec 2015
Edited: Matt J on 8 Jan 2016
Hi All,
In my FEM code I have two square matrices (Mass and Stiffness matrices). Both are symmetric and more populated near the diagonal. Since they are quite large, the EIG command consumes a lot of time.
Is there any command that can shorten the time and compute first 10 or 30 frequencies only.
Best regards, Rehan Jamshed

Answers (2)

Matt J
Matt J on 30 Dec 2015
Edited: Matt J on 30 Dec 2015
See EIGS
  13 Comments
Rehan Jamshed
Rehan Jamshed on 6 Jan 2016
Has it to do with the version ? Mine is 7.6 (2008) and the machine is 64 bit core i5
Matt J
Matt J on 6 Jan 2016
Edited: Matt J on 6 Jan 2016
Only way to tell is to run on a more recent MATLAB version...
I would first try the following, to ensure that EIGS sees a perfectly symmetric M matrix,
[A,B, flag]=eigs(K,(M+M.')/2,10);

Sign in to comment.


Matt J
Matt J on 6 Jan 2016
Edited: Matt J on 8 Jan 2016
Your K and M matrices, in addition to having a very pretty snow-flake pattern, both appear to be Kronecker products of a 5x5 matrix with a 243x243 matrix.
>> spy(M)
If that is indeed the case, you can make the computation even more efficient by using the EIG method in my KronProd class ( Download ). The class doesn't have an eigs() method, so you are forced to find all the eigenvectors and eigenvalues. Nevertheless, the whole thing is 10 times faster on my machine than [A,B]=eigs(sparse(K),sparse(M),10).
Kx=rand(5); Ky=rand(243);
Mx=rand(5); My=rand(243);
K=KronProd({Ky,Kx});
M=KronProd({My,Mx});
tic;
[A,B]=eig(K,M);
toc
%Elapsed time is 0.097657 seconds.
  5 Comments
Rehan Jamshed
Rehan Jamshed on 7 Jan 2016
The process of building K_struct and M_struct is in such a way that Kx, Ky, Mx, and My are not built standalone or explicitly written.
However, Ky and My are visible as two overlapping blocks and are generally different (if I am correct at getting Ky and My).
It would be great if KronProd gives Freq_Hz similar to mine and in process building Kx, Ky, Mx, and My matrices. I could only guess their sizes through your earlier explanation.
Rehan Jamshed
Rehan Jamshed on 7 Jan 2016
In other words, for my problem of 375x375...
There are two Ky's and two My's each 75x75. Depending on problem they can be different and I can take them out of K_struct.
But I dont know how to extract Kx and Mx out of K_struct and M_struct.

Sign in to comment.

Categories

Find more on Sparse Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!