bugGNU Scientific Library - Bugs: bug #21837, gsl_linalg_solve_symm_tridiag...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #21837: gsl_linalg_solve_symm_tridiag requires positive definite matrix

Submitter:  -Deleted Account- <bjg>
Submitted:  Tue 18 Dec 2007 06:52:57 PM UTC
   
 
Category:  Runtime error Severity:  2 - Minor
Operating System:  Status:  Confirmed
Assigned to:  None Open/Closed:  Open
Release:  1.10

Tue 18 Dec 2007 06:52:57 PM UTC, original submission:  

A zero on the diagonal will cause NaNs even though a reasonable
solution could be computed in principle.

#include <gsl/gsl_linalg.h>

int main (void)
{
  double d[] = { 0.00, 1.21, 0.80, 1.55, 0.76 } ;
  double e[] = { 0.82, 0.39, 0.09, 0.68 } ;
  double b[] = { 0.07, 0.62, 0.81, 0.11, 0.65} ;
  double x[] = { 0.00, 0.00, 0.00, 0.00, 0.00} ;

  gsl_vector_view dv = gsl_vector_view_array(d, 5);
  gsl_vector_view ev = gsl_vector_view_array(e, 4);
  gsl_vector_view bv = gsl_vector_view_array(b, 5);
  gsl_vector_view xv = gsl_vector_view_array(x, 5);

  gsl_linalg_solve_symm_tridiag(&dv.vector, &ev.vector, &bv.vector, &xv.vector);
  gsl_vector_fprintf(stdout, &xv.vector, "% .5f");

  d[0] += 1e-5;
  gsl_linalg_solve_symm_tridiag(&dv.vector, &ev.vector, &bv.vector, &xv.vector);
  gsl_vector_fprintf(stdout, &xv.vector, "% .5f");
}

$ ./a.out
 nan
 nan
 nan
 nan
 nan
 0.13626
 0.08536
 1.03840
-0.60009
 1.39219

AUG 2007: We now return an error code for this case.  To return a solution
we would need to do a permutation, see slatec/dgtsl.f

-Deleted Account- <bjg>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Follow 2 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2008-02-10 bjg Severity3 - Normal 2 - Minor
    StatusNone Confirmed

Back to the top

Powered by Savane 3.13-f8d8.
Corresponding source code