void MultiVectorMatrix::AddRightMultMatrix(Number a, const MultiVectorMatrix& U, const Matrix& C, Number b) { DBG_ASSERT(NRows()==U.NRows()); DBG_ASSERT(U.NCols()==C.NRows()); DBG_ASSERT(NCols()==C.NCols()); if (b==0.) { FillWithNewVectors(); } // ToDo: For now, we simply use MatrixVector multiplications, but // we might be more efficient (at least in the non-parallel case) // if we used Level 3 Blas SmartPtr<const DenseVectorSpace> mydspace = new DenseVectorSpace(C.NRows()); SmartPtr<DenseVector> mydvec = mydspace->MakeNewDenseVector(); const DenseGenMatrix* dgm_C = static_cast<const DenseGenMatrix*>(&C); DBG_ASSERT(dynamic_cast<const DenseGenMatrix*>(&C)); for (Index i=0; i<NCols(); i++) { const Number* CValues = dgm_C->Values(); Number* myvalues = mydvec->Values(); for (Index j=0; j<U.NCols(); j++) { myvalues[j] = CValues[i*C.NRows() + j]; } U.MultVector(a, *mydvec, b, *Vec(i)); } ObjectChanged(); }
void MultiVectorMatrix::AddOneMultiVectorMatrix(Number a, const MultiVectorMatrix& mv1, Number c) { DBG_ASSERT(NRows()==mv1.NRows()); DBG_ASSERT(NCols()==mv1.NCols()); if (c==0.) { FillWithNewVectors(); } for (Index i=0; i<NCols(); i++) { Vec(i)->AddOneVector(a, *mv1.GetVector(i), c); } ObjectChanged(); }