<< linalg_powfast Linalg linalg_solvelu >>

Linalg >> Linalg > linalg_rayleighiteration

linalg_rayleighiteration

Computes approximated a pair of eigenvalue and eigenvector.

Calling Sequence

[mu,b,iter] = linalg_rayleighiteration ( A , mu0 , b0 , rtol , itmax , verbose )

Parameters

A :

a n-by-n matrix of doubles, real, symetric

mu0 :

a 1-by-1 matrix of doubles, an estimated eigenvalue

b0 :

a n-by-1 matrix of doubles, an estimated eigenvector

rtol :

a 1-by-1 matrix of doubles, a relative tolerance

itmax :

a maximum number of iterations

verbose :

a 1-by-1 matrix of booleans, set to true to print convergence messages

mu :

a 1-by-1 matrix of doubles, an approximated eigenvalue

b :

a n-by-1 matrix of doubles, an approximated eigenvector

iter :

the number of iterations performed

Description

Uses Rayleigh iterations to find an approximate eigenvalue and an approximate eigenvector.

The algorithm stops if norm(A*b-mu*b) < rtol*norm(mu*b).

Caution! The algorithm has problems when it comes closer to the exact result, because an intermediate matrix becomes more and more ill-conditionned. In this case, Scilab switches the backslash operator from Gaussian elimination to least squares, which makes the algorithms going nuts. Hence, we cannot use this algorithm with a relative tolerance which is too small.

Examples

// Example #1
A = [
6 2 3
2 5 1
3 1 3
];
b = [1 1 1]';
mu = 1;
tol = 1.e-4;
[mu,b,iter]=linalg_rayleighiteration ( A , mu , b , tol , 20 , %f )

// Example #2
A = [
1 2 3
1 2 1
3 2 1
];
b = [1 1 1]';
mu = 200;
tol = 1.e-4;
[mu,b,iter]=linalg_rayleighiteration ( A , mu , b , tol , 100 , %f )

// Example #3
// The initial eigenvalue is close to the
// exact one.
// This makes Scilab switch to least squares and
// prints a warning.
//
A = [
1 2 3
1 2 1
3 2 1
];
b = [1 1 1]';
mu = 0.7639320225002093067701;
tol = 1.e-4;
[mu,b,iter]=linalg_rayleighiteration ( A , mu , b , tol , 100 , %f )

Authors

<< linalg_powfast Linalg linalg_solvelu >>