main/sc/source/core/tool/interpr5.cxx
/* Solve for X in R' * X= T using forward substitution. The solution X
 * overwrites T. Uses R from the result of the QR decomposition of a NxK
 * matrix A. T is a column vectors given as matrix, with at least elements on
 * index 0 to K-1; elements on index>=K are ignored. Vector R must not have
 * zero elements, no check is done.
 */
Solve for X in R' * X= T using forward substitution. The solution X
overwrites T. Uses R from the result of the QR decomposition of a NxK
matrix A. T is a column vectors given as matrix, with at least elements on
index 0 to K-1; elements on index>=K are ignored. Vector R must not have
zero elements, no check is done.
Solve for X in R ' * X = T using forward substitution . The solution X overwrites T . Uses R from the result of the QR decomposition of a NxK matrix A . T is a column vectors given as matrix with at least elements on index 0 to K - 1 ; elements on index > = K are ignored . Vector R must not have zero elements no check is done .
void lcl_SolveWithLowerLeftTriangle(ScMatrixRef pMatA,
                    ::std::vector< double>& pVecR, ScMatrixRef pMatT,
                    SCSIZE nK, bool bIsTransposed)
{
    double fSum;
    for (SCSIZE row = 0; row < nK; row++)
    {
        fSum = pMatT -> GetDouble(row);
        for (SCSIZE col=0; col < row; col++)
        {
            if (bIsTransposed)
                fSum -= pMatA->GetDouble(col,row) * pMatT->GetDouble(col);
            else
                fSum -= pMatA->GetDouble(row,col) * pMatT->GetDouble(col);
        }
        pMatT->PutDouble( fSum / pVecR[row] , row);
    }
}
void lcl_SolveWithLowerLeftTriangle ( ScMatrixRef pMatA , :: std :: vector < double > & pVecR , ScMatrixRef pMatT , SCSIZE nK , bool bIsTransposed ) { double fSum ; for ( SCSIZE row = 0 ; row < nK ; row ++ ) { fSum = pMatT -> GetDouble ( row ) ; for ( SCSIZE col = 0 ; col < row ; col ++ ) { if ( bIsTransposed ) fSum -= pMatA -> GetDouble ( col , row ) * pMatT -> GetDouble ( col ) ; else fSum -= pMatA -> GetDouble ( row , col ) * pMatT -> GetDouble ( col ) ; } pMatT -> PutDouble ( fSum / pVecR [ row ] , row ) ; } }
Solve for X in R' * X= T using forward substitution.
Solve for X in R ' * X = T using forward substitution .
// ScMatrix matrices are zero based, index access (column,row)