Hmm, compiles fine for me. not sure what's up, particularly given that
the first example compiles. Check for typos? Version of gsl?
compile flags? I've attached my copy-pasted code, I think this is the
example you are talking about.
-Carl
On Sun, Jan 17, 2010 at 12:25 PM, Chris Gast <[email protected]> wrote:
> Hello,
>
> I am having trouble computing eigenvalues of nonsymmetric matrices. I'm
> using Code::Blocks 8.02, with the GCC compiler.
>
> When compiling my own project, I get the same error as when I try to compile
> the second example at this location:
> http://www.gnu.org/software/gsl/manual/html_node/Eigenvalue-and-Eigenvector-Examples.html
>
> (The Vandermonde matrix)
>
> Upon compilation I get an error telling me that
> "gsl_eigen_nonsymmv_workspace was not declared in this scope". I have gone
> through the gsl_eigen.h file, and I can see that the struct exists for
> gsl_eigen_nonsymmv_workspace, just as it does for gsl_symmv_workspace. (The
> first example on that same page compiles and runs successfully.)
>
> Has anyone run into this problem before? Know how to fix it? Thanks for
> your help.
>
> Chris Gast
>
>
>
>
> -----------------------------
> Chris Gast
> _______________________________________________
> Help-gsl mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/help-gsl
>
--
Carl Boettiger
Population Biology, UC Davis
http://two.ucdavis.edu/~cboettig
#include <stdio.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_eigen.h>
int
main (void)
{
double data[] = { -1.0, 1.0, -1.0, 1.0,
-8.0, 4.0, -2.0, 1.0,
27.0, 9.0, 3.0, 1.0,
64.0, 16.0, 4.0, 1.0 };
gsl_matrix_view m
= gsl_matrix_view_array (data, 4, 4);
gsl_vector_complex *eval = gsl_vector_complex_alloc (4);
gsl_matrix_complex *evec = gsl_matrix_complex_alloc (4, 4);
gsl_eigen_nonsymmv_workspace * w =
gsl_eigen_nonsymmv_alloc (4);
gsl_eigen_nonsymmv (&m.matrix, eval, evec, w);
gsl_eigen_nonsymmv_free (w);
gsl_eigen_nonsymmv_sort (eval, evec,
GSL_EIGEN_SORT_ABS_DESC);
{
int i, j;
for (i = 0; i < 4; i++)
{
gsl_complex eval_i
= gsl_vector_complex_get (eval, i);
gsl_vector_complex_view evec_i
= gsl_matrix_complex_column (evec, i);
printf ("eigenvalue = %g + %gi\n",
GSL_REAL(eval_i), GSL_IMAG(eval_i));
printf ("eigenvector = \n");
for (j = 0; j < 4; ++j)
{
gsl_complex z =
gsl_vector_complex_get(&evec_i.vector, j);
printf("%g + %gi\n", GSL_REAL(z), GSL_IMAG(z));
}
}
}
gsl_vector_complex_free(eval);
gsl_matrix_complex_free(evec);
return 0;
}
_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl