## LAPWRAPMW

Here you can download Matlab wrappers for LAPACK. The name of the package is for now lapwrapmw.

• syev:the full collection of the symmetric eigensolvers availabe in LAPACK-3.0,
• gels:the full collection of the Linear Least Squares solver available in LAPACK-3.0.
It runs under Windows and Linux and the installation has been made as easy as possible. We plug on the LAPACK library that is provided with Matlab.

## Demo :

• To find the eigenvalues and eigenvectors of a symmetric matrix A with the Divide and Conquer algorithm:
```	> [V,D] = syev(A,'dc');
```
Four algorithms available, option 'dc' is 5 times faster than eig(A) for (n=800; A=randn(n);A=A+A';Julien's laptop)
• To solve the minimum-norm problem ( min_X || X ||_F s.t. AX=B where A is m-by-n with m < n)
```	> x = gels(A,b,'y');
```
Four algorithms available.

lapwrapmw-0.8.4.tar (09/12/2009) : Matlab wrapper. It comes with source files, that need to be compiled for your machine. Please read the README file included. Works under Windows or Linux machines providing you have Matlab.

## Install:

```0) Untar lapwrapmw-0.8.4.tar (this creates lapwrapmw-0.8.2 directory)

On Linux:
save the file lapwrapmw-0.8.4.tar
command line: tar xvf lapwrapmw-0.8.2.tar
On Windows:
save the file lapwrapmw-0.8.4.tar
use Winrar Extract command or use Cygwin tar -xvf command line

1) Launch Matlab

2) Go in the directory lapwrapmw-0.8.4

3) Type make_windows if you are running Microsoft Windows
or   make_linux if you are running linux/unix.

4) You can then call the functions, or run the demos (demo_gels, demo_syev)
or type 'help gels', 'help syev'
```

## Documentation :

• ``` SYEV   Eigenvalues and eigenvectors of symmetric/Hermitian matrix.

[D] = SYEV(A) computes the eigenvalues of a symmetric/Hermitian matrix A.
First A is reduced to tridiagonal form so that A=Q1*T*Q1' then the
symmetric QR iteration algorithm is used on the tridiagonal matrix T to
find D, the eigenvalues of T. D corresponds to the eigenvalues of A. This
routine calls LAPACK routine _SYEV/_HEEV.

[V,D] = SYEV(A) computes eigenvalues and eigenvectors of a
symmetric/Hermitian matrix A. First A is reduced to tridiagonal form so
that A = Q1*T*Q1' then the symmetric QR iteration algorithm is used on the
tridiagonal matrix T to find D, the eigenvalues of T, and Q2 the
eigenvectors of T so that T = Q2*D*Q2'. D corresponds to the eigenvalues of
A. The eigenvectors of A are such that V = Q1*Q2.

[V,D] = SYEV(A,PARAM) computes eigenvalues and eigenvectors of a
symmetric/Hermitian matrix A. Same as [V,D] = SYEV(A) except that PARAM
enables to choose the method used in the symmetric tridiagonal
eigenproblem.
PARAM controls the algorithm used:

'dc'
stands for "Divide and Conquer"
calls LAPACK routine _SYEVD/_HEEVD

'mrrr'
stands for "Multiple Relatively Robust Representations"
calls LAPACK routine _SYEVR/_HEEVR

'bx'
stands for "bisection and inverse iteration"
calls LAPACK routine _SYEVX/_HEEVX

'qr'
(default)
stands for " symmetric QR iteration"
calls LAPACK routine _SYEV/_HEEV

When A is symmetric/Hermitian SYEV(A,'qr') is the same as EIG(A).

```
• ``` GELS   Solves an overdetermined or underdetermined linear problem.

[X] = GELS(A,B) same as [X] = GELS(A,B,'default')

[X] = GELS(A,B,PARAM) if A is m-by-n and m > n then GELS computes the solution of the
linear least squares problem
min || A * X - B ||_F ,
if A is m-by-n and m < n then GELS computes the solution of the minimum norm problem
min || X ||_F s.t. A*X = B
PARAM controls the algorithm used:

'dc'
performs SVD factorization of A using the divide and conquer
method then solve the undetermined or overdetermined problem.
calls LAPACK routine _GELSD

'svd'
performs SVD factorization of A using QR iterations then solve the
undetermined or overdetermined problem.
calls LAPACK routine _GELSS

'y'
performs QR factorization of A then solve the undetermined or
overdetermined problem.
calls LAPACK routine _GELSY

'default'
(default)
performs QR factorization of A without pivoting, then solve the
undetermined or overdetermined problem.  The fact that there is no
pivoting in the QR factorization means that A(:,1:min(size(A))
needs to be full rank.
calls LAPACK routine _GELS

When A is m-by-n with m > n then [X] = GELS(A,B) is the same as X=A\B.

When A is m-by-n with m < n  then [X] = GELS(A,B,PARAM) is _not_ the same as
X=A\B. [X] = GELS(A,B,PARAM) solves the problem
(*)    min_X || X ||_F s.t. AX=B
while X=A\B solves AX=B by first performing a QR factorization of A
[Q,R,E] = QR(A)
then X is obtained via
X = E(:,1:m)*(R(:,1:m)\(Q'*b))]
The \ method is faster than GELS, X is such that AX=B but X is not (in the
general case) the solution of (*).