Questions about LINEST implementation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Questions about LINEST implementation

Regina Henschel
Hi all,

I have written issue
for to attach the first draft of my implementation for LINEST. But there
are still a lot of questions. So please have a look at that draft.
(Checkmatrix has not essentially changed, but you need this version with
correct n and m, if you will test my solution.)

The algorithm for nCase==2 and nCase==3 are nearly equal besides the
fact, that the matrices of X and Y values are transposed. How should I
handle this?
(1) Write all functions in two variants? Then the functions are small
and have only one purpose, but the code becomes very long.
(2) Introduce a switch between both cases on every place needed. Then
the code will become shorter, but the functions become more complex and
during execution the very same case distinction is made a lot of times.
(3) Transpose the matrices X and Y and then use only one case. That will
give short and good maintainable code. But you need double place in
memory. How large are those matrices in reality? Is double place in
memory possible?

The functions TREND and GROWTH are calculated with the same mathematical
solution. Shall I change them in the same way? Then the methods
"calculate2" and "calculate3" would be obsolete.

Currently all helper functions are defined as local function and not as
methods of ScInterpreter. Do you like to see any of this local functions
to become a ScInterpreter method? In the actual implementation the
helper functions are all ScInterpreter methods. Why?

What kind of boolean type shall I use? I have now used "bool" locally.
But for example in "void ScInterpreter::CalulateRGPRKP(BOOL _bRKP)" a
change to "bool_bRKP" would change the declaration. I would have to
change it in interpr.hxx too. Does that harm?

Often it has to be tested, whether a matrix was created properly by
calling GetNewMat or when pop from stack. Shall I use "if(pMatrix)" or
"if(pMatrix.Is())"? Shall I use "errStackOverflow", if GetNewMat does
not create the matrix?

QR-decomposition with Householder transformation is a common
mathematical method. But it might be necessary to explain the concrete
implementation. Please have a look. Shall I omit such comments and
attach a separate, commented version to the issue or even write a full text?

My implementation of LINEST uses X-MeansX and Y-MeanY instead of adding
a column with 1 to the X values, which you will find in the description
in the ODF spec. Does this need a separate documentation?

Kind regards

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]