laslv.h File Reference

Functions for solving linear equations. More...

Go to the source code of this file.

Real-valued matrices

void LaLinearSolve (const LaGenMatDouble &A, LaGenMatDouble &X, const LaGenMatDouble &B)
void LaLinearSolveIP (LaGenMatDouble &A, LaGenMatDouble &X, const LaGenMatDouble &B)
void LaLULinearSolve (const LaGenMatDouble &A, LaGenMatDouble &X, const LaGenMatDouble &B)
void LaLULinearSolveIP (LaGenMatDouble &A, LaGenMatDouble &X, const LaGenMatDouble &B)
void LaQRLinearSolve (const LaGenMatDouble &A, LaGenMatDouble &X, const LaGenMatDouble &B)
void LaQRLinearSolveIP (LaGenMatDouble &A, LaGenMatDouble &X, const LaGenMatDouble &B)
void LUFactorizeIP (LaGenMatDouble &GM, LaVectorLongInt &PIV)
 Compute the LU factorization.

Complex-valued matrices

void LaLinearSolve (const LaGenMatComplex &A, LaGenMatComplex &X, const LaGenMatComplex &B)
void LaLinearSolveIP (LaGenMatComplex &A, LaGenMatComplex &X, const LaGenMatComplex &B)
void LaLULinearSolve (const LaGenMatComplex &A, LaGenMatComplex &X, const LaGenMatComplex &B)
void LaLULinearSolveIP (LaGenMatComplex &A, LaGenMatComplex &X, const LaGenMatComplex &B)
void LaQRLinearSolve (const LaGenMatComplex &A, LaGenMatComplex &X, const LaGenMatComplex &B)
void LaQRLinearSolveIP (LaGenMatComplex &A, LaGenMatComplex &X, const LaGenMatComplex &B)
void LUFactorizeIP (LaGenMatComplex &GM, LaVectorLongInt &PIV)
 Compute the LU factorization.

Functions

void LaLUInverseIP (LaGenMatComplex &A, LaVectorLongInt &PIV)
 Compute the inverse of a matrix from LU factorization.
void LaLUInverseIP (LaGenMatComplex &A, LaVectorLongInt &PIV, LaVectorComplex &work)
 Compute the inverse of a matrix from LU factorization.
void LaEigSolve (const LaGenMatDouble &A, LaVectorComplex &eigvals, LaGenMatDouble &VR)
void LaEigSolve (const LaGenMatDouble &A, LaVectorDouble &eigvals_real, LaVectorDouble &eigvals_imag, LaGenMatDouble &VR)
void LaEigSolveSymmetricVecIP (LaGenMatDouble &A_symmetric, LaVectorDouble &eigvals)
void LaEigSolveVecIP (LaGenMatDouble &A_symmetric, LaVectorDouble &eigvals)
void LaEigSolve (const LaGenMatComplex &A, LaVectorComplex &W, LaGenMatComplex &VR)
void LaLUInverseIP (LaGenMatDouble &A, LaVectorLongInt &PIV)
 Compute the inverse of a matrix from LU factorization.
void LaLUInverseIP (LaGenMatDouble &A, LaVectorLongInt &PIV, LaVectorDouble &work)
 Compute the inverse of a matrix from LU factorization.


Detailed Description

Functions for solving linear equations.


Function Documentation

void LaLinearSolve ( const LaGenMatDouble A,
LaGenMatDouble X,
const LaGenMatDouble B 
)

Compute the solution to a real system of linear equations A*X=B

Depending on the dimensions of A, either a LU or a QR decomposition is used.

Note:
This function was broken with non-square matrices and QR decomposition for a long time. It is fixed and verified only since lapackpp-2.4.11.

void LaLinearSolveIP ( LaGenMatDouble A,
LaGenMatDouble X,
const LaGenMatDouble B 
)

Compute the solution to a real system of linear equations A*X=B in-place.

Depending on the dimensions of A, either a LU or a QR decomposition is used.

In-place means: The contents of A are overwritten during the calculation. B is not overwritten but always copied during this operation.

Note:
This function was broken with non-square matrices and QR decomposition for a long time. It is fixed and verified only since lapackpp-2.4.11.

void LaLULinearSolve ( const LaGenMatDouble A,
LaGenMatDouble X,
const LaGenMatDouble B 
)

Compute the solution to a real system of linear equations A*X=B by using the LU decomposition. This only works for a squares matrix A.

void LaLULinearSolveIP ( LaGenMatDouble A,
LaGenMatDouble X,
const LaGenMatDouble B 
)

Compute the solution to a real system of linear equations A*X=B by using the LU decomposition in-place. This only works for a squares matrix A.

In-place means: The contents of A are overwritten during the calculation. B is not overwritten but always copied during this operation.

void LaQRLinearSolve ( const LaGenMatDouble A,
LaGenMatDouble X,
const LaGenMatDouble B 
)

Compute the solution to a real system of linear equations A*X=B by using QR decomposition, which works for any rectangular matrix A.

Note:
This function was broken for a long time. It is fixed and verified only since lapackpp-2.4.11.

