bugGNU Scientific Library - Bugs: bug #42472, gsl_linalg_HH_solve bugs

 
 

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

bug #42472: gsl_linalg_HH_solve bugs

Submitter:  Patrick Alken <psa>
Submitted:  Sat 31 May 2014 02:02:04 AM UTC
   
 
Category:  Runtime error Severity:  3 - Normal
Operating System:  Status:  None
Assigned to:  None Open/Closed:  Open
Release: 

Sat 31 May 2014 02:03:34 AM UTC, comment #1: 

reported by dunlucky1 =at= gmail.com

Patrick Alken <psa>
Group administrator
Sat 31 May 2014 02:02:04 AM UTC, original submission:  

I think there is a bug in the Linear Algebra Householder solver for the
problem Ax = b.  The function gsl_linalg_HH_svx incorrectly calls an over
determined system under determined (and vice versa).  Looking in to the
code I see that the dimensions are mixed up such that the code will only
work correctly for a square matrix and not for the over determined case.

I've written a test case based on the expected output from case 4 from
here:
http://people.sc.fsu.edu/~jburkardt/f_src/qr_solve/qr_solve_prb_output.txt
that is attached.

I've also attached a patch file that will fix the problem for
gsl_linalg_HH_svx (apply with patch linalg/hh.c < gsl_linalg_hh.c.patch).

Looking at the code there is a bigger problem with the function
gsl_linalg_HH_solve which assumes that the length of the vector b and the
length of the vector x (in Ax = b) are equal, copying the data from b in to
x before passing this to the function gsl_linalg_HH_svx.  This is only true
in a square case and in the over determined case x will have less elements
than b, such that this copy can't be done.  The solution to this problem is
harder (probably allocate a working array of size M  the length of b, and
copy vector b there and then copy the first N elements out in to x ...
using standard notation of A being an M x N matrix).  Anyway, I've left
that alone.

Dave

Patrick Alken <psa>
Group administrator

 

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

Attached Files
file #31474:  gsl_hh_test.c added by psa (718B - text/x-csrc)
file #31475:  gsl_linalg_hh.c.patch added by psa (743B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psa (Submitted the item)
  •  

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-05-31 psa Attached File- Added gsl_hh_test.c, #31474
        Attached File- Added gsl_linalg_hh.c.patch, #31475

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code