* Re: Eigen value problem
2001-12-19 13:20 Eigen value problem Varghese John
@ 2001-12-19 13:20 ` Brian Gough
0 siblings, 0 replies; 4+ messages in thread
From: Brian Gough @ 2001-12-19 13:20 UTC (permalink / raw)
To: Varghese John; +Cc: Jim.Love, gsl-discuss
Varghese John writes:
>
> Thank you for your prompt reply.
> I just switched to gsl 9.2+
> and the problem disappeared!
> Was this a known issue?
There were some bugfixes made in 0.9.1. Note that the current version
is 0.9.3.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Eigen value problem
@ 2001-12-19 13:20 Varghese John
2001-12-19 13:20 ` Brian Gough
0 siblings, 1 reply; 4+ messages in thread
From: Varghese John @ 2001-12-19 13:20 UTC (permalink / raw)
To: Jim.Love, gsl-discuss
Thank you for your prompt reply.
I just switched to gsl 9.2+
and the problem disappeared!
Was this a known issue?
Anyway, thank you for the prompt reply.
Regards,
John
>From: "Jim Love" <Jim.Love@asml.com>
>To: <vjohn111@hotmail.com>, <gsl-discuss@sources.redhat.com>
>Subject: Re: Eigen value problem
>Date: Mon, 01 Oct 2001 12:30:06 -0400
>
>This program works for me just fine (gsl 0.9.2 on win32 and redhat 7.1).
>Here is the output for a 2x2 and a 3x3:
>
>The Input Matrix:
> 1 2
> 2 1
>
>The EigenValues :
>eigenvalue = 3
>eigenvalue = -1
>
>The Input Matrix:
> 4 1 1
> 1 2 2
> 1 2 9
>
>The EigenValues :
>eigenvalue = 9.79216
>eigenvalue = 3.93673
>eigenvalue = 1.27111
>
>James A. Love
>X4477
>Pager 1-800-286-1188 Pin# 400659
>
> >>> "Varghese John" <vjohn111@hotmail.com> 10/01/01 11:51AM >>>
>
>Hi,
>I am having problems with the following program.
>trying to get eigen values for the 2x2 matrix, and the program hangs?
>
>--it works fine for a 3x3 matrix!
>
>thanks.
>vj
>-----------------------------------------------
>#include <gsl/gsl_eigen.h>
>#include <stdio.h>
>#include <math.h>
>
>#define TestSize 2
>
>void GetEigen1();
>void GetEigenvaluesForSymmMat( gsl_matrix * m, int mSize, gsl_vector * v);
>
>
>int main(){
> GetEigen1();
> return(0);
>}
>
>void GetEigen1(){
>
> int i;
> int j;
> int x;
>
> gsl_matrix * m = gsl_matrix_alloc(TestSize, TestSize);
> gsl_matrix_set_zero(m);
>
>
> /* matrix = ((1, 2), (2, 1)) */
>
> gsl_matrix_set(m, 0, 0, 1.0);
> gsl_matrix_set(m, 0, 1, 2.0);
> gsl_matrix_set(m, 1, 0, 2.0);
> gsl_matrix_set(m, 1, 1, 1.0);
>
>
>
> /* matrix = ((4, 1, 1), (1, 2, 2), (1, 2, 9)) */
> /*
> gsl_matrix_set(m, 0, 0, 4.0);
> gsl_matrix_set(m, 0, 1, 1.0);
> gsl_matrix_set(m, 0, 2, 1.0);
> gsl_matrix_set(m, 1, 0, 1.0);
> gsl_matrix_set(m, 1, 1, 2.0);
> gsl_matrix_set(m, 1, 2, 2.0);
> gsl_matrix_set(m, 2, 0, 1.0);
> gsl_matrix_set(m, 2, 1, 2.0);
> gsl_matrix_set(m, 2, 2, 9.0);
> */
>
>
> printf("The Input Matrix: \n");
> for (i = 0; i < TestSize; i++){
> for (j = 0; j <TestSize; j++){
> printf("%6.4g \t", gsl_matrix_get (m, i, j));
> }
> printf("\n");
> }
> printf("\n");
>
> //use this vector to store the eigen values.
> gsl_vector *v=gsl_vector_alloc(TestSize);
> GetEigenvaluesForSymmMat( m, TestSize, v);
> printf("The EigenValues : \n");
>
> //print the result
> for (x = 0; x < TestSize; x++)
> {
> printf("eigenvalue = %g\n", gsl_vector_get(v, x));
> }
>}
>
>
>//This function computes the eigen values of a symmetric block
>//and returns the ordered eigen values in the vector v.
>
>void GetEigenvaluesForSymmMat( gsl_matrix * m, int mSize, gsl_vector * v)
>{
>
> gsl_vector *eval = gsl_vector_alloc (mSize);
> gsl_vector_set_zero(eval);
> gsl_matrix *evec = gsl_matrix_alloc (mSize, mSize);
> gsl_matrix_set_zero(evec);
> gsl_eigen_symmv_workspace * w =
> gsl_eigen_symmv_alloc (mSize);
>
> gsl_eigen_symmv (m, eval, evec, w);
>
> gsl_eigen_symmv_free(w);
>
> gsl_eigen_symmv_sort (eval, evec, GSL_EIGEN_SORT_ABS_DESC);
>
> gsl_vector_memcpy(v, eval);
>
>}
>
>
>
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Eigen value problem
@ 2001-12-19 13:20 Jim Love
0 siblings, 0 replies; 4+ messages in thread
From: Jim Love @ 2001-12-19 13:20 UTC (permalink / raw)
To: vjohn111, gsl-discuss
This program works for me just fine (gsl 0.9.2 on win32 and redhat 7.1). Here is the output for a 2x2 and a 3x3:
The Input Matrix:
1 2
2 1
The EigenValues :
eigenvalue = 3
eigenvalue = -1
The Input Matrix:
4 1 1
1 2 2
1 2 9
The EigenValues :
eigenvalue = 9.79216
eigenvalue = 3.93673
eigenvalue = 1.27111
James A. Love
X4477
Pager 1-800-286-1188 Pin# 400659
>>> "Varghese John" <vjohn111@hotmail.com> 10/01/01 11:51AM >>>
Hi,
I am having problems with the following program.
trying to get eigen values for the 2x2 matrix, and the program hangs?
--it works fine for a 3x3 matrix!
thanks.
vj
-----------------------------------------------
#include <gsl/gsl_eigen.h>
#include <stdio.h>
#include <math.h>
#define TestSize 2
void GetEigen1();
void GetEigenvaluesForSymmMat( gsl_matrix * m, int mSize, gsl_vector * v);
int main(){
GetEigen1();
return(0);
}
void GetEigen1(){
int i;
int j;
int x;
gsl_matrix * m = gsl_matrix_alloc(TestSize, TestSize);
gsl_matrix_set_zero(m);
/* matrix = ((1, 2), (2, 1)) */
gsl_matrix_set(m, 0, 0, 1.0);
gsl_matrix_set(m, 0, 1, 2.0);
gsl_matrix_set(m, 1, 0, 2.0);
gsl_matrix_set(m, 1, 1, 1.0);
/* matrix = ((4, 1, 1), (1, 2, 2), (1, 2, 9)) */
/*
gsl_matrix_set(m, 0, 0, 4.0);
gsl_matrix_set(m, 0, 1, 1.0);
gsl_matrix_set(m, 0, 2, 1.0);
gsl_matrix_set(m, 1, 0, 1.0);
gsl_matrix_set(m, 1, 1, 2.0);
gsl_matrix_set(m, 1, 2, 2.0);
gsl_matrix_set(m, 2, 0, 1.0);
gsl_matrix_set(m, 2, 1, 2.0);
gsl_matrix_set(m, 2, 2, 9.0);
*/
printf("The Input Matrix: \n");
for (i = 0; i < TestSize; i++){
for (j = 0; j <TestSize; j++){
printf("%6.4g \t", gsl_matrix_get (m, i, j));
}
printf("\n");
}
printf("\n");
//use this vector to store the eigen values.
gsl_vector *v=gsl_vector_alloc(TestSize);
GetEigenvaluesForSymmMat( m, TestSize, v);
printf("The EigenValues : \n");
//print the result
for (x = 0; x < TestSize; x++)
{
printf("eigenvalue = %g\n", gsl_vector_get(v, x));
}
}
//This function computes the eigen values of a symmetric block
//and returns the ordered eigen values in the vector v.
void GetEigenvaluesForSymmMat( gsl_matrix * m, int mSize, gsl_vector * v) {
gsl_vector *eval = gsl_vector_alloc (mSize);
gsl_vector_set_zero(eval);
gsl_matrix *evec = gsl_matrix_alloc (mSize, mSize);
gsl_matrix_set_zero(evec);
gsl_eigen_symmv_workspace * w =
gsl_eigen_symmv_alloc (mSize);
gsl_eigen_symmv (m, eval, evec, w);
gsl_eigen_symmv_free(w);
gsl_eigen_symmv_sort (eval, evec, GSL_EIGEN_SORT_ABS_DESC);
gsl_vector_memcpy(v, eval);
}
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Eigen value problem
@ 2001-12-19 13:20 Varghese John
0 siblings, 0 replies; 4+ messages in thread
From: Varghese John @ 2001-12-19 13:20 UTC (permalink / raw)
To: gsl-discuss
Hi,
I am having problems with the following program.
trying to get eigen values for the 2x2 matrix, and the program hangs?
--it works fine for a 3x3 matrix!
thanks.
vj
-----------------------------------------------
#include <gsl/gsl_eigen.h>
#include <stdio.h>
#include <math.h>
#define TestSize 2
void GetEigen1();
void GetEigenvaluesForSymmMat( gsl_matrix * m, int mSize, gsl_vector * v);
int main(){
GetEigen1();
return(0);
}
void GetEigen1(){
int i;
int j;
int x;
gsl_matrix * m = gsl_matrix_alloc(TestSize, TestSize);
gsl_matrix_set_zero(m);
/* matrix = ((1, 2), (2, 1)) */
gsl_matrix_set(m, 0, 0, 1.0);
gsl_matrix_set(m, 0, 1, 2.0);
gsl_matrix_set(m, 1, 0, 2.0);
gsl_matrix_set(m, 1, 1, 1.0);
/* matrix = ((4, 1, 1), (1, 2, 2), (1, 2, 9)) */
/*
gsl_matrix_set(m, 0, 0, 4.0);
gsl_matrix_set(m, 0, 1, 1.0);
gsl_matrix_set(m, 0, 2, 1.0);
gsl_matrix_set(m, 1, 0, 1.0);
gsl_matrix_set(m, 1, 1, 2.0);
gsl_matrix_set(m, 1, 2, 2.0);
gsl_matrix_set(m, 2, 0, 1.0);
gsl_matrix_set(m, 2, 1, 2.0);
gsl_matrix_set(m, 2, 2, 9.0);
*/
printf("The Input Matrix: \n");
for (i = 0; i < TestSize; i++){
for (j = 0; j <TestSize; j++){
printf("%6.4g \t", gsl_matrix_get (m, i, j));
}
printf("\n");
}
printf("\n");
//use this vector to store the eigen values.
gsl_vector *v=gsl_vector_alloc(TestSize);
GetEigenvaluesForSymmMat( m, TestSize, v);
printf("The EigenValues : \n");
//print the result
for (x = 0; x < TestSize; x++)
{
printf("eigenvalue = %g\n", gsl_vector_get(v, x));
}
}
//This function computes the eigen values of a symmetric block
//and returns the ordered eigen values in the vector v.
void GetEigenvaluesForSymmMat( gsl_matrix * m, int mSize, gsl_vector * v) {
gsl_vector *eval = gsl_vector_alloc (mSize);
gsl_vector_set_zero(eval);
gsl_matrix *evec = gsl_matrix_alloc (mSize, mSize);
gsl_matrix_set_zero(evec);
gsl_eigen_symmv_workspace * w =
gsl_eigen_symmv_alloc (mSize);
gsl_eigen_symmv (m, eval, evec, w);
gsl_eigen_symmv_free(w);
gsl_eigen_symmv_sort (eval, evec, GSL_EIGEN_SORT_ABS_DESC);
gsl_vector_memcpy(v, eval);
}
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-12-19 13:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-19 13:20 Eigen value problem Varghese John
2001-12-19 13:20 ` Brian Gough
-- strict thread matches above, loose matches on Subject: below --
2001-12-19 13:20 Varghese John
2001-12-19 13:20 Jim Love
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).