void LaQRLinearSolveIP ( LaGenMatDouble A,
LaGenMatDouble X,
const LaGenMatDouble B 
)

Compute the solution to a real system of linear equations A*X=B by using the QR decomposition in-place. This works for any rectangular matrix A.

In-place means: The contents of A are overwritten during the calculation. B is not overwritten but always copied during this operation.

Note:
This function was broken for a long time. It is fixed and verified only since lapackpp-2.4.11.

void LUFactorizeIP ( LaGenMatDouble GM,
LaVectorLongInt PIV 
)

Compute the LU factorization.

Compute the LU factorization (in-place) of a general M-by-N matrix A.

More info: See man dgetrf.

In-place means: The contents of GM are overwritten during the calculation.

Parameters:
GM Matrix to be factorized in-place.
PIV Vector to return the pivoting indices. This vector *has* to be at least as long as min(M,N).

void LaLinearSolve ( const LaGenMatComplex A,
LaGenMatComplex X,
const LaGenMatComplex B 
)

Compute the solution to a complex-valued system of linear equations A*X=B

Depending on the dimensions of A, either a LU or a QR decomposition is used.

Note:
This function was broken with non-square matrices and QR decomposition for a long time. It is fixed and verified only since lapackpp-2.4.11.

void LaLinearSolveIP ( LaGenMatComplex A,
LaGenMatComplex X,
const LaGenMatComplex B 
)

Compute the solution to a complex-valued system of linear equations A*X=B in-place.

Depending on the dimensions of A, either a LU or a QR decomposition is used.

In-place means: The contents of A are overwritten during the calculation. B is not overwritten but always copied during this operation.

Note:
This function was broken with non-square matrices and QR decomposition for a long time. It is fixed and verified only since lapackpp-2.4.11.

void LaLULinearSolve ( const LaGenMatComplex A,
LaGenMatComplex X,
const LaGenMatComplex B 
)

Compute the solution to a complex-valued system of linear equations A*X=B by using the LU decomposition. This only works for a squares matrix A.

void LaLULinearSolveIP ( LaGenMatComplex A,
LaGenMatComplex X,
const LaGenMatComplex B 
)

Compute the solution to a complex-valued system of linear equations A*X=B by using the LU decomposition in-place. This only works for a squares matrix A.

In-place means: The contents of A are overwritten during the calculation. B is not overwritten but always copied during this operation.

void LaQRLinearSolve ( const LaGenMatComplex A,
LaGenMatComplex X,
const LaGenMatComplex B 
)

Compute the solution to a complex-valued system of linear equations A*X=B by using QR decomposition, which works for any rectangular matrix A.

Note:
This function was broken for a long time. It is fixed and verified only since lapackpp-2.4.11.

void LaQRLinearSolveIP ( LaGenMatComplex A,
LaGenMatComplex X,
const LaGenMatComplex B 
)

Compute the solution to a complex-valued system of linear equations A*X=B by using the QR decomposition in-place. This works for any rectangular matrix A.

In-place means: The contents of A are overwritten during the calculation. B is not overwritten but always copied during this operation.

Note:
This function was broken for a long time. It is fixed and verified only since lapackpp-2.4.11.

void LUFactorizeIP ( LaGenMatComplex GM,
LaVectorLongInt PIV 
)

Compute the LU factorization.

Compute the LU factorization (in-place) of a general M-by-N matrix A.

In-place means: The contents of GM are overwritten during the calculation.

More info: See man zgetrf.

Parameters:
GM Matrix to be factorized in-place.
PIV Vector to return the pivoting indices. This vector *has* to be at least as long as min(M,N).

void LaLUInverseIP ( LaGenMatComplex A,
LaVectorLongInt PIV 
)

Compute the inverse of a matrix from LU factorization.

Compute the inverse of a matrix in-place based on output from LUFactorizeIP

In-place means: The contents of A are overwritten during the calculation.

Parameters:
A Matrix factorized output matrix from LUFactorizeIP
PIV Vector pivoting indices output from LUFactorizeIP.

void LaLUInverseIP ( LaGenMatComplex A,
LaVectorLongInt PIV,
LaVectorComplex work 
)

Compute the inverse of a matrix from LU factorization.

Compute the inverse of a matrix in-place based on output from LUFactorizeIP

In-place means: The contents of A are overwritten during the calculation.

Parameters:
A Matrix factorized output matrix from LUFactorizeIP
PIV Vector pivoting indices output from LUFactorizeIP.
work Vector temporary work area (can be reused for efficiency). work.size() must be at least A.size(0), if it is less, it will get resized.

void LaEigSolve ( const LaGenMatDouble A,
LaVectorComplex eigvals,
LaGenMatDouble VR 
)

This function calculates all eigenvalues and eigenvectors of a general matrix A. Uses dgeev . A wrapper for the other function that uses two LaVectorDouble's for the eigenvalues.

Uses dgeev

