# Contents

Navigating This Site
What's New
Search in MTL Pages
>MTL Home

On-Line Documentation
Introduction
Programmer's Reference
Examples
Performance Results
Recent Tests
To-do list
Coding Standards

Related Work
Related Projects at OSL
Projects Using MTL
Generic Programming
Scientific Computing

MTL Publications
Papers
Presentations

Contact
Support
Contribute!
Mailing Lists
Source code for `geev.cc`
Show this file without HTML

```// -*- c++ -*-
//
//
//===========================================================================

#include
#include "mtl/mtl2lapack.h"
#include "mtl/dense1D.h"
#include "mtl/utils.h"

using namespace std;

/*
Sample Output

2x2
[
[0,1],
[-6,5]
]
eigenvalues
[(2,0),(3,0),]
eigenvectors
4x2
[
[0.447214,0.316228],
[0.894427,0.948683],
[0,0],
[0,0]
]

*/

int
main()
{
using namespace mtl2lapack;

const int N = 2;
//begin
double da [] = { 0, -6, 1, 5 };
lapack_matrix::type A(da, N,N), vl((double*)0,N,N);
lapack_matrix::type vr(2*N,N);
mtl::dense1D< std::complex > wr(N);
int info;
//end
mtl::print_all_matrix(A);

// Compute the eigenvalues and right eigenvectors of A.
//begin
info = geev(GEEV_CALC_RIGHT, A, wr, vl, vr);
//end
if (info > 0) {
cout << "QR failed to converge, INFO = " << info << endl;
return 0;
}

// Print the eigenvalues and eigenvectors.

cout << "eigenvalues" << endl;
mtl::print_vector(wr);

cout << "eigenvectors" << endl;

mtl::print_all_matrix(vr);

return 0;
}
```
If you have comments or suggestions, email mtl-devel@osl.iu.edu
 Author: Andrew Lumsdaine, Jeremy Siek Lie-Quan Lee E-Mail: lums@osl.iu.edu, jsiek@osl.iu.edu, llee@osl.iu.edu Created: July 27, 1998 Modified: Mon 27-Aug-2012 EST Copyright ©1997-2013