I am currently using MATLAB to do matrix division of very large, very sparse, complex matrices that are symmetric in structure, but asymmetric in value (i.e. A(1,2)=3+4i and A(2,1)=3-4i).
I am now converting my code to Java. What is the proper equivalent function of A\b in Suitesparse/LApack?
I know this is what MATLAB is running for A\b, but chol seems to be limited to real, symmetric matrices.
Related
I have a 1047x1047 sparse matrix and am interested in its eigenvectors and eigenvalues. From the mathematical derivation I know that these must be real. scipy eigs finds complex ones though. Unfortunately this destroys everything. There is no possibility to create a minimal example, because for small matrices eigs also calculates real eigenvectors, i.e. complex eigenvectors with imaginary part zero.
Desperate thanks!
I am simulating a physical system, where I need to calculate the eigenvalues and vectors of a very large (~10000x10000) matrix.
So far I have used the in-built Eig algorithm in MATLAB but it is very slow for large matrices. Is there other algorithms in MATLAB that would do a better job or can I somehow improve the performance of Eig? Specifically it turns out that I only need the first ~100 eigenvectors of the matrix starting from the smallest numerical eigenvalue. Is there a way to get the algorithm to calculate only the first N eigenvectors and eigenvalues to save computation time? Of course this would only work if the eigenvectors come out sorted but they seem to do so, because of the symmetry of the Matrix I am using.
Your matrix has mostly zeros, so you should make it a sparse matrix. You'll then be able to use EIGS to calculate a smaller number of eigenvalues and eigenvectors.
http://www.mathworks.com/help/matlab/ref/eigs.html
I have a system of dynamic equations that ultimately can be written in the well-known "spring-mass-damper" form:
[M]{q''}+[C]{q'}+[K]{q}={0}
[M], [C], [K]: n-by-n Coefficient Matrices
{q}: n-by-1 Vector of the Degrees of Freedom
(the ' mark represents a time derivative)
I want to find the eigenvalues and eigenvectors of this system. Obviously due to the term [C]{q'}, the standard MATLAB function eig() will not be useful.
Does anyone know of a simple MATLAB routine to determine the eigenvalues, eigenvectors of this system? The system is homogeneous so an efficient eigenvalue analysis should be very feasible, but I'm struggling a bit.
Obviously I can use brute force and a symbolic computing software to find the gigantic characteristic polynomial. But this seems inefficient for me, especially because I'm looping this through the other parts of the code to determine frequencies as a function of other varied parameters.
I am using Octave and have a huge sparse matrix that I have to get the eigenvalues of. However, if I just use a function to get all eigenvalues and eigenvectors, the result will take up way too much space, since the input matrix is sparse for a reason.
How can I get only a limited number of the most important eigenvectors?
Use eigs instead of eig:
D = eigs(A,k);
This returns the k largest eigenvalues of the matrix A. According to this page, Octave does support eigs for sparse matrices. eigs uses different techniques than eig, is slower overall, and shouldn't generally be used except in the cases such as the one you describe.
Be sure to check out the options for the sigma argument in case you want the largest eigenvalues with respect to their real parts only, for example.
The Matlab documentation for eigs is here.
I have a function written in C to calculate eigenvalues and eigenvectors, but it takes a lot of CPU time since I am calling this function several times as part of another algorithm. According to Apple the Accelerate framework can be used to find eigenvalues from matrices very fast using BLAS and LAPACK.
As I am new to the Accelerate framework, so which functions should I be using to find the eigenvalues and eigenvectors of a square matrix?
That depends a bit on the character of the matrix that you wish to decompose. There are different routines in Lapack for symmetric/Hermitian matrices, banded diagonal matrices, or general matrices. If you have a general matrix (w/ no particular structure) you will need to use the generalized Schur decomposition routines. The routines are divided between single and double precision and between matrices with real or complex elements - as is all of Lapack.
The general eigen-problem solver routines are named: SGEEV CGEEV DGEEV ZGEEV where the S = single precision real, C = single precision complex, D = double precision real, Z = double precision complex.
IBM has a good online reference for lapack, here's a link describing the above routines.
Good luck!
Paul