Notice: These methods are no longer supported as the algorithm used here is not always converging for medium to large size matrices.
The following methods are available to evaluate the eigen values and corresponding eigen vectors of a matrix.
1. bool eigen (valarray<T>& reival) const;
2. bool eigen (valarray<T>& reival, matrix<T>& eivec) const;
3. bool eigen (valarray<T>& reival, valarray<T>& ieival) const;
4. bool eigen (valarray<T<& reival, valarray<T>& ieival, matrix<T>& eivec) const;
typedef techsoft::matrix<double> Matrix;
typedef std::valarray<double> Vector;
using techsoft::gmslice;
using techsoft::LTRIANG;
using techsoft::UTRIANG;
size_t n = 4;
Matrix a(n,n), ev(n,n);
Vector d(n), e(n);
bool ret;
a.rand();
a = a[gmslice(UTRIANG)];
a[gmslice(LTRIANG)] = ~a; // a is now a symmetric matrix
ret = a.eigen( d); // Finds the eigen values
ret = a.eigen( d, ev); // Finds both eigen values and eigen vectors
a.rand();
ret = a.eigen( d, e); // Finds real and imaginary eigen values
ret = a.eigen( d, e, ev); // Finds real and imaginary eigen values and eigen vectors