All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
69 BlockedVector<Scalar, LocalOrdinal, GlobalOrdinal, 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 {
106  BlockedMultiVector::replaceGlobalValue(globalRow, vectorIndex, value);
107 }
108 
109 
110 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
111 void
113 sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar& value)
114 {
116  BlockedMultiVector::sumIntoGlobalValue(globalRow, vectorIndex, value);
117 }
118 
119 
120 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
121 void
123 replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar& value)
124 {
126  BlockedMultiVector::replaceLocalValue(myRow, vectorIndex, value);
127 }
128 
129 
130 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
131 void
133 sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar& value)
134 {
136  BlockedMultiVector::sumIntoLocalValue(myRow, vectorIndex, value);
137 }
138 
139 
140 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
141 void
143 replaceGlobalValue(GlobalOrdinal globalRow, const Scalar& value)
144 {
146  BlockedMultiVector::replaceGlobalValue(globalRow, 0, value);
147 }
148 
149 
150 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
151 void
153 sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar& value)
154 {
156  BlockedMultiVector::sumIntoGlobalValue(globalRow, 0, value);
157 }
158 
159 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
160 void
162 replaceLocalValue(LocalOrdinal myRow, const Scalar& value)
163 {
165  BlockedMultiVector::replaceLocalValue(myRow, 0, value);
166 }
167 
168 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
169 void
171 sumIntoLocalValue(LocalOrdinal myRow, const Scalar& value)
172 {
174  BlockedMultiVector::sumIntoLocalValue(myRow, 0, value);
175 }
176 
177 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
178 void
180 putScalar(const Scalar& value)
181 {
184 }
185 
186 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
189 getVector(size_t j) const
190 {
193 }
194 
195 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
199 {
202 }
203 
204 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
207 getData(size_t j) const
208 {
210  return BlockedMultiVector::getData(j);
211 }
212 
213 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
217 {
220 }
221 
222 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
223 void
225 dot(const MultiVector& A, const Teuchos::ArrayView<Scalar>& dots) const
226 {
228  BlockedMultiVector::dot(A, dots);
229  return;
230 }
231 
232 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
233 Scalar
236 {
239  BlockedMultiVector::dot(A, dots);
240  return dots[ 0 ];
241 }
242 
243 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
244 void
247 {
250  return;
251 }
252 
253 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
254 void
257 {
260  return;
261 }
262 
263 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
264 void
266 scale(const Scalar& alpha)
267 {
270  return;
271 }
272 
273 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
274 void
277 {
280  return;
281 }
282 
283 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
284 void
286 update(const Scalar& alpha,
288  const Scalar& beta)
289 {
291  BlockedMultiVector::update(alpha, A, beta);
292  return;
293 }
294 
295 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
296 void
298 update(const Scalar& alpha,
300  const Scalar& beta,
302  const Scalar& gamma)
303 {
305  BlockedMultiVector::update(alpha, A, beta, B, gamma);
306  return;
307 }
308 
309 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
312 norm1() const
313 {
315  Array norm = Array(1);
316  this->norm1(norm);
317  return norm[ 0 ];
318 }
319 
320 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
323 norm2() const
324 {
327  this->norm2(norm);
328  return norm[ 0 ];
329 }
330 
331 
332 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
335 normInf() const
336 {
339  this->normInf(norm);
340  return norm[ 0 ];
341 }
342 
343 
344 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
345 void
348 {
351 }
352 
353 
354 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
355 void
358 {
361 }
362 
363 
364 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
365 void
368 {
371 }
372 
373 
374 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
375 void
377 meanValue(const Teuchos::ArrayView<Scalar>& /* means */) const
378 {
379  throw Xpetra::Exceptions::RuntimeError("BlockedVector::meanValue: Not (yet) supported by BlockedVector.");
380 }
381 
382 
383 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
384 Scalar
386 meanValue() const
387 {
388  throw Xpetra::Exceptions::RuntimeError("BlockedVector::meanValue: Not (yet) supported by BlockedVector.");
389 }
390 
391 
392 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
393 void
396  Teuchos::ETransp /* transB */,
397  const Scalar& /* alpha */,
400  const Scalar& /* beta */)
401 {
402  throw Xpetra::Exceptions::RuntimeError("BlockedVector::multiply: Not (yet) supported by BlockedVector.");
403 }
404 
405 
406 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
407 void
410  Teuchos::ETransp /* transB */,
411  const Scalar& /* alpha */,
414  const Scalar& /* beta */)
415 {
416  throw Xpetra::Exceptions::RuntimeError("BlockedVector::multiply: Not (yet) supported by BlockedVector.");
417 }
418 
419 
420 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
421 void
423 elementWiseMultiply( Scalar /* scalarAB */,
426  Scalar /* scalarThis */)
427 {
428  throw Xpetra::Exceptions::RuntimeError("BlockedVector::elementWiseMultiply: Not (yet) supported by BlockedVector.");
429 }
430 
431 
432 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
433 void
435 elementWiseMultiply( Scalar /* scalarAB */,
438  Scalar /* scalarThis */)
439 {
440  XPETRA_TEST_FOR_EXCEPTION(B.getMap()->isSameAs(*(this->getMap())) == false,
442  "BlockedVector::elementWiseMultipy: B must have same blocked map than this.");
443  TEUCHOS_TEST_FOR_EXCEPTION(A.getMap()->getNodeNumElements() != B.getMap()->getNodeNumElements(),
445  "BlockedVector::elementWiseMultipy: A has "
446  << A.getMap()->getNodeNumElements() << " elements, B has " << B.getMap()->getNodeNumElements()
447  << ".");
448  TEUCHOS_TEST_FOR_EXCEPTION(A.getMap()->getGlobalNumElements() != B.getMap()->getGlobalNumElements(),
450  "BlockedVector::elementWiseMultipy: A has " << A.getMap()->getGlobalNumElements()
451  << " elements, B has "
452  << B.getMap()->getGlobalNumElements() << ".");
453 
454  RCP<const BlockedMap> bmap = this->getBlockedMap();
457  RCP<const BlockedVector> bbmvec = Teuchos::rcp_dynamic_cast<const BlockedVector>(bmvec);
458  TEUCHOS_TEST_FOR_EXCEPTION(bbmvec.is_null() == true,
460  "BlockedVector::elementWiseMultipy: B must be a BlockedVector.");
461 
462  // TODO implement me
463  /*RCP<Xpetra::MapExtractor<Scalar,LocalOrdinal,GlobalOrdinal,Node> > me = Teuchos::rcp(new
464  Xpetra::MapExtractor<Scalar,LocalOrdinal,GlobalOrdinal,Node>(bmap));
465 
466  for(size_t m = 0; m < bmap->getNumMaps(); m++) {
467  // TODO introduce BlockedVector objects and "skip" this expensive ExtractVector call
468  RCP<const Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > pd = me->ExtractVector(rcpA,m,bmap->getThyraMode());
469  XPETRA_TEST_FOR_EXCEPTION(pd->getMap()->isSameAs(*(this->getBlockedMap()->getMap(m,bmap->getThyraMode())))==false,
470  Xpetra::Exceptions::RuntimeError, "BlockedVector::elementWiseMultipy: sub map of B does not fit with sub map of this.");
471  this->getMultiVector(m,bmap->getThyraMode())->elementWiseMultiply(scalarAB,*pd,*(bbmvec->getMultiVector(m,bmap->getThyraMode())),scalarThis);
472  }*/
473 }
474 
475 
476 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
477 size_t
480 {
481  return 1;
482 }
483 
484 
485 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
486 size_t
489 {
491  "BlockedVector::getLocalLength: routine not implemented. It has no value as one must iterate on the partial vectors.");
493 }
494 
495 
496 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
500 {
501  return this->getBlockedMap()->getFullMap()->getGlobalNumElements();
502 }
503 
504 
505 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
506 bool
509 {
511  "BlockedVector::isSameSize: routine not implemented. It has no value as one must iterate on the partial vectors.");
513 }
514 
515 
516 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
517 std::string
519 description() const
520 {
521  return std::string("BlockedVector");
522 }
523 
524 
525 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
526 void
529 {
530  out << description() << std::endl;
531  for(size_t r = 0; r < this->getBlockedMap()->getNumMaps(); r++)
532  {
533  getMultiVector(r)->describe(out, verbLevel);
534  }
535 }
536 
537 
538 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
539 void
542 {
545 }
546 
547 
548 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
549 void
552  const Import& /* importer */,
553  CombineMode /* CM */)
554 {
555  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doImport: Not supported by BlockedVector.");
556 }
557 
558 
559 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
560 void
563  const Import& /* importer */,
564  CombineMode /* CM */)
565 {
566  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doExport: Not supported by BlockedVector.");
567 }
568 
569 
570 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
571 void
574  const Export& /* exporter */,
575  CombineMode /* CM */)
576 {
577  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doImport: Not supported by BlockedVector.");
578 }
579 
580 
581 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
582 void
585  const Export& /* exporter */,
586  CombineMode /* CM */)
587 {
588  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doExport: Not supported by BlockedVector.");
589 }
590 
591 
592 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
593 void
595 setSeed(unsigned int seed)
596 {
597  for(size_t r = 0; r < this->getBlockedMap()->getNumMaps(); ++r)
598  {
599  getMultiVector(r)->setSeed(seed);
600  }
601 }
602 
603 
604 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
605 void
607 randomize(bool bUseXpetraImplementation)
608 {
609  for(size_t r = 0; r < this->getBlockedMap()->getNumMaps(); ++r)
610  {
611  getMultiVector(r)->randomize(bUseXpetraImplementation);
612  }
613 }
614 
615 
616 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
617 void
620 {
621  {
623  }
624 }
625 
626 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
627 
628 #if 0
629  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
630  template<class TargetDeviceType>
631  typename Kokkos::Impl::if_c<Kokkos::Impl::is_same<typename dev_execution_space::memory_space,
632  typename TargetDeviceType::memory_space>::value,
633  typename dual_view_type::t_dev_um,
634  typename dual_view_type::t_host_um>::type
636  getLocalView() const
637  {
638  if(Kokkos::Impl::is_same<typename host_execution_space::memory_space, typename TargetDeviceType::memory_space>::value)
639  {
640  return getHostLocalView();
641  }
642  else
643  {
644  return getDeviceLocalView();
645  }
646  }
647 #endif
648 
649 // template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
650 // virtual typename dual_view_type::
651 // t_dev_um BlockedVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::getDeviceLocalView() const
652 // {
653 // typename dual_view_type::t_dev_um test;
654 // return test;
655 // }
656 #endif // HAVE_XPETRA_KOKKOS_REFACTOR
657 
658 
659  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
662  getMap() const
663  {
664  XPETRA_MONITOR("BlockedVector::getMap");
665  return this->getBlockedMap();
666  }
667 
668 
669  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
672  getMultiVector(size_t r) const
673  {
676  }
677 
678 
679  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
682  getMultiVector(size_t r, bool bThyraMode) const
683  {
685  return BlockedMultiVector::getMultiVector(r, bThyraMode);
686  }
687 
688 
689  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
690  void
694  bool bThyraMode)
695  {
697  BlockedMultiVector::setMultiVector(r, v, bThyraMode);
698  return;
699  }
700 
701 
702  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
705  Merge() const
706  {
708  return BlockedMultiVector::Merge();
709  }
710 
711 
712  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
713  void
716  {
719  }
720 
721 
722  // template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
723  // virtual void BlockedVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::
724  // assign (const XpetrA::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& rhs)
725  // {
726  // throw Xpetra::Exceptions::RuntimeError("BlockedVector::assign: Not supported by BlockedVector.");
727  // }
728 
729 } // Xpetra namespace
730 
731 
732 #endif // XPETRA_BLOCKEDVECTOR_DEF_HPP
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 reciprocal(const MultiVector &)
Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).
virtual Scalar meanValue() const
Compute mean (average) value of this Vector.
virtual void setSeed(unsigned int seed)
Set seed for Random function.
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).
virtual void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
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 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 void sumIntoGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Add value to existing value, using global (row) index.
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 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 void scale(const Scalar &alpha)
Scale the current values of a vector, this = alpha*this.
virtual void replaceMap(const RCP< const Map > &map)
virtual size_t getNumVectors() const
Number of columns in the Vector.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual void Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
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 std::string description() const
A simple one-line description of this object.
Exception throws to report errors in the internal logical of the program.
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 void sumIntoLocalValue(LocalOrdinal, size_t, const Scalar &)
Add value to existing value, using local (row) index.
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 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 replaceLocalValue(LocalOrdinal, size_t, const Scalar &)
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.
Teuchos::RCP< MultiVector > Merge() const
merge BlockedMultiVector blocks to a single MultiVector
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 norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
virtual bool isSameSize(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &) const
Local number of rows on the calling process.
virtual void assign(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
virtual void replaceMap(const RCP< const Map > &map)
Teuchos::RCP< const Map > getMap() const
Access function for the underlying Map this DistObject was constructed with.
virtual size_t getLocalLength() const
Local number of rows on the calling process.
virtual void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
virtual void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
virtual ~BlockedVector()
Destructor.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of vector.
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 Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const =0
The Map describing the parallel distribution of this object.
void setMultiVector(size_t r, Teuchos::RCP< const MultiVector > v, bool bThyraMode)
set partial multivector associated with block row r
virtual void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
virtual void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
size_t global_size_t
Global size_t object.
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
virtual void abs(const MultiVector &)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
BlockedVector(const Teuchos::RCP< const BlockedMap > &map, bool zeroOut=true)
Constructor.
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]).
Teuchos::RCP< MultiVector > getMultiVector(size_t r) const
return partial multivector associated with block row r
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
virtual void assign(const MultiVector &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Merge() const
merge BlockedVector blocks to a single Vector
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this vector.
#define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Compute 1-norm of vector.
virtual void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this vector.
virtual global_size_t getGlobalLength() const
Global number of rows in the Vector.
virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
BlockedVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & operator=(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Assignment operator: Does a deep copy.
CombineMode
Xpetra::Combine Mode enumerable type.
#define XPETRA_MONITOR(funcName)
virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm in vector.
virtual void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Import.
virtual void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Export.
virtual void putScalar(const Scalar &value)
Set all values in the vector with the given value.
virtual void Xpetra_randomize()
Set vector values to random numbers. XPetra implementation.
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getMultiVector(size_t r) const
return partial Vector associated with block row r
bool is_null() const
virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.