Subject: | Math::MatrixReal->new_from_cols fails when $deriv->value is undef |
It seems that $deriv->value will return an undef when the partial
derivative is infinite. When this gets passed into
Math::MatrixReal->new_from_cols, death occurs.
The following parabola fit should demonstrate:
perl -MAlgorithm::CurveFit -e "print
Algorithm::CurveFit->curve_fit(params=>[['A',-5,'0.05'],['x_0',2,'0.02'],['y_0',20,'0.2']],
variable=>'x', formula=>'A*(x-x_0)^2+y_0', xdata=>[0,'
0.66','1.33',2,'2.66','3.33',4,'4.66','5.33',6],
ydata=>[0,'6.66','13.33',20,'13.33','6.66',0,'-20','-40',-60])"
Math::MatrixReal::new_from_string(): syntax error in input stringString is
[ ]
[ 6.6 ]
[ 13.3 ]
[ 20 ]
[ 26.6 ]
[ 33.3 ]
[ 40 ]
---
at /usr/lib/perl5/site_perl/5.8.8/Algorithm/CurveFit.pm line 158
I "fixed" this locally by substituting 1e100 for undef when
$deriv->value returns undef. This is clearly not correct in edge cases...