Parameters:
A On entry, the general matrix A of dimension N x N.
eigvals On exit, this vector contains the eigenvalues. Complex conjugate pairs of eigenvalues appear consecutively with the eigenvalue having the positive imaginary part first. The given argument must be a vector of length N whose content will be overwritten.
VR On exit, the right eigenvectors v(j) are stored one after another in the columns of VR, in the same order as their eigenvalues. If the j- th eigenvalue is real, then v(j) = VR(:,j), the j-th column of VR. If the j-th and (j+1)-st eigenvalues form a complex con- jugate pair, then v(j) = VR(:,j) + i*VR(:,j+1) and v(j+1) = VR(:,j) - i*VR(:,j+1). The given argument can be of size NxN, in which case the content will be overwritten, or of any other size, in which case it will be resized to dimension NxN.

void LaEigSolve ( const LaGenMatDouble A,
LaVectorDouble eigvals_real,
LaVectorDouble eigvals_imag,
LaGenMatDouble VR 
)

This function calculates all eigenvalues and eigenvectors of a general matrix A.

Uses dgeev

Parameters:
A On entry, the general matrix A of dimension N x N.
eigvals_real On exit, this vector contains the real parts of the eigenvalues. Complex conjugate pairs of eigenvalues appear consecutively with the eigenvalue having the positive imaginary part first. The given argument must be a vector of length N whose content will be overwritten.
eigvals_imag On exit, this vector contains the imaginary parts of the eigenvalues. The given argument must be a vector of length N whose content will be overwritten.
VR On exit, the right eigenvectors v(j) are stored one after another in the columns of VR, in the same order as their eigenvalues. If the j- th eigenvalue is real, then v(j) = VR(:,j), the j-th column of VR. If the j-th and (j+1)-st eigenvalues form a complex con- jugate pair, then v(j) = VR(:,j) + i*VR(:,j+1) and v(j+1) = VR(:,j) - i*VR(:,j+1). The given argument can be of size NxN, in which case the content will be overwritten, or of any other size, in which case it will be resized to dimension NxN.
FIXME: Needs verification!

void LaEigSolveSymmetricVecIP ( LaGenMatDouble A_symmetric,
LaVectorDouble eigvals 
)

FIXME: This is a misleading function! This function calculates all eigenvalues and eigenvectors of a symmetric matrix A, not a general matrix A!

In-place means: The contents of A_symmetric are overwritten during the calculation.

Parameters:
A_symmetric On entry, the symmetric (not a general!!) matrix A. The leading N-by-N lower triangular part of A is used as the lower triangular part of the matrix to be decomposed. On exit, A contains the orthonormal eigenvectors of the matrix.
eigvals Vector of length at least N. On exit, this vector contains the N eigenvalues.
FIXME: Needs verification! FIXME: This uses dsyev which only works on symmetric matrices. Instead, this should be changed to use dgeev or even better dgeevx. For the complex case, we would have to write another function that uses zgeev or zgeevx.

New in lapackpp-2.4.9.

void LaEigSolveVecIP ( LaGenMatDouble A_symmetric,
LaVectorDouble eigvals 
)

DEPRECATED, has been renamed into LaEigSolveSymmetricVecIP().

This is a misleading function! This function calculates all eigenvalues and eigenvectors of a symmetric matrix A, not a general matrix A!

This function just passes on the arguments to LaEigSolveSymmetricVecIP().

Deprecated:

void LaEigSolve ( const LaGenMatComplex A,
LaVectorComplex W,
LaGenMatComplex VR 
)

Compute for an N-by-N complex nonsymmetric matrix A the eigenvalues, and the right eigenvectors. Uses zgeev .

(FIXME: Should add the option to select calculation of left eigenvectors instead of the right eigenvectors, or both, or none.)

Parameters:
A On entry, the general matrix A of dimension N x N.
W Contains the computed eigenvalues. The given argument must be a vector of length N whose content will be overwritten.
VR On exit, the right eigenvectors v(j) are stored one after another in the columns of VR, in the same order as their eigenvalues. The given argument can be of size NxN or greater, in which case the content will be overwritten, or of any other size, in which case it will be resized to dimension NxN.
FIXME: Needs verification!

void LaLUInverseIP ( LaGenMatDouble A,
LaVectorLongInt PIV 
)

Compute the inverse of a matrix from LU factorization.

Compute the inverse of a matrix in-place based on output from LUFactorizeIP

In-place means: The contents of A are overwritten during the calculation.

Parameters:
A Matrix factorized output matrix from LUFactorizeIP
PIV Vector pivoting indices output from LUFactorizeIP.

void LaLUInverseIP ( LaGenMatDouble A,
LaVectorLongInt PIV,
LaVectorDouble work 
)

Compute the inverse of a matrix from LU factorization.

Compute the inverse of a matrix in-place based on output from LUFactorizeIP

In-place means: The contents of A are overwritten during the calculation.

Parameters:
A Matrix factorized output matrix from LUFactorizeIP
PIV Vector pivoting indices output from LUFactorizeIP.
work Vector temporary work area (can be reused for efficiency). work.size() must be at least A.size(0), if it is less, it will get resized.


Generated on Sat Jul 14 11:40:36 2007 for Lapack++ by  doxygen 1.5.0