forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 10:27 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: needed help on how to use smatrixevd function
PostPosted: Thu Nov 11, 2010 2:36 pm 
Offline

Joined: Fri Nov 05, 2010 12:47 pm
Posts: 9
Please someone post the program on how to pass arguments to smatrixevd function.
The alglib doesn't have any example on this function and neither it is available anywhere else on the net....
please.........


Top
 Profile  
 
 Post subject: Re: needed help on how to use smatrixevd function
PostPosted: Thu Nov 11, 2010 2:48 pm 
Offline

Joined: Fri Nov 05, 2010 12:47 pm
Posts: 9
Here is what I am trying......
I am trying to find the eigenvalues of array samet....

real_2d_array samet[3][3]={{10,12,6},{12,15,7},{6,7,11}}, temp[2][2]; //
real_1d_array dd[2];
smatrixevd(samet,2,'U',1,dd,temp); //Please help here.......
for(int a =0; a<3;a++)
{
printf("%.6f ", dd[a]);
}

dd stores my eigen values(hope so)


Top
 Profile  
 
 Post subject: Re: needed help on how to use smatrixevd function
PostPosted: Thu Nov 11, 2010 2:56 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Try this:
Code:
real_2d_array samet = "[[10,12,6],[12,15,7],[6,7,11]]", temp;
real_1d_array dd;
smatrixevd(samet,3,2,true,dd,temp);
for(int a =0; a<3;a++)
{
    printf("%.6lf ", dd[a]);
}


Top
 Profile  
 
 Post subject: Re: needed help on how to use smatrixevd function
PostPosted: Thu Nov 11, 2010 4:07 pm 
Offline

Joined: Fri Nov 05, 2010 12:47 pm
Posts: 9
Sergey.Bochkanov wrote:
Try this:
Code:
real_2d_array samet = "[[10,12,6],[12,15,7],[6,7,11]]", temp;
real_1d_array dd;
smatrixevd(samet,3,2,true,dd,temp);
for(int a =0; a<3;a++)
{
    printf("%.6lf ", dd[a]);
}

Dear Admin,
Thank you for the reply..
I compiled the code in Netbeans in windows 7, Cygwin environment, and the code builds successfully.
But the output is not there.
The command window shows the error as:
"terminate called after throwing an instance of 'alglib::ap_error'"

What could be the reason?


Top
 Profile  
 
 Post subject: Re: needed help on how to use smatrixevd function
PostPosted: Thu Nov 11, 2010 4:19 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Sorry, it must be

Code:
smatrixevd(samet,3,[b]1[/b],true,dd,temp);


not

Code:
smatrixevd(samet,3,[b]2[/b],true,dd,temp);


in case of other errors you can catch ap_error exception and inspect msg field.


Top
 Profile  
 
 Post subject: Re: needed help on how to use smatrixevd function
PostPosted: Thu Nov 11, 2010 4:29 pm 
Offline

Joined: Fri Nov 05, 2010 12:47 pm
Posts: 9
Sergey.Bochkanov wrote:
Sorry, it must be

Code:
smatrixevd(samet,3,[b]1[/b],true,dd,temp);


not

Code:
smatrixevd(samet,3,[b]2[/b],true,dd,temp);


in case of other errors you can catch ap_error exception and inspect msg field.



Thank You Admin, Alglib is great....
Now, it works perfectly...


Top
 Profile  
 
 Post subject: Re: needed help on how to use smatrixevd function
PostPosted: Thu Nov 11, 2010 7:26 pm 
Offline

Joined: Fri Nov 05, 2010 12:47 pm
Posts: 9
Suppose I have an array as "double samet [3][3] = [[10,12,6],[12,15,7],[6,7,11]];"
And I want to eigenvalues of this array.
How do I typecast this to real_2d_array from double;

I need to do this as I am having a matrix from other program which is declared double[][];


Top
 Profile  
 
 Post subject: Re: needed help on how to use smatrixevd function
PostPosted: Thu Nov 11, 2010 8:24 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
You can allocate array with setlength call and assign values to its elements manually.


Top
 Profile  
 
 Post subject: Re: needed help on how to use smatrixevd function
PostPosted: Fri Nov 12, 2010 4:52 am 
Offline

Joined: Fri Nov 12, 2010 4:48 am
Posts: 3
Sergey.Bochkanov wrote:
Sorry, it must be

Code:
smatrixevd(samet,3,[b]1[/b],true,dd,temp);


not

Code:
smatrixevd(samet,3,[b]2[/b],true,dd,temp);


in case of other errors you can catch ap_error exception and inspect msg field.


I am trying to use this function too, and my purpose is to get eigenvectors of a matrix.
I tried the sample code, it can return eigenvalues alright, but the eigenvectors matrix (temp for sample code) is all zeros, can somebody help me with this please~


Top
 Profile  
 
 Post subject: Re: needed help on how to use smatrixevd function
PostPosted: Fri Nov 12, 2010 8:22 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Can you post code which calls ALGLIB and gets zero matrix?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group