Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros 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>
63 BlockedVector(const Teuchos::RCP<const Xpetra::BlockedMap<LocalOrdinal,GlobalOrdinal,Node>>& map, bool zeroOut)
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>::
70 BlockedVector( Teuchos::RCP<const Xpetra::BlockedMap<LocalOrdinal,GlobalOrdinal,Node>> bmap,
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>
178 Teuchos::RCP<const Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
180 getVector(size_t j) const
181 {
183 }
184 
185 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
186 Teuchos::RCP<Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
189 {
191 }
192 
193 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
194 Teuchos::ArrayRCP<const Scalar>
196 getData(size_t j) const
197 {
198  return BlockedMultiVector::getData(j);
199 }
200 
201 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
202 Teuchos::ArrayRCP<Scalar>
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 {
223  Teuchos::Array<Scalar> dots = Teuchos::Array<Scalar>(1);
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
258 scale(Teuchos::ArrayView<const Scalar> alpha)
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>
289 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
291 norm1() const
292 {
293  using Array = Teuchos::Array<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>;
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>
300 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
302 norm2() const
303 {
304  Teuchos::Array<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> norm =
305  Teuchos::Array<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>(1);
306  this->norm2(norm);
307  return norm[ 0 ];
308 }
309 
310 
311 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
312 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
314 normInf() const
315 {
316  Teuchos::Array<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>
317  norm = Teuchos::Array<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>(1);
318  this->normInf(norm);
319  return norm[ 0 ];
320 }
321 
322 
323 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
324 void
326 norm1(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const
327 {
329 }
330 
331 
332 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
333 void
335 norm2(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const
336 {
338 }
339 
340 
341 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
342 void
344 normInf(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const
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();
431  RCP<const Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>> rcpA = Teuchos::rcpFromRef(A);
432  RCP<const Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>> bmvec = Teuchos::rcpFromRef(B);
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
456 {
457  return 1;
458 }
459 
460 
461 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
462 size_t
465 {
467  "BlockedVector::getLocalLength: routine not implemented. It has no value as one must iterate on the partial vectors.");
468  TEUCHOS_UNREACHABLE_RETURN(0);
469 }
470 
471 
472 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
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.");
488  TEUCHOS_UNREACHABLE_RETURN(0);
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 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
602 
603 #if 0
604  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
605  template<class TargetDeviceType>
606  typename Kokkos::Impl::if_c<std::is_same<typename dev_execution_space::memory_space,
607  typename TargetDeviceType::memory_space>::value,
608  typename dual_view_type::t_dev_um,
609  typename dual_view_type::t_host_um>::type
611  getLocalView() const
612  {
613  if(std::is_same<typename host_execution_space::memory_space, typename TargetDeviceType::memory_space>::value)
614  {
615  return getHostLocalView();
616  }
617  else
618  {
619  return getDeviceLocalView();
620  }
621  }
622 #endif
623 
624 // template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
625 // virtual typename dual_view_type::
626 // t_dev_um BlockedVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::getDeviceLocalView() const
627 // {
628 // typename dual_view_type::t_dev_um test;
629 // return test;
630 // }
631 #endif // HAVE_XPETRA_KOKKOS_REFACTOR
632 
633 
634  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
635  Teuchos::RCP<const Xpetra::Map<LocalOrdinal,GlobalOrdinal,Node> >
637  getMap() const
638  {
639  XPETRA_MONITOR("BlockedVector::getMap");
640  return this->getBlockedMap();
641  }
642 
643 
644  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
645  Teuchos::RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
647  getMultiVector(size_t r) const
648  {
650  }
651 
652 
653  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
654  Teuchos::RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
656  getMultiVector(size_t r, bool bThyraMode) const
657  {
658  return BlockedMultiVector::getMultiVector(r, bThyraMode);
659  }
660 
661 
662  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
663  void
667  bool bThyraMode)
668  {
669  BlockedMultiVector::setMultiVector(r, v, bThyraMode);
670  return;
671  }
672 
673 
674  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
675  Teuchos::RCP< Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
677  Merge() const
678  {
679  return BlockedMultiVector::Merge();
680  }
681 
682 
683  template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
684  void
687  {
689  }
690 
691 
692  // template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
693  // virtual void BlockedVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::
694  // assign (const XpetrA::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& rhs)
695  // {
696  // throw Xpetra::Exceptions::RuntimeError("BlockedVector::assign: Not supported by BlockedVector.");
697  // }
698 
699 } // Xpetra namespace
700 
701 
702 #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.
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 Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
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
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
virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.