bool CLinkMatrix::leftMultiply(const CMatrix< C_FLOAT64> & m, CMatrix< C_FLOAT64> & p) const { bool success = true; if (m.numRows() != numCols()) { return false; } // p := L * m = (I, L0) * m = (m, L0 * m) = (p1, p2) p.resize(mRowPivots.size(), m.numCols()); p = 0.0; // p1 := m memcpy(p.array(), m.array(), sizeof(C_FLOAT64) * m.size()); // p2 := L0 * m // p2 (numDependent x m.numCols()) char T = 'N'; C_INT M = (C_INT) m.numCols(); /* LDA, LDC */ C_INT N = (C_INT) getNumDependent(); C_INT K = (C_INT) numCols(); C_INT LDA = (C_INT) m.numCols(); C_INT LDB = (C_INT) numCols(); C_INT LDC = (C_INT) p.numCols(); C_FLOAT64 Alpha = 1.0; C_FLOAT64 Zero = 0.0; // DGEMM (TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC) // C := alpha A B + beta C dgemm_(&T, &T, &M, &N, &K, &Alpha, const_cast< C_FLOAT64 * >(m.array()), &LDA, const_cast< C_FLOAT64 * >(array()), &LDB, &Zero, p.array() + m.size(), &LDC); return success; }
C_FLOAT64 * CState::resize(const unsigned C_INT32 & size) { if (mSize != size) { C_FLOAT64 * pTmp = mpValues; if (size > 0) { mpValues = new C_FLOAT64[size]; memcpy(mpValues, pTmp, sizeof(C_FLOAT64) * std::min(mSize, size)); } else mpValues = NULL; pdeletev(pTmp); mSize = size; } updateIterator(getNumIndependent(), getNumDependent(), getNumFixed()); return mpValues; }