Xpetra  Version of the Day
Xpetra_BlockedVector_def.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Xpetra: A linear algebra interface package
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Tobias Wiesner (tawiesn@sandia.gov)
42 // Ray Tuminaro (rstumin@sandia.gov)
43 //
44 // ***********************************************************************
45 //
46 // @HEADER
47 #ifndef XPETRA_BLOCKEDVECTOR_DEF_HPP
48 #define XPETRA_BLOCKEDVECTOR_DEF_HPP
49 
51 
52 #include "Xpetra_BlockedMultiVector.hpp"
53 #include "Xpetra_Exceptions.hpp"
54 
55 
56 
57 namespace Xpetra {
58 
59 
60 
61 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
64  : Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(map, 1, zeroOut)
65 { }
66 
67 
68 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
72  : Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(bmap, v)
73 { }
74 
75 
76 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
80  : Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(mapExtractor, v)
81 { }
82 
83 
84 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
87 { }
88 
89 
90 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
94 {
95  assign(rhs); // dispatch to protected virtual method
96  return *this;
97 }
98 
99 
100 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
101 void
103 replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar& value)
104 {
105  BlockedMultiVector::replaceGlobalValue(globalRow, vectorIndex, value);
106 }
107 
108 
109 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
110 void
112 sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar& value)
113 {
114  BlockedMultiVector::sumIntoGlobalValue(globalRow, vectorIndex, value);
115 }
116 
117 
118 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
119 void
121 replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar& value)
122 {
123  BlockedMultiVector::replaceLocalValue(myRow, vectorIndex, value);
124 }
125 
126 
127 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
128 void
130 sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar& value)
131 {
132  BlockedMultiVector::sumIntoLocalValue(myRow, vectorIndex, value);
133 }
134 
135 
136 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
137 void
139 replaceGlobalValue(GlobalOrdinal globalRow, const Scalar& value)
140 {
141  BlockedMultiVector::replaceGlobalValue(globalRow, 0, value);
142 }
143 
144 
145 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
146 void
148 sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar& value)
149 {
150  BlockedMultiVector::sumIntoGlobalValue(globalRow, 0, value);
151 }
152 
153 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
154 void
156 replaceLocalValue(LocalOrdinal myRow, const Scalar& value)
157 {
158  BlockedMultiVector::replaceLocalValue(myRow, 0, value);
159 }
160 
161 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
162 void
164 sumIntoLocalValue(LocalOrdinal myRow, const Scalar& value)
165 {
166  BlockedMultiVector::sumIntoLocalValue(myRow, 0, value);
167 }
168 
169 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
170 void
172 putScalar(const Scalar& value)
173 {
175 }
176 
177 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
180 getVector(size_t j) const
181 {
183 }
184 
185 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
188 getVectorNonConst(size_t j)
189 {
191 }
192 
193 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
196 getData(size_t j) const
197 {
198  return BlockedMultiVector::getData(j);
199 }
200 
201 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
204 getDataNonConst(size_t j)
205 {
207 }
208 
209 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
210 void
212 dot(const MultiVector& A, const Teuchos::ArrayView<Scalar>& dots) const
213 {
214  BlockedMultiVector::dot(A, dots);
215  return;
216 }
217 
218 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
219 Scalar
222 {
224  BlockedMultiVector::dot(A, dots);
225  return dots[ 0 ];
226 }
227 
228 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
229 void
232 {
234  return;
235 }
236 
237 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
238 void
241 {
243  return;
244 }
245 
246 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
247 void
249 scale(const Scalar& alpha)
250 {
252  return;
253 }
254 
255 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
256 void
259 {
261  return;
262 }
263 
264 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
265 void
267 update(const Scalar& alpha,
269  const Scalar& beta)
270 {
271  BlockedMultiVector::update(alpha, A, beta);
272  return;
273 }
274 
275 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
276 void
278 update(const Scalar& alpha,
280  const Scalar& beta,
282  const Scalar& gamma)
283 {
284  BlockedMultiVector::update(alpha, A, beta, B, gamma);
285  return;
286 }
287 
288 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
291 norm1() const
292 {
294  Array norm = Array(1);
295  this->norm1(norm);
296  return norm[ 0 ];
297 }
298 
299 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
302 norm2() const
303 {
306  this->norm2(norm);
307  return norm[ 0 ];
308 }
309 
310 
311 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
314 normInf() const
315 {
318  this->normInf(norm);
319  return norm[ 0 ];
320 }
321 
322 
323 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
324 void
327 {
329 }
330 
331 
332 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
333 void
336 {
338 }
339 
340 
341 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
342 void
345 {
347 }
348 
349 
350 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
351 void
353 meanValue(const Teuchos::ArrayView<Scalar>& /* means */) const
354 {
355  throw Xpetra::Exceptions::RuntimeError("BlockedVector::meanValue: Not (yet) supported by BlockedVector.");
356 }
357 
358 
359 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
360 Scalar
362 meanValue() const
363 {
364  throw Xpetra::Exceptions::RuntimeError("BlockedVector::meanValue: Not (yet) supported by BlockedVector.");
365 }
366 
367 
368 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
369 void
371 multiply(Teuchos::ETransp /* transA */,
372  Teuchos::ETransp /* transB */,
373  const Scalar& /* alpha */,
376  const Scalar& /* beta */)
377 {
378  throw Xpetra::Exceptions::RuntimeError("BlockedVector::multiply: Not (yet) supported by BlockedVector.");
379 }
380 
381 
382 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
383 void
385 multiply(Teuchos::ETransp /* transA */,
386  Teuchos::ETransp /* transB */,
387  const Scalar& /* alpha */,
390  const Scalar& /* beta */)
391 {
392  throw Xpetra::Exceptions::RuntimeError("BlockedVector::multiply: Not (yet) supported by BlockedVector.");
393 }
394 
395 
396 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
397 void
399 elementWiseMultiply( Scalar /* scalarAB */,
402  Scalar /* scalarThis */)
403 {
404  throw Xpetra::Exceptions::RuntimeError("BlockedVector::elementWiseMultiply: Not (yet) supported by BlockedVector.");
405 }
406 
407 
408 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
409 void
411 elementWiseMultiply( Scalar /* scalarAB */,
414  Scalar /* scalarThis */)
415 {
416  XPETRA_TEST_FOR_EXCEPTION(B.getMap()->isSameAs(*(this->getMap())) == false,
418  "BlockedVector::elementWiseMultipy: B must have same blocked map than this.");
419  TEUCHOS_TEST_FOR_EXCEPTION(A.getMap()->getNodeNumElements() != B.getMap()->getNodeNumElements(),
421  "BlockedVector::elementWiseMultipy: A has "
422  << A.getMap()->getNodeNumElements() << " elements, B has " << B.getMap()->getNodeNumElements()
423  << ".");
424  TEUCHOS_TEST_FOR_EXCEPTION(A.getMap()->getGlobalNumElements() != B.getMap()->getGlobalNumElements(),
426  "BlockedVector::elementWiseMultipy: A has " << A.getMap()->getGlobalNumElements()
427  << " elements, B has "
428  << B.getMap()->getGlobalNumElements() << ".");
429 
430  RCP<const BlockedMap> bmap = this->getBlockedMap();
433  RCP<const BlockedVector> bbmvec = Teuchos::rcp_dynamic_cast<const BlockedVector>(bmvec);
434  TEUCHOS_TEST_FOR_EXCEPTION(bbmvec.is_null() == true,
436  "BlockedVector::elementWiseMultipy: B must be a BlockedVector.");
437 
438  // TODO implement me
439  /*RCP<Xpetra::MapExtractor<Scalar,LocalOrdinal,GlobalOrdinal,Node> > me = Teuchos::rcp(new
440  Xpetra::MapExtractor<Scalar,LocalOrdinal,GlobalOrdinal,Node>(bmap));
441 
442  for(size_t m = 0; m < bmap->getNumMaps(); m++) {
443  // TODO introduce BlockedVector objects and "skip" this expensive ExtractVector call
444  RCP<const Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > pd = me->ExtractVector(rcpA,m,bmap->getThyraMode());
445  XPETRA_TEST_FOR_EXCEPTION(pd->getMap()->isSameAs(*(this->getBlockedMap()->getMap(m,bmap->getThyraMode())))==false,
446  Xpetra::Exceptions::RuntimeError, "BlockedVector::elementWiseMultipy: sub map of B does not fit with sub map of this.");
447  this->getMultiVector(m,bmap->getThyraMode())->elementWiseMultiply(scalarAB,*pd,*(bbmvec->getMultiVector(m,bmap->getThyraMode())),scalarThis);
448  }*/
449 }
450 
451 
452 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
453 size_t
455 getNumVectors() const
456 {
457  return 1;
458 }
459 
460 
461 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
462 size_t
464 getLocalLength() const
465 {
467  "BlockedVector::getLocalLength: routine not implemented. It has no value as one must iterate on the partial vectors.");
469 }
470 
471 
472 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
475 getGlobalLength() const
476 {
477  return this->getBlockedMap()->getFullMap()->getGlobalNumElements();
478 }
479 
480 
481 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
482 bool
485 {
487  "BlockedVector::isSameSize: routine not implemented. It has no value as one must iterate on the partial vectors.");
489 }
490 
491 
492 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
493 std::string
495 description() const
496 {
497  return std::string("BlockedVector");
498 }
499 
500 
501 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
502 void
504 describe(Teuchos::FancyOStream& out, const Teuchos::EVerbosityLevel verbLevel) const
505 {
506  out << description() << std::endl;
507  for(size_t r = 0; r < this->getBlockedMap()->getNumMaps(); r++)
508  {
509  getMultiVector(r)->describe(out, verbLevel);
510  }
511 }
512 
513 
514 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
515 void
517 replaceMap(const RCP<const Map>& map)
518 {
520 }
521 
522 
523 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
524 void
527  const Import& /* importer */,
528  CombineMode /* CM */)
529 {
530  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doImport: Not supported by BlockedVector.");
531 }
532 
533 
534 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
535 void
538  const Import& /* importer */,
539  CombineMode /* CM */)
540 {
541  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doExport: Not supported by BlockedVector.");
542 }
543 
544 
545 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
546 void
549  const Export& /* exporter */,
550  CombineMode /* CM */)
551 {
552  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doImport: Not supported by BlockedVector.");
553 }
554 
555 
556 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
557 void
560  const Export& /* exporter */,
561  CombineMode /* CM */)
562 {
563  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doExport: Not supported by BlockedVector.");
564 }
565 
566 
567 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
568 void
570 setSeed(unsigned int seed)
571 {
572  for(size_t r = 0; r < this->getBlockedMap()->getNumMaps(); ++r)
573  {
574  getMultiVector(r)->setSeed(seed);
575  }
576 }
577 
578 
579 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
580 void
582 randomize(bool bUseXpetraImplementation)
583 {
584  for(size_t r = 0; r < this->getBlockedMap()->getNumMaps(); ++r)
585  {
586  getMultiVector(r)->randomize(bUseXpetraImplementation);
587  }
588 }
589 
590 
591 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
592 void
595 {
596  {
598  }
599 }
600 
601  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
604  getMap() const
605  {
606  XPETRA_MONITOR("BlockedVector::getMap");
607  return this->getBlockedMap();
608  }
609 
610 
611  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
614  getMultiVector(size_t r) const
615  {
617  }
618 
619 
620  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
623  getMultiVector(size_t r, bool bThyraMode) const
624  {
625  return BlockedMultiVector::getMultiVector(r, bThyraMode);
626  }
627 
628 
629  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
630  void
632  setMultiVector(size_t r,
634  bool bThyraMode)
635  {
636  BlockedMultiVector::setMultiVector(r, v, bThyraMode);
637  return;
638  }
639 
640 
641  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
644  Merge() const
645  {
646  return BlockedMultiVector::Merge();
647  }
648 
649 
650  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
651  void
654  {
656  }
657 
658 
659  // template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
660  // virtual void BlockedVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::
661  // assign (const XpetrA::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& rhs)
662  // {
663  // throw Xpetra::Exceptions::RuntimeError("BlockedVector::assign: Not supported by BlockedVector.");
664  // }
665 
666 } // Xpetra namespace
667 
668 
669 #endif // XPETRA_BLOCKEDVECTOR_DEF_HPP
#define XPETRA_MONITOR(funcName)
#define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
bool is_null() const
virtual void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
virtual void sumIntoLocalValue(LocalOrdinal, size_t, const Scalar &)
Add value to existing value, using local (row) index.
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
Teuchos::RCP< MultiVector > getMultiVector(size_t r) const
return partial multivector associated with block row r
void setMultiVector(size_t r, Teuchos::RCP< const MultiVector > v, bool bThyraMode)
set partial multivector associated with block row r
virtual Teuchos::RCP< const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
virtual void dot(const MultiVector &, const Teuchos::ArrayView< Scalar > &) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
virtual void reciprocal(const MultiVector &)
Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,...
virtual void sumIntoGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Add value to existing value, using global (row) index.
virtual void replaceLocalValue(LocalOrdinal, size_t, const Scalar &)
Replace value, using local (row) index.
Teuchos::RCP< MultiVector > Merge() const
merge BlockedMultiVector blocks to a single MultiVector
virtual Teuchos::RCP< Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
virtual void replaceGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Replace value, using global (row) index.
virtual void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
virtual void assign(const MultiVector &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
virtual void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
virtual void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
virtual void update(const Scalar &alpha, const MultiVector &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
virtual void abs(const MultiVector &)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
virtual void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
virtual void replaceMap(const RCP< const Map > &map)
virtual void multiply(Teuchos::ETransp, Teuchos::ETransp, const Scalar &, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Scalar &)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Merge() const
merge BlockedVector blocks to a single Vector
virtual size_t getLocalLength() const
Local number of rows on the calling process.
virtual void replaceMap(const RCP< const Map > &map)
virtual std::string description() const
A simple one-line description of this object.
BlockedVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & operator=(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Assignment operator: Does a deep copy.
virtual void Xpetra_randomize()
Set vector values to random numbers. XPetra implementation.
virtual Teuchos::RCP< const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this vector.
virtual void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
Teuchos::RCP< const Map > getMap() const
Access function for the underlying Map this DistObject was constructed with.
virtual void dot(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of vector.
virtual void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
virtual Teuchos::RCP< Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
void setMultiVector(size_t r, Teuchos::RCP< const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > v, bool bThyraMode)
set partial Vector associated with block row r
virtual void reciprocal(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise reciprocal values of input vector in target, this(i,j) = 1/A(i,j).
virtual void putScalar(const Scalar &value)
Set all values in the vector with the given value.
virtual void setSeed(unsigned int seed)
Set seed for Random function.
virtual void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Export.
BlockedVector(const Teuchos::RCP< const BlockedMap > &map, bool zeroOut=true)
Constructor.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Compute 1-norm of vector.
virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
virtual void scale(const Scalar &alpha)
Scale the current values of a vector, this = alpha*this.
virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this vector.
virtual void elementWiseMultiply(Scalar, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, Scalar)
Element-wise multiply of a Vector A with a MultiVector B.
virtual size_t getNumVectors() const
Number of columns in the Vector.
virtual void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Import.
virtual Scalar meanValue() const
Compute mean (average) value of this Vector.
virtual bool isSameSize(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &) const
Local number of rows on the calling process.
virtual void update(const Scalar &alpha, const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
virtual global_size_t getGlobalLength() const
Global number of rows in the Vector.
virtual void assign(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getMultiVector(size_t r) const
return partial Vector associated with block row r
virtual ~BlockedVector()
Destructor.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm in vector.
virtual void abs(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input vector in target: A = abs(this).
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const =0
The Map describing the parallel distribution of this object.
Exception throws to report errors in the internal logical of the program.
virtual void Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
Xpetra namespace
size_t global_size_t
Global size_t object.
CombineMode
Xpetra::Combine Mode enumerable type.