Shortcomings in ScInterpreter::CheckMatrix

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Shortcomings in ScInterpreter::CheckMatrix

Regina Henschel
Hi all,

CheckMatrix is used for LINEST/LOGEST and for TREND/GROWTH. It checks
whether the input matrices have correct size and content, generates the
default matrix for an empty MatX, changes Y to log(Y) in case LOGEST and
GROWTH, determines the size of the input matrices for output parameter
nCX, nCY, nRX, nRY, the number of variables for output parameter M, and
the number of observations for output parameter N. But this is not done
consistent.

In case of simple regression (nCase==1) the values M and N are not set
correctly, but the initial value 0 is returned. In case of an emtpy MatX
the values for nCX and nRX are only set in case of TREND/GROWTH.
Currently this gives no error, because the loops do not run over N, M,
nCX, or nRX but over nCY and nRY and the value for N is determined in
that loops again.

I struggle about this, because I want to use N and M in my solution for
LINEST, to test, whether there are enough observations at all.

I want to change CheckMatrix, so that N, M, nCX, nRX are set correctly
in all cases. The parameter 'BOOL _bTrendGrowth' is then no longer
needed and can be removed (otherwise it will produce a compiler warning).

Do you agree with those changes?

Kind regards
Regina

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

Reply | Threaded
Open this post in threaded view
|

Re: Shortcomings in ScInterpreter::CheckMatrix

Eike Rathke-6
Hi Regina,

On Sunday, 2010-08-29 18:33:38 +0200, Regina Henschel wrote:

> [... CheckMatrix ...]
>
> In case of simple regression (nCase==1) the values M and N are not
> set correctly, but the initial value 0 is returned. In case of an
> emtpy MatX the values for nCX and nRX are only set in case of
> TREND/GROWTH. Currently this gives no error, because the loops do
> not run over N, M, nCX, or nRX but over nCY and nRY and the value
> for N is determined in that loops again.
>
> I struggle about this, because I want to use N and M in my solution
> for LINEST, to test, whether there are enough observations at all.
>
> I want to change CheckMatrix, so that N, M, nCX, nRX are set
> correctly in all cases. The parameter 'BOOL _bTrendGrowth' is then
> no longer needed and can be removed (otherwise it will produce a
> compiler warning).
>
> Do you agree with those changes?
Yes, absolutely. I think the method as it is is a result of
a refactoring, combining code of LINEST and LOGEST as it was back then.

  Eike

--
 OOo Calc core developer. Number formatter stricken i18n transpositionizer.
 Signature key 0x87F8D412 : 2F58 5236 DB02 F335 8304  7D6C 65C9 F9B5 87F8 D412
 OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
 --
 Please don't send mail to the old [hidden email] account that I used for mailing
 lists, it phased out. Use [hidden email] instead. Thanks.

attachment0 (200 bytes) Download Attachment