Hi Eike,

Eike Rathke schrieb:
Hi Regina,

On Thursday, 2010-08-12 16:38:33 +0200, Regina Henschel wrote:

The current implementation avoids to copy the matrices X or Y,
although that would ease and shorten the code. I thought there must
be a reason for that and tried to avoid it too. I hesitate to copy X
or Y, because they might have a huge number of lines.

Indeed.

I will try only using new matrices for products like X'X as it is
done in the current implementation. That will result in a lot of
nearly identical multiplication methods, but I think, that is better
than copying the matrices.

To avoid both, having overly complicated code and copying large
matrices, we could introduce a const/non-const flag in ScMatrix,
defaulted to const and set to non-const by GetNewMat(), but to const
again when stored in ScFormulaResult. The usual case is that a matrix
was constructed from a range reference by the interpreter and not as
a const array or formula cell result. Then having
a ScMatrix::CloneIfConst() method could just return the current matrix
if non-const and would have to actually clone only in rare const cases.

Just an idea..

The problem with constant parameters is already actual :(
http://www.openoffice.org/issues/show_bug.cgi?id=113879

Enter the formula
=LOGEST({2|3|5|8|13};{2|4|6|8|10})
Set the cursor into the formula range to see the formula in the input line.
Recalculate some times.
Notice, that the values in the first parameter changes.

This is done in the method ScInterpreter::CheckMatrix in the statement
    if ( _bLOG )
    {
        for (SCSIZE nElem = 0; nElem < nCountY; nElem++)
        {
            const double fVal = pMatY->GetDouble(nElem);
            if (fVal <= 0.0)
            {
                PushIllegalArgument();
                return false;
            }
            else
                pMatY->PutDouble(log(fVal), nElem);   <---- here
        } // for (nElem = 0; nElem < nCountY; nElem++)
    } // if ( _bRKP )

Kind regards
Regina

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@sc.openoffice.org
For additional commands, e-mail: dev-h...@sc.openoffice.org

Reply via email to