LinAlg SV Doc?

Kevin H. Hobbs hobbsk@ohiou.edu
Tue Feb 16 19:28:00 GMT 2010


I'm fairly new to using the linear algebra routines so this may be
obvious to everybody else but :

In gsl_linalg_SV_solve how long should b and x be?

Could an example be added for this section?

I believe the length of b must be M and the length of x must be N but I
get really confused here, mostly around :

is M the number of samples or the number of parameters (below)?

I will gladly contribute the function I am working on now as an example.

My problem of the moment is to find the best fitting plane for sets of 7
dimensional points, though 3-D will be enough to get me started.

I have a set of 9 points from f(x,y)=z, and I want to find the best
fitting plane, ax + by + c = z, though these points.

My points are :

  f(1, 1) = 2
  f(1, 2) = 2.11
  f(1, 3) = 3.21
  f(2, 1) = 3.97
  f(2, 2) = 3.76
  f(2, 3) = 4.01
  f(3, 1) = 3.40
  f(3, 2) = 5.47
  f(3, 3) = 4.35

When I put these into the equation for a plane this becomes :

  1a + 1b + 1c = 2
  1a + 2b + 1c = 2.11
  1a + 3b + 1c = 3.21
  2a + 1b + 1c = 3.97
  2a + 2b + 1c = 3.76
  2a + 3b + 1c = 4.01
  3a + 1b + 1c = 3.40
  3a + 2b + 1c = 5.47
  3a + 3b + 1c = 4.35

Then I create the matrix A and the vectors x and b for the linear system
Ax = b (I know x and b are getting confused):

      1 1 1      2.00
      1 2 1      2.11
      1 3 1      3.21
      2 1 1      3.97
  A = 2 2 1  b = 3.76  x = a b c
      2 3 1      4.01
      3 1 1      3.40
      3 2 1      5.47
      3 3 1      4.35


The output I get from the attached program is :

0.983333 0.366667 0.886667

which puts a nice plane through my points.

Do I have my Ms and Ns in the right places?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: find_interpolation_parameters.h
Type: text/x-chdr
Size: 436 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gsl-discuss/attachments/20100216/6a5cb408/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: find_interpolation_parameters_SVD.c
Type: text/x-csrc
Size: 1168 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gsl-discuss/attachments/20100216/6a5cb408/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interp_test.c
Type: text/x-csrc
Size: 584 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gsl-discuss/attachments/20100216/6a5cb408/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/gsl-discuss/attachments/20100216/6a5cb408/attachment.sig>


More information about the Gsl-discuss mailing list