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]

complex matrices


Your manual covers none of the functions usable for complex matrices. 
Either how one sets their values or performs various operations on
them.  There is a hint of a function for performing LU decomposition on
such a matrix in the linear algebra chapter, but there is nothing more. 
Some help would be great.  Here is a bit of code that returns a
segmentation fault.  Perhaps you can explain what is wrong

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<gsl/gsl_rng.h>
#include<gsl/gsl_matrix_complex_double.h>

int main(void)
{
  const gsl_rng_type *T;
  gsl_rng *r;
  gsl_matrix_complex *m;
  gsl_complex x;
  int i, j;
  double u;

  gsl_matrix_complex_alloc(4,4);

  gsl_rng_env_setup();
  T = gsl_rng_default;
  r = gsl_rng_alloc(T);

  for(i=0; i<4; i++) {
    for(j=0; j<4; j++) {
      u = gsl_rng_uniform(r);
      printf("%.5f\n", u);
      x.dat[0] = u;
      u = gsl_rng_uniform(r);
      printf("%.5f\n", u);
      x.dat[1] = u;
      gsl_matrix_complex_set(m, i, j, x);
    }
  }

  gsl_rng_free(r);

  return 1;
}



Thank you for your time,
Travis


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