This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GSL-1.2 gsl_eigen_symmv() Problem


On Thu, Nov 07, 2002 at 05:06:04PM +0000, Adam Johansen wrote:
> #include <stdio.h>
> 
> #include <gsl/gsl_eigen.h>
> #include <gsl/gsl_matrix.h>
> #include <gsl/gsl_vector.h>
> 
> int main(int argc, char** argv) {
>   double hmmm;
>   gsl_eigen_symmv_workspace* wsp;
>   gsl_matrix* in, *out;
>   gsl_vector* vec;
> 
>   in = gsl_matrix_alloc(2,2);
>   out = gsl_matrix_alloc(2,2);
>   vec = gsl_vector_alloc(2);
>   int i;
> 
>   int mi = 0;
> 
>   for(i = 1; i < 101; i++) { 
>      hmmm = log(1.2);
>      
>      for(mi = 0; mi < 6; mi++) {
> 	wsp = gsl_eigen_symmv_alloc(2);
>        
> 	gsl_matrix_set(in, 0, 0, i);
> 	gsl_matrix_set(in, 0, 1, i - 1);
> 	gsl_matrix_set(in, 1, 0, i - 1);
> 	gsl_matrix_set(in, 1, 1, i - 0.5);
> 	
> 	printf("Solving matrix %i in iteration %i...\n", mi, i);
> 	gsl_eigen_symmv(in, vec, out, wsp);
> 	
> 	gsl_eigen_symmv_free(wsp);
>      }
>   }
> }
himm, shouldn't you include math.h? since log does not return int this might
cause a problem. BTW, your code doesn't compile with a C compiler, you might
want to move those int statements a few lines earlier.

ato


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]