[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: calculating the eigen matrix
From: |
Tapesh |
Subject: |
RE: calculating the eigen matrix |
Date: |
Fri, 4 Jun 2004 12:48:11 -0500 |
Hi Quentin,
Thanks for your reply.
It is working perfectly fine..
Could you please also help me in one other problem? I have C style
<double> array and I want to create Matrix out of it. I didn't find any
constructor which take the double[] and create matrix.
Currently I am doing like this: (using the fill() function)
Matrix a(3,3);
//a = [ 1, 1, 2; 3, 5, 8; 13, 21, 34 ];
a.fill(1,0,0,0,0);
a.fill(1,0,1,0,1);
a.fill(2,0,2,0,2);
a.fill(3,1,0,1,0);
a.fill(5,1,1,1,1);
a.fill(8,1,2,1,2);
a.fill(13,2,0,2,0);
a.fill(21,2,1,2,1);
a.fill(34,2,2,2,2);
Is this the right way? I am not confident if it is the efficient way to
do it.
Thanks in advance,
Tapesh
-----Original Message-----
From: Quentin Spencer [mailto:address@hidden
Sent: Friday, June 04, 2004 9:20 PM
To: address@hidden
Cc: address@hidden
Subject: Re: calculating the eigen matrix
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
-------------------------------------------------------------