Logo MTL4
eigenvalue_symmetric(A)

Returns eigenvalues of symmetric matrix A.

Currently there are 2 algorithms that compute the eigenvalues of a symmetric matrix. 1. qr_algo(A, iterations) 2. qr_sym_imp(A) (with Wilkinson shift)

Details: mtl::matrix::eigenvalue_symmetric

For example:

#include <iostream>
#include <boost/test/minimal.hpp>
#include <boost/numeric/mtl/mtl.hpp>

int test_main(int, char**)
{
    using namespace mtl;

    dense_vector<double>                    eig;

    double array[][4]= {{1,  1,   1,  0},
                        {1, -1,  -2,  0},
                        {1, -2,   1,  0},
                        {0,  0,   0, 10}};
    dense2D<double> A(array);
    std::cout << "A=\n" << A << "\n";

    eig= eigenvalue_symmetric(A,22);
    std::cout<<"eigenvalues  ="<< eig <<"\n";
    
    eig= 0;
    eig= qr_sym_imp(A);
    std::cout<<"eigenvalues  ="<< eig <<"\n";
    
    eig= 0;
    eig= qr_algo(A, 5);  // only 5 qr iterations (Q-R-changes)
    std::cout<<"eigenvalues  ="<< eig <<"\n";
 
    return 0;
}



Return to Overview                                Table of Content                               


eigenvalue_symmetric(A) -- MTL 4 -- Peter Gottschling and Andrew Lumsdaine -- Gen. with rev. 7542 on Sat Aug 11 2012 by doxygen 1.7.6.1 -- © 2010 by SimuNova UG.