// 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)); } } }
// 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)); } } }
virtual bool dimensionMismatch(const MV &A) const { bool equalWidth = ( A.getNumberOfVectors() != numVectors_ ); bool equalLength = ( A.getLength() != length_ ); return ( equalWidth | equalLength ); }