source file of the GNU LilyPond music typesetter
- (c) 1996--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ (c) 1996--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
#include "least-squares.hh"
sqx += sqr (x);
sxy += x*y;
}
- int N = input.size ();
+
+ int count = input.size ();
*coef = 0.0;
*offset = 0.;
- Real den = (N * sqx - sqr (sx));
- if (!N || !den)
+ Real den = (count * sqx - sqr (sx));
+ if (!count || !den)
{
- programming_error ("minimise_least_squares (): Nothing to minimise");
+ programming_error ("minimise_least_squares (): Nothing to minimise\n"
+ "This means that vertical spacing is triggered\n"
+ "before line breaking\n");
*coef = 0.0;
- *offset = N ? sy / N : 0.0;
+ *offset = count ? sy / count : 0.0;
}
else
{
- *coef = (N *sxy - sx * sy) / den;
- *offset = (sy - (*coef) * sx) / N;
+ *coef = (count * sxy - sx * sy) / den;
+ *offset = (sy - (*coef) * sx) / count;
}
}