public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* gsl_multifit_linear fails in a certain case
@ 2007-11-20  6:07 Patrick Alken
  2007-11-20 20:50 ` Brian Gough
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Alken @ 2007-11-20  6:07 UTC (permalink / raw)
  To: gsl-discuss

This post is a continuation of a discussion on help-gsl. Basically
gsl_multifit_linear will fail if the following 2 conditions are met:

(1) the matrix X has no inverse (ie: it has a singular value of 0 in its
SVD decomp)

and

(2) the RHS of the fit is a zero vector

In this case, we are solving the equation X c = 0 and X has no inverse,
but gsl_multifit_linear still tries to compute the psuedo-inverse
and fudges the zero singular value to force it to make an inverse.
The result returned by the routine is c = 0 which is not the desired
solution.

A possible fix would be to check for a singular value of zero and if
one is found, check to see if the RHS vector is 0. If it is, then
don't try to compute S^{-1} but instead compute the null space of
X which is the corresponding column of the matrix V.

I'm not really sure what to do if there is more than one zero singular
value.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gsl_multifit_linear fails in a certain case
  2007-11-20  6:07 gsl_multifit_linear fails in a certain case Patrick Alken
@ 2007-11-20 20:50 ` Brian Gough
  2007-11-20 21:41   ` Patrick Alken
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Gough @ 2007-11-20 20:50 UTC (permalink / raw)
  To: gsl-discuss

At Mon, 19 Nov 2007 23:07:32 -0700,
Patrick Alken wrote:
> 
> This post is a continuation of a discussion on help-gsl. Basically
> gsl_multifit_linear will fail if the following 2 conditions are met:
> 
> (1) the matrix X has no inverse (ie: it has a singular value of 0 in its
> SVD decomp)
> 
> and
> 
> (2) the RHS of the fit is a zero vector
> 
> In this case, we are solving the equation X c = 0 and X has no inverse,
> but gsl_multifit_linear still tries to compute the psuedo-inverse
> and fudges the zero singular value to force it to make an inverse.
> The result returned by the routine is c = 0 which is not the desired
> solution.
> 
> A possible fix would be to check for a singular value of zero and if
> one is found, check to see if the RHS vector is 0. If it is, then
> don't try to compute S^{-1} but instead compute the null space of
> X which is the corresponding column of the matrix V.
> 
> I'm not really sure what to do if there is more than one zero singular
> value.
> 

Perhaps the manual needs to be clearer about what is computed, which
is the unique least squares solution that has minimum norm solution
coefficients |c|^2 (this only comes into play if there's a null space
- otherwise there's only one solution anyway).  The idea is to
minimise any spurious components of the solution.  This is usually
what is needed when fitting data and pretty standard.

When the rhs=0 and there is one singular value there is still an
infinite number of solutions, as the overall scale is
undetermined. The least squares choice is to return the minimum norm
solution, i.e. zero. 

In the help-gsl question, which was about fitting the equation for a
plane, the appropriate method is orthogonal regression rather than
linear regression, as there's no dependent variable. 
  
-- 
Brian Gough

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gsl_multifit_linear fails in a certain case
  2007-11-20 20:50 ` Brian Gough
@ 2007-11-20 21:41   ` Patrick Alken
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick Alken @ 2007-11-20 21:41 UTC (permalink / raw)
  To: gsl-discuss

> Perhaps the manual needs to be clearer about what is computed, which
> is the unique least squares solution that has minimum norm solution
> coefficients |c|^2 (this only comes into play if there's a null space
> - otherwise there's only one solution anyway).  The idea is to
> minimise any spurious components of the solution.  This is usually
> what is needed when fitting data and pretty standard.
> 
> When the rhs=0 and there is one singular value there is still an
> infinite number of solutions, as the overall scale is
> undetermined. The least squares choice is to return the minimum norm
> solution, i.e. zero. 
> 
> In the help-gsl question, which was about fitting the equation for a
> plane, the appropriate method is orthogonal regression rather than
> linear regression, as there's no dependent variable. 


Yes, after thinking about the problem some more I realized its a bit
more complicated than I originally thought. 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-20 21:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-20  6:07 gsl_multifit_linear fails in a certain case Patrick Alken
2007-11-20 20:50 ` Brian Gough
2007-11-20 21:41   ` Patrick Alken

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).