common helper function for linest, logest, and logreg



Hi,

In /plugins/fn-stat/functions.c the functions `gnumeric_logest ()' and
`gnumeric_logreg ()' are both derived from `gnumeric_linest ()',
because they perform a transformation of data and otherwise work the
same way as `gnumeric_linest ()'. Similar functions could be added in
the future.

The code of both functions is rather long and shares everything with
`gnumeric_linest ()' except the regression function which is
called. It also shares an unsolved problem with reading in arrays.

I thought that code should be reorganised to make maintenance and
adding similar functions more convenient. The attached patch against
current CVS takes the code of `gnumeric_linest ()', without changing
anything but variable names and address operators of `result', for a
helper function `multidim_linear_regression ()' which is now called by
all three functions, making their code very short. The unsolved
problem is now in the helper function.

The original source comments of the above functions, including the
helper function, are unchanged, except that I made a comment in
`gnumeric_logest ()' that I have left out a /* Still wrong! */ at a
certain place that I do not understand.

A small testsheet.gnumeric is also attached.

N.B. I took the opportunity to change some boolean values from 0 and 1
to `FALSE' and `TRUE' in my `logarithmic_fit ()' in src/regression.c.

Olaf

Attachment: gnumeric-multidim-reg.diff
Description: Text document

Attachment: testsheet.gnumeric
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]