help-octave
[Top][All Lists]

## Re: calculating the eigen matrix

 From: Quentin Spencer Subject: Re: calculating the eigen matrix Date: Fri, 04 Jun 2004 10:50:19 -0500 User-agent: Mozilla Thunderbird 0.6 (X11/20040519)

```This is from some old code I wrote:

ComplexMatrix R(size,size), V(size,size);
// Assign R to something...
V = EIG(R).eigenvectors();

```
Note that the data type doesn't have to be ComplexMatrix--it could also be just Matrix. I only needed the eigenvectors in this particular application. If you wanted both eigenvalues and eigenvectors, a better way would probably be something like this:
```
EIG EVD;
Matrix A,B;
ColumnVector c;
// Assign A to something...
EVD=EIG(A);
B=EVD.eigenvectors();
c=EVD.eigenvalues();

```
This code is untested--just based on what I remember from doing this sort of thing in the past. I hope this helps.
```
Regards,
Quentin Spencer

Tapesh wrote:

```
```Hi,

```
I am writing an application in C/C++ and want to use Octave library to calculate the eigen matrix and eigen-values.
```
```
I am able to compile octave successfully and to write a sample C++ programme.
```
```
```Can someone provide a sample code to calculate eigen vectors?

```
```Thanks in Advance,

Tapesh Kr. Agarwal

```
```

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```