Example #1
0
/////////////////////////////////////////////////////////////////////////////
// Set to mA multiplied by the transpose of mB
/////////////////////////////////////////////////////////////////////////////
void CMatrix::SetProductByTranspose(const CMatrix &mA, const CMatrix &mB)
{
    FATAL(mA.GetColumns() != mB.GetColumns());
    SetSize(mA.GetRows(), mB.GetRows());
    for (int i = mA.GetRows(); --i >= 0;)
        for (int j = mB.GetRows(); --j >= 0;)
        {
            double x = 0.0;
            for (int k = mA.GetColumns(); --k >= 0;)
                x += mA.GetElement(i, k) * mB.GetElement(j, k);
            SetElement(i, j, x);
        }
}