// Set the MultiVector equal to another MultiVector void set(const MV &A) { // TEUCHOS_TEST_FOR_EXCEPTION( this->dimensionMismatch(A), // std::invalid_argument, // "Error: MultiVectors must have the same dimensions."); for(int i=0;i<numVectors_;++i) { mvec_[i]->set(*(A.getVector(i))); } }
// Compute dot products of pairs of vectors void dots(const MV &A, std::vector<Real> &b) const { TEUCHOS_TEST_FOR_EXCEPTION( this->dimensionMismatch(A), std::invalid_argument, "Error: MultiVectors must have the same dimensions."); for(int i=0;i<numVectors_;++i) { b[i] = mvec_[i]->dot(*A.getVector(i)); } }
// Compute \f$\alpha A^\top \text{this}\f$ void innerProducts(const Real alpha, const MV &A, Teuchos::SerialDenseMatrix<int,Real> &B) const { // TEUCHOS_TEST_FOR_EXCEPTION( this->dimensionMismatch(A), // std::invalid_argument, // "Error: MultiVectors must have the same dimensions."); for(int i=0;i<A.getNumberOfVectors();++i) { for(int j=0;j<numVectors_;++j) { B(i,j) = alpha*mvec_[j]->dot(*A.getVector(i)); } } }
// Generic BLAS level 3 matrix multiplication // \f$\text{this}\leftarrow \alpha A B+\beta\text{this}\f$ void gemm(const Real alpha, const MV& A, const Teuchos::SerialDenseMatrix<int,Real> &B, const Real beta) { // Scale this by beta this->scale(beta); for(int i=0;i<B.numRows();++i) { for(int j=0;j<B.numCols();++j) { mvec_[j]->axpy(alpha*B(i,j),*A.getVector(i)); } } }
// Set some of the vectors in this MultiVector equal to corresponding // vectors in another MultiVector void set(const MV &A, const std::vector<int> &index) { // TEUCHOS_TEST_FOR_EXCEPTION( this->dimensionMismatch(A), // std::invalid_argument, // "Error: MultiVectors must have the same dimensions."); int n = index.size(); for(int i=0;i<n;++i) { int k = index[i]; if(k<numVectors_ && i<A.getNumberOfVectors()) { mvec_[k]->set(*A.getVector(i)); } } }
void axpy(const Real alpha, const MV& x) { for(int i=0;i<numVectors_;++i) { mvec_[i]->axpy(alpha,*(x.getVector(i))); } }