Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Efficient solution for complex, symmetric, indefinite matrix equation

Subject: Efficient solution for complex, symmetric, indefinite matrix equation

From: Peter Simon

Date: 2 Aug, 2009 20:01:03

Message: 1 of 4

I need to solve systems of linear equations, N equations in N unknowns, where the coefficient matrix is complex, symmetric, non-hermitian, indefinite, and full. The order N is not particularly large, say, N=100. However, I need to do this hundreds of thousands of times within an optimization loop, for different coefficient matrices, all of which are of the form described above. I would like to know if there is some builtin Matlab functionality to exploit the symmetry of the matrix (please note that the matrix is not hermitian), similar to routines ZSYSV or ZSPSV of Lapack. If not, is there an efficient way to call these Lapack routines from Matlab? I am most interested in rapid calculation, but if exploiting the the matrix symmetry to reduce storage requirements does not cost executation time, I am also interested in doing that. Again, storage space is of interest because of the
very large number of matrices, many of which are stored and recalled, their entries are not computed on the fly as needed.

Thanks,
Peter

Subject: Efficient solution for complex, symmetric, indefinite matrix equation

From: Bruno Luong

Date: 2 Aug, 2009 20:36:49

Message: 2 of 4

"Peter Simon" <peterUNDERSCOREsimon@ieee.org> wrote in message <h54r9v$4vc$1@fred.mathworks.com>...
> I need to solve systems of linear equations, N equations in N unknowns, where the coefficient matrix is complex, symmetric, non-hermitian, indefinite, and full. The order N is not particularly large, say, N=100. However, I need to do this hundreds of thousands of times within an optimization loop, for different coefficient matrices, all of which are of the form described above. I would like to know if there is some builtin Matlab functionality to exploit the symmetry of the matrix (please note that the matrix is not hermitian), similar to routines ZSYSV or ZSPSV of Lapack. If not, is there an efficient way to call these Lapack routines from Matlab? I am most interested in rapid calculation, but if exploiting the the matrix symmetry to reduce storage requirements does not cost executation time, I am also interested in doing that. Again, storage space is of interest because of the
> very large number of matrices, many of which are stored and recalled, their entries are not computed on the fly as needed.
>
> Thanks,
> Peter

Hi Peter,

Simply use "\" operator: From the doc, after mldivide check six previous properties which all fail in your case, the it comes the seventh:

7. If A is not sparse but is symmetric, and the Cholesky factorization failed, then MATLAB solves the system using a symmetric, indefinite factorization. That is, MATLAB computes the factorization P'*A*P=L*D*L', and computes the solution X by X=P*(L'\(D\(L\(P*B)))). Computations are performed using the LAPACK routines in the following table (complex double, BL):

ZLANHE, ZHETRF, ZHETRS, ZHECON

Bruno

Subject: Efficient solution for complex, symmetric, indefinite matrix

From: Peter

Date: 2 Aug, 2009 21:09:42

Message: 3 of 4

On Aug 2, 1:36 pm, "Bruno Luong" <b.lu...@fogale.findmycountry> wrote:
> "Peter Simon" <peterUNDERSCOREsi...@ieee.org> wrote in message <h54r9v$4v...@fred.mathworks.com>...
> > I need to solve systems of linear equations, N equations in N unknowns, where the coefficient matrix is complex, symmetric, non-hermitian, indefinite, and full.  The order N is not particularly large, say, N=100.  However, I need to do this hundreds of thousands of times within an optimization loop, for different coefficient matrices, all of which are of the form described above.  I would like to know if there is some builtin Matlab functionality to exploit the symmetry of the matrix (please note that the matrix is not hermitian), similar to routines ZSYSV or ZSPSV of Lapack.  If not, is there an efficient way to call these Lapack routines from Matlab?  I am most interested in rapid calculation, but if exploiting the the matrix symmetry to reduce storage requirements does not cost executation time, I am also interested in doing that.  Again, storage space is of interest because of the
> > very large number of matrices, many of which are stored and recalled, their entries are not computed on the fly as needed.
>
> > Thanks,
> > Peter
>
> Hi Peter,
>
> Simply use "\" operator: From the doc, after mldivide check six previous properties which all fail in your case, the it comes the seventh:
>
> 7. If A is not sparse but is symmetric, and the Cholesky factorization failed, then MATLAB solves the system using a symmetric, indefinite factorization. That is, MATLAB computes the factorization P'*A*P=L*D*L', and computes the solution X by X=P*(L'\(D\(L\(P*B)))). Computations are performed using the LAPACK routines in the following table (complex double, BL):
>
> ZLANHE, ZHETRF, ZHETRS, ZHECON
>
> Bruno

Thanks, Bruno.

Sounds like it should be fine using the backslash operator. Do you
know if I can tell Matlab to show me which algorithm it selected, just
to be sure? Also, can I direct it to use a particular algorithm
without wasting time checking?

--Peter

Subject: Efficient solution for complex, symmetric, indefinite matrix

From: Bruno Luong

Date: 3 Aug, 2009 01:58:02

Message: 4 of 4

Peter <petersamsimon2@hotmail.com> wrote in message <aa6d2b44-e70a-4b57-a322-06f6a7dc8e29@a37g2000prf.googlegroups.com>...

>
> Sounds like it should be fine using the backslash operator. Do you
> know if I can tell Matlab to show me which algorithm it selected, just
> to be sure? Also, can I direct it to use a particular algorithm
> without wasting time checking?
>

Peter,

I'm not so sure now, it is possible to overpass checking using LINSOLVE, but I couldn't find corresponding option for complex symmetric matrix.

Of course you can always call LAPACK by using Mex and linked with the provided libmwlapack.lib (look in $Matlabroot\extern\lib\$SYSTEM\$COMPILER )

Bruno

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us