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
  http://www.openoffice.org/issues/show_bug.cgi?id=115189
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.)

(A)
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?

(B)
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.

(C)
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?

(D)
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?

(E)
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?

(F)
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?

(G)
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
Regina


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