bug-gsl
[Top][All Lists]
Advanced

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

[Bug-gsl] bug in gsl_linalg_QRPT_decomp2 ?


From: Mario Pernici
Subject: [Bug-gsl] bug in gsl_linalg_QRPT_decomp2 ?
Date: Fri, 25 Apr 2003 18:51:29 +0200 (CEST)

gsl version: 1.3
Red Hat 7.3
gcc version 2.96

Dear Sirs,
 from the documentation I understand that
 the norms of each column of R are stored in the vector norm.
 However from the following example it seems that in the vector norm
 are stored the absolute values of the diagonal elements of R.
 Best Regards
  Mario Pernici
 ===========================
#include <stdio.h>
#include <gsl/gsl_linalg.h>
int main() {
  double a_data[] = {1,2,3, 1,5,6, 1,8,9, 1,11,12};
  gsl_matrix_view m = gsl_matrix_view_array(a_data, 4, 3);
  gsl_matrix *q, *r;
  gsl_vector *tau, *norm;
  int signum, i,j;
  gsl_permutation * p = gsl_permutation_alloc (3);
  q = gsl_matrix_alloc(4,4);
  r = gsl_matrix_alloc(4,3);
  tau = gsl_vector_alloc(3);
  norm = gsl_vector_alloc(3);
 gsl_linalg_QRPT_decomp2(&m.matrix, q, r, tau, p, &signum, norm);

  for(i=0; i < 3; i++) {
    printf("%lf\t", gsl_vector_get(norm, i));
  }
  puts("\n");
 for(i=0; i < 4; i++) {
   for(j=0; j <3; j++) {
     printf("%lf \t", gsl_matrix_get(r,i,j));
   }
   printf("\n");
 }
}
================================
Output:
16.431677       0.816497        0.000000

-16.431677      -1.825742       -14.605935
0.000000        -0.816497       0.816497
0.000000        0.000000        0.000000
0.000000        0.000000        0.000000








reply via email to

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