help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] help with QR decomposition


From: matt hall
Subject: [Help-gsl] help with QR decomposition
Date: Wed, 23 Feb 2005 17:20:30 +0000 (GMT)

hi,

i have recently installed gsl and am currently using it to solve linear
systems using QR decomposition problems.

currently i am using:
 // construct a matrix view object for GSL of the matrix to solve
  gsl_matrix_view M = gsl_matrix_view_array(A, n, m);

  // construct a vector view object of the y values
  gsl_vector_view b = gsl_vector_view_array(b, N);

  // storage space vector for the diagonal values used in QR decomp
  gsl_vector *tau = gsl_vector_alloc((MIN(n, m)));

  // allocate a return vector
  gsl_vector *x = gsl_vector_alloc(m);

  // perform QR decomposition of the matrix
  gsl_linalg_QR_decomp(&M.matrix, tau);

  // solve the system by back substitution
  gsl_linalg_QR_solve(&M.matrix, tau, &b.vector, x);



where n(=N),m are the dimensions of the matrix M and b is a vector of  rhs
values. this works perfectly well when n==m (square matrix), but as soon
as i try to solve a system with a non-square matrix i receive the
following output:

gsl: qr.c:114: ERROR: QR matrix must be square
Default GSL error handler invoked.
Abort (core dumped)


i am sure i am making some stupid error but cannot work out what it is!


thanks very much,


matt.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]