Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_TpetraMultiVector_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 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef XPETRA_TPETRAMULTIVECTOR_DEF_HPP
47 #define XPETRA_TPETRAMULTIVECTOR_DEF_HPP
49 
50 #include "Xpetra_TpetraMap.hpp" //TMP
51 #include "Xpetra_Utils.hpp"
52 #include "Xpetra_TpetraImport.hpp"
53 #include "Xpetra_TpetraExport.hpp"
54 
56 #include "Tpetra_MultiVector.hpp"
57 #include "Tpetra_Vector.hpp"
58 #include "Tpetra_Details_Random.hpp"
59 
60 namespace Xpetra {
61 
63 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
65  : vec_(Teuchos::rcp(new Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(toTpetra(map), NumVectors, zeroOut))) {
66  // TAW 1/30/2016: even though Tpetra allows numVecs == 0, Epetra does not. Introduce exception to keep behavior of Epetra and Tpetra consistent.
67  TEUCHOS_TEST_FOR_EXCEPTION(NumVectors < 1, std::invalid_argument, "Xpetra::TpetraMultiVector(map,numVecs,zeroOut): numVecs = " << NumVectors << " < 1.");
68 }
69 
71 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
73  TpetraMultiVector(const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &source, const Teuchos::DataAccess copyOrView)
74  : vec_(Teuchos::rcp(new Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(toTpetra(source), copyOrView))) {}
75 
77 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
79  TpetraMultiVector(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, const Teuchos::ArrayView<const Scalar> &A, size_t LDA, size_t NumVectors)
80  : vec_(Teuchos::rcp(new Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(toTpetra(map), A, LDA, NumVectors))) {
81  // TAW 1/30/2016: even though Tpetra allows numVecs == 0, Epetra does not. Introduce exception to keep behavior of Epetra and Tpetra consistent.
82  TEUCHOS_TEST_FOR_EXCEPTION(NumVectors < 1, std::invalid_argument, "Xpetra::TpetraMultiVector(map,A,LDA,numVecs): numVecs = " << NumVectors << " < 1.");
83 }
84 
86 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
88  TpetraMultiVector(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, const Teuchos::ArrayView<const Teuchos::ArrayView<const Scalar> > &ArrayOfPtrs, size_t NumVectors)
89  : vec_(Teuchos::rcp(new Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(toTpetra(map), ArrayOfPtrs, NumVectors))) {
90  // TAW 1/30/2016: even though Tpetra allows numVecs == 0, Epetra does not. Introduce exception to keep behavior of Epetra and Tpetra consistent.
91  TEUCHOS_TEST_FOR_EXCEPTION(NumVectors < 1, std::invalid_argument, "Xpetra::TpetraMultiVector(map,ArrayOfPtrs,numVecs): numVecs = " << NumVectors << " < 1.");
92 }
93 
95 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
98 
100 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
102  replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
103  XPETRA_MONITOR("TpetraMultiVector::replaceGlobalValue");
104  vec_->replaceGlobalValue(globalRow, vectorIndex, value);
105 }
106 
108 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
110  sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
111  XPETRA_MONITOR("TpetraMultiVector::sumIntoGlobalValue");
112  vec_->sumIntoGlobalValue(globalRow, vectorIndex, value);
113 }
114 
116 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
118  replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
119  XPETRA_MONITOR("TpetraMultiVector::replaceLocalValue");
120  vec_->replaceLocalValue(myRow, vectorIndex, value);
121 }
122 
124 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
126  sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
127  XPETRA_MONITOR("TpetraMultiVector::sumIntoLocalValue");
128  vec_->sumIntoLocalValue(myRow, vectorIndex, value);
129 }
130 
132 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
134  putScalar(const Scalar &value) {
135  XPETRA_MONITOR("TpetraMultiVector::putScalar");
136  vec_->putScalar(value);
137 }
138 
140 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
143  XPETRA_MONITOR("TpetraMultiVector::reduce");
144  vec_->reduce();
145 }
146 
147 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
148 Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
150  getVector(size_t j) const {
151  XPETRA_MONITOR("TpetraMultiVector::getVector");
152  return toXpetra(vec_->getVector(j));
153 }
154 
156 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
157 Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
160  XPETRA_MONITOR("TpetraMultiVector::getVectorNonConst");
161  return toXpetra(vec_->getVectorNonConst(j));
162 }
163 
165 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
166 Teuchos::ArrayRCP<const Scalar>
168  getData(size_t j) const {
169  XPETRA_MONITOR("TpetraMultiVector::getData");
170  return vec_->getData(j);
171 }
172 
174 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
175 Teuchos::ArrayRCP<Scalar>
177  getDataNonConst(size_t j) {
178  XPETRA_MONITOR("TpetraMultiVector::getDataNonConst");
179  return vec_->getDataNonConst(j);
180 }
181 
183 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
185  get1dCopy(Teuchos::ArrayView<Scalar> A, size_t LDA) const {
186  XPETRA_MONITOR("TpetraMultiVector::get1dCopy");
187  vec_->get1dCopy(A, LDA);
188 }
189 
191 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
193  get2dCopy(Teuchos::ArrayView<const Teuchos::ArrayView<Scalar> > ArrayOfPtrs) const {
194  XPETRA_MONITOR("TpetraMultiVector::get2dCopy");
195  vec_->get2dCopy(ArrayOfPtrs);
196 }
197 
199 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
200 Teuchos::ArrayRCP<const Scalar>
202  get1dView() const {
203  XPETRA_MONITOR("TpetraMultiVector::get1dView");
204  return vec_->get1dView();
205 }
206 
208 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
209 Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >
211  get2dView() const {
212  XPETRA_MONITOR("TpetraMultiVector::get2dView");
213  return vec_->get2dView();
214 }
215 
217 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
218 Teuchos::ArrayRCP<Scalar>
221  XPETRA_MONITOR("TpetraMultiVector::get1dViewNonConst");
222  return vec_->get1dViewNonConst();
223 }
224 
226 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
227 Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >
230  XPETRA_MONITOR("TpetraMultiVector::get2dViewNonConst");
231  return vec_->get2dViewNonConst();
232 }
233 
235 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
237  dot(const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A, const Teuchos::ArrayView<Scalar> &dots) const {
238  XPETRA_MONITOR("TpetraMultiVector::dot");
239  vec_->dot(toTpetra(A), dots);
240 }
241 
243 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
246  XPETRA_MONITOR("TpetraMultiVector::abs");
247  vec_->abs(toTpetra(A));
248 }
249 
251 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
254  XPETRA_MONITOR("TpetraMultiVector::reciprocal");
255  vec_->reciprocal(toTpetra(A));
256 }
257 
259 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
261  scale(const Scalar &alpha) {
262  XPETRA_MONITOR("TpetraMultiVector::scale");
263  vec_->scale(alpha);
264 }
265 
267 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
269  scale(Teuchos::ArrayView<const Scalar> alpha) {
270  XPETRA_MONITOR("TpetraMultiVector::scale");
271  vec_->scale(alpha);
272 }
273 
275 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
278  XPETRA_MONITOR("TpetraMultiVector::scale");
279  vec_->scale(alpha, toTpetra(A));
280 }
281 
283 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
285  update(const Scalar &alpha, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A, const Scalar &beta) {
286  XPETRA_MONITOR("TpetraMultiVector::update");
287  vec_->update(alpha, toTpetra(A), beta);
288 }
289 
291 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
293  update(const Scalar &alpha, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A, const Scalar &beta, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &B, const Scalar &gamma) {
294  XPETRA_MONITOR("TpetraMultiVector::update");
295  vec_->update(alpha, toTpetra(A), beta, toTpetra(B), gamma);
296 }
297 
299 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
301  norm1(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms) const {
302  XPETRA_MONITOR("TpetraMultiVector::norm1");
303  vec_->norm1(norms);
304 }
305 
307 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
309  norm2(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms) const {
310  XPETRA_MONITOR("TpetraMultiVector::norm2");
311  vec_->norm2(norms);
312 }
313 
315 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
317  normInf(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms) const {
318  XPETRA_MONITOR("TpetraMultiVector::normInf");
319  vec_->normInf(norms);
320 }
321 
323 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
325  meanValue(const Teuchos::ArrayView<Scalar> &means) const {
326  XPETRA_MONITOR("TpetraMultiVector::meanValue");
327  vec_->meanValue(means);
328 }
329 
331 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
333  multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &B, const Scalar &beta) {
334  XPETRA_MONITOR("TpetraMultiVector::multiply");
335  vec_->multiply(transA, transB, alpha, toTpetra(A), toTpetra(B), beta);
336 }
337 
339 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
341  getNumVectors() const {
342  XPETRA_MONITOR("TpetraMultiVector::getNumVectors");
343  return vec_->getNumVectors();
344 }
345 
347 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
350  XPETRA_MONITOR("TpetraMultiVector::getLocalLength");
351  return vec_->getLocalLength();
352 }
353 
355 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
358  XPETRA_MONITOR("TpetraMultiVector::getGlobalLength");
359  return vec_->getGlobalLength();
360 }
361 
362 // \brief Checks to see if the local length, number of vectors and size of Scalar type match
363 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
366  XPETRA_MONITOR("TpetraMultiVector::isSameSize");
367  return vec_->isSameSize(toTpetra(vec));
368 }
369 
371 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
373  description() const {
374  XPETRA_MONITOR("TpetraMultiVector::description");
375  return vec_->description();
376 }
377 
379 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
381  describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const {
382  XPETRA_MONITOR("TpetraMultiVector::describe");
383  vec_->describe(out, verbLevel);
384 }
385 
387 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
389  randomize(bool bUseXpetraImplementation) {
390  XPETRA_MONITOR("TpetraMultiVector::randomize");
391 
392  if (bUseXpetraImplementation)
394  else
395  vec_->randomize();
396 }
397 
399 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
401  randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation) {
402  XPETRA_MONITOR("TpetraMultiVector::randomize");
403 
404  if (bUseXpetraImplementation)
406  else
407  vec_->randomize(minVal, maxVal);
408 }
409 
410 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
411 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
413  getMap() const {
414  XPETRA_MONITOR("TpetraMultiVector::getMap");
415  return toXpetra(vec_->getMap());
416 }
417 
418 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
421  XPETRA_MONITOR("TpetraMultiVector::doImport");
422 
423  XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, source, tSource, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); // TODO: remove and use toTpetra()
424  RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
425  this->getTpetra_MultiVector()->doImport(*v, toTpetra(importer), toTpetra(CM));
426 }
427 
428 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
431  XPETRA_MONITOR("TpetraMultiVector::beginImport");
432 
433  XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, source, tSource, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); // TODO: remove and use toTpetra()
434  RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
435  this->getTpetra_MultiVector()->beginImport(*v, toTpetra(importer), toTpetra(CM));
436 }
437 
438 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
441  XPETRA_MONITOR("TpetraMultiVector::endImport");
442 
443  XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, source, tSource, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); // TODO: remove and use toTpetra()
444  RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
445  this->getTpetra_MultiVector()->endImport(*v, toTpetra(importer), toTpetra(CM));
446 }
447 
448 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
451  XPETRA_MONITOR("TpetraMultiVector::doExport");
452 
453  XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, dest, tDest, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); // TODO: remove and use toTpetra()
454  RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
455  this->getTpetra_MultiVector()->doExport(*v, toTpetra(importer), toTpetra(CM));
456 }
457 
458 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
461  XPETRA_MONITOR("TpetraMultiVector::beginExport");
462 
463  XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, dest, tDest, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); // TODO: remove and use toTpetra()
464  RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
465  this->getTpetra_MultiVector()->beginExport(*v, toTpetra(importer), toTpetra(CM));
466 }
467 
468 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
471  XPETRA_MONITOR("TpetraMultiVector::endExport");
472 
473  XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, dest, tDest, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); // TODO: remove and use toTpetra()
474  RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
475  this->getTpetra_MultiVector()->endExport(*v, toTpetra(importer), toTpetra(CM));
476 }
477 
478 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
481  XPETRA_MONITOR("TpetraMultiVector::doImport");
482 
483  XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, source, tSource, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); // TODO: remove and use toTpetra()
484  RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
485  this->getTpetra_MultiVector()->doImport(*v, toTpetra(exporter), toTpetra(CM));
486 }
487 
488 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
491  XPETRA_MONITOR("TpetraMultiVector::beginImport");
492 
493  XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, source, tSource, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); // TODO: remove and use toTpetra()
494  RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
495  this->getTpetra_MultiVector()->beginImport(*v, toTpetra(exporter), toTpetra(CM));
496 }
497 
498 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
501  XPETRA_MONITOR("TpetraMultiVector::endImport");
502 
503  XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, source, tSource, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); // TODO: remove and use toTpetra()
504  RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
505  this->getTpetra_MultiVector()->endImport(*v, toTpetra(exporter), toTpetra(CM));
506 }
507 
508 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
511  XPETRA_MONITOR("TpetraMultiVector::doExport");
512 
513  XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, dest, tDest, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); // TODO: remove and use toTpetra()
514  RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
515  this->getTpetra_MultiVector()->doExport(*v, toTpetra(exporter), toTpetra(CM));
516 }
517 
518 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
521  XPETRA_MONITOR("TpetraMultiVector::beginExport");
522 
523  XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, dest, tDest, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); // TODO: remove and use toTpetra()
524  RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
525  this->getTpetra_MultiVector()->beginExport(*v, toTpetra(exporter), toTpetra(CM));
526 }
527 
528 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
531  XPETRA_MONITOR("TpetraMultiVector::endExport");
532 
533  XPETRA_DYNAMIC_CAST(const TpetraMultiVectorClass, dest, tDest, "Xpetra::TpetraMultiVector::doImport only accept Xpetra::TpetraMultiVector as input arguments."); // TODO: remove and use toTpetra()
534  RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
535  this->getTpetra_MultiVector()->endExport(*v, toTpetra(exporter), toTpetra(CM));
536 }
537 
538 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
541  XPETRA_MONITOR("TpetraMultiVector::replaceMap");
542  this->getTpetra_MultiVector()->replaceMap(toTpetra(map));
543 }
544 
546 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
548  TpetraMultiVector(const Teuchos::RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &vec)
549  : vec_(vec) {} // TODO removed const
550 
552 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
553 RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
555  getTpetra_MultiVector() const { return vec_; }
556 
558 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
560  setSeed(unsigned int seed) {
561  XPETRA_MONITOR("TpetraMultiVector::seedrandom");
562  Teuchos::ScalarTraits<Scalar>::seedrandom(seed);
563  // Tell Tpetra to update its RNG pool for the new random seed
564  Tpetra::Details::Static_Random_XorShift64_Pool<typename Node::device_type::execution_space>::resetPool(getMap()->getComm()->getRank());
565 }
566 
567 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
571  return subview(vec_->getLocalViewHost(Tpetra::Access::ReadOnly), Kokkos::ALL(), Kokkos::ALL());
572 }
573 
574 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
578  return subview(vec_->getLocalViewDevice(Tpetra::Access::ReadOnly), Kokkos::ALL(), Kokkos::ALL());
579 }
580 
581 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
585  return subview(vec_->getLocalViewHost(Tpetra::Access::OverwriteAll), Kokkos::ALL(), Kokkos::ALL());
586 }
587 
588 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
592  return subview(vec_->getLocalViewDevice(Tpetra::Access::OverwriteAll), Kokkos::ALL(), Kokkos::ALL());
593 }
594 
595 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
599  return subview(vec_->getLocalViewHost(Tpetra::Access::ReadWrite), Kokkos::ALL(), Kokkos::ALL());
600 }
601 
602 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
606  return subview(vec_->getLocalViewDevice(Tpetra::Access::ReadWrite), Kokkos::ALL(), Kokkos::ALL());
607 }
608 
611 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
615  const this_type *rhsPtr = dynamic_cast<const this_type *>(&rhs);
616  TEUCHOS_TEST_FOR_EXCEPTION(
617  rhsPtr == NULL, std::invalid_argument,
618  "Xpetra::MultiVector::operator=:"
619  " The left-hand side (LHS) of the assignment has a different type than "
620  "the right-hand side (RHS). The LHS has type Xpetra::TpetraMultiVector"
621  " (which means it wraps a Tpetra::MultiVector), but the RHS has some "
622  "other type. This probably means that the RHS wraps an "
623  "Epetra_MultiVector. Xpetra::MultiVector does not currently implement "
624  "assignment from an Epetra object to a Tpetra object, though this could"
625  " be added with sufficient interest.");
626 
627  typedef Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> TMV;
628  RCP<const TMV> rhsImpl = rhsPtr->getTpetra_MultiVector();
629  RCP<TMV> lhsImpl = this->getTpetra_MultiVector();
630 
631  TEUCHOS_TEST_FOR_EXCEPTION(
632  rhsImpl.is_null(), std::logic_error,
633  "Xpetra::MultiVector::operator= "
634  "(in Xpetra::TpetraMultiVector::assign): *this (the right-hand side of "
635  "the assignment) has a null RCP<Tpetra::MultiVector> inside. Please "
636  "report this bug to the Xpetra developers.");
637  TEUCHOS_TEST_FOR_EXCEPTION(
638  lhsImpl.is_null(), std::logic_error,
639  "Xpetra::MultiVector::operator= "
640  "(in Xpetra::TpetraMultiVector::assign): The left-hand side of the "
641  "assignment has a null RCP<Tpetra::MultiVector> inside. Please report "
642  "this bug to the Xpetra developers.");
643 
644  Tpetra::deep_copy(*lhsImpl, *rhsImpl);
645 }
646 
647 #ifdef HAVE_XPETRA_EPETRA
648 
649 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
650  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
651 
652 // specialization for TpetraMultiVector on EpetraNode and GO=int
653 template <class Scalar>
654 class TpetraMultiVector<Scalar, int, int, EpetraNode>
655  : public virtual MultiVector<Scalar, int, int, EpetraNode> {
656  typedef int LocalOrdinal;
657  typedef int GlobalOrdinal;
658  typedef EpetraNode Node;
659 
660  // The following typedef are used by the XPETRA_DYNAMIC_CAST() macro.
662 
663  public:
665 
666 
670  }
671 
673  TpetraMultiVector(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut = true) {
675  }
676 
678  TpetraMultiVector(const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &source, const Teuchos::DataAccess copyOrView) {
680  }
681 
683  TpetraMultiVector(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, const Teuchos::ArrayView<const Scalar> &A, size_t LDA, size_t NumVectors) {
685  }
686 
688  TpetraMultiVector(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, const Teuchos::ArrayView<const Teuchos::ArrayView<const Scalar> > &ArrayOfPtrs, size_t NumVectors) {
690  }
691 
693  virtual ~TpetraMultiVector() {}
694 
696 
698 
699 
701  void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {}
702 
704  void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {}
705 
707  void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {}
708 
710  void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {}
711 
713  void putScalar(const Scalar &value) {}
714 
716  void reduce() {}
717 
719 
721 
722 
724  Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVector(size_t j) const { return Teuchos::null; }
725 
727  Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVectorNonConst(size_t j) { return Teuchos::null; }
728 
730  Teuchos::ArrayRCP<const Scalar> getData(size_t j) const { return Teuchos::ArrayRCP<const Scalar>(); }
731 
733  Teuchos::ArrayRCP<Scalar> getDataNonConst(size_t j) { return Teuchos::ArrayRCP<Scalar>(); }
734 
736  void get1dCopy(Teuchos::ArrayView<Scalar> A, size_t LDA) const {}
737 
739  void get2dCopy(Teuchos::ArrayView<const Teuchos::ArrayView<Scalar> > ArrayOfPtrs) const {}
740 
742  Teuchos::ArrayRCP<const Scalar> get1dView() const { return Teuchos::ArrayRCP<const Scalar>(); }
743 
745  Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> > get2dView() const { return Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >(); }
746 
748  Teuchos::ArrayRCP<Scalar> get1dViewNonConst() { return Teuchos::ArrayRCP<Scalar>(); }
749 
751  Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> > get2dViewNonConst() { return Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >(); }
752 
754 
756 
757 
759  void dot(const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A, const Teuchos::ArrayView<Scalar> &dots) const {}
760 
763 
766 
768  void scale(const Scalar &alpha) {}
769 
771  void scale(Teuchos::ArrayView<const Scalar> alpha) {}
772 
774  void scale(const Scalar &alpha, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A) {}
775 
777  void update(const Scalar &alpha, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A, const Scalar &beta) {}
778 
780  void update(const Scalar &alpha, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A, const Scalar &beta, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &B, const Scalar &gamma) {}
781 
783  void norm1(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms) const {}
784 
786  void norm2(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms) const {}
787 
789  void normInf(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms) const {}
790 
792  void meanValue(const Teuchos::ArrayView<Scalar> &means) const {}
793 
795  void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &B, const Scalar &beta) {}
796 
798 
800 
801 
803  size_t getNumVectors() const { return 0; }
804 
806  size_t getLocalLength() const { return 0; }
807 
809  global_size_t getGlobalLength() const { return 0; }
810 
811  // \! Checks to see if the local length, number of vectors and size of Scalar type match
813 
815 
817 
818 
820  std::string description() const { return std::string(""); }
821 
823  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {}
824 
826 
829 
831  void randomize(bool bUseXpetraImplementation = false) {}
832 
834  void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation = false) {}
835 
836  //{@
837  // Implements DistObject interface
838 
839  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getMap() const { return Teuchos::null; }
840 
842 
844 
846 
848 
850 
852 
854 
856 
858 
860 
862 
864 
865  void replaceMap(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map) {}
866 
868 
870 
871 
873  TpetraMultiVector(const Teuchos::RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &vec) {
875  }
876 
878  RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getTpetra_MultiVector() const { return Teuchos::null; }
879 
881  void setSeed(unsigned int seed) {}
882 
884 
885  protected:
888  virtual void
890 }; // TpetraMultiVector class (specialization GO=int, NO=EpetraNode)
891 #endif
892 
893 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
894  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
895 
896 // specialization for TpetraMultiVector on EpetraNode and GO=long long
897 template <class Scalar>
898 class TpetraMultiVector<Scalar, int, long long, EpetraNode>
899  : public virtual MultiVector<Scalar, int, long long, EpetraNode> {
900  typedef int LocalOrdinal;
901  typedef long long GlobalOrdinal;
902  typedef EpetraNode Node;
903 
904  // The following typedef are used by the XPETRA_DYNAMIC_CAST() macro.
906 
907  public:
909 
910 
912  TpetraMultiVector(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut = true) {
914  }
915 
917  TpetraMultiVector(const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &source, const Teuchos::DataAccess copyOrView) {
919  }
920 
922  TpetraMultiVector(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, const Teuchos::ArrayView<const Scalar> &A, size_t LDA, size_t NumVectors) {
924  }
925 
927  TpetraMultiVector(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, const Teuchos::ArrayView<const Teuchos::ArrayView<const Scalar> > &ArrayOfPtrs, size_t NumVectors) {
929  }
930 
932  virtual ~TpetraMultiVector() {}
933 
935 
937 
938 
940  void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {}
941 
943  void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {}
944 
946  void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {}
947 
949  void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {}
950 
952  void putScalar(const Scalar &value) {}
953 
955  void reduce() {}
956 
958 
960 
961 
963  Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVector(size_t j) const { return Teuchos::null; }
964 
966  Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVectorNonConst(size_t j) { return Teuchos::null; }
967 
969  Teuchos::ArrayRCP<const Scalar> getData(size_t j) const { return Teuchos::ArrayRCP<const Scalar>(); }
970 
972  Teuchos::ArrayRCP<Scalar> getDataNonConst(size_t j) { return Teuchos::ArrayRCP<Scalar>(); }
973 
975  void get1dCopy(Teuchos::ArrayView<Scalar> A, size_t LDA) const {}
976 
978  void get2dCopy(Teuchos::ArrayView<const Teuchos::ArrayView<Scalar> > ArrayOfPtrs) const {}
979 
981  Teuchos::ArrayRCP<const Scalar> get1dView() const { return Teuchos::ArrayRCP<const Scalar>(); }
982 
984  Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> > get2dView() const { return Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >(); }
985 
987  Teuchos::ArrayRCP<Scalar> get1dViewNonConst() { return Teuchos::ArrayRCP<Scalar>(); }
988 
990  Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> > get2dViewNonConst() { return Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >(); }
991 
993 
995 
996 
998  void dot(const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A, const Teuchos::ArrayView<Scalar> &dots) const {}
999 
1002 
1005 
1007  void scale(const Scalar &alpha) {}
1008 
1010  void scale(Teuchos::ArrayView<const Scalar> alpha) {}
1011 
1013  void scale(const Scalar &alpha, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A) {}
1014 
1016  void update(const Scalar &alpha, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A, const Scalar &beta) {}
1017 
1019  void update(const Scalar &alpha, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A, const Scalar &beta, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &B, const Scalar &gamma) {}
1020 
1022  void norm1(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms) const {}
1023 
1025  void norm2(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms) const {}
1026 
1028  void normInf(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms) const {}
1029 
1031  void meanValue(const Teuchos::ArrayView<Scalar> &means) const {}
1032 
1034  void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A, const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &B, const Scalar &beta) {}
1035 
1037 
1039 
1040 
1042  size_t getNumVectors() const { return 0; }
1043 
1045  size_t getLocalLength() const { return 0; }
1046 
1048  global_size_t getGlobalLength() const { return 0; }
1049 
1050  // \! Checks to see if the local length, number of vectors and size of Scalar type match
1052 
1054 
1056 
1057 
1059  std::string description() const { return std::string(""); }
1060 
1062  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {}
1063 
1065 
1068 
1070  void randomize(bool bUseXpetraImplementation = false) {}
1071 
1073  void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation = false) {}
1074 
1075  //{@
1076  // Implements DistObject interface
1077 
1078  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > getMap() const { return Teuchos::null; }
1079 
1081 
1083 
1085 
1087 
1089 
1091 
1093 
1095 
1097 
1099 
1101 
1103 
1104  void replaceMap(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map) {}
1105 
1107 
1109 
1110 
1112  TpetraMultiVector(const Teuchos::RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &vec) {
1114  }
1115 
1117  RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getTpetra_MultiVector() const { return Teuchos::null; }
1118 
1120  void setSeed(unsigned int seed) {}
1121 
1123 
1124  protected:
1127  virtual void
1129 }; // TpetraMultiVector class (specialization GO=int, NO=EpetraNode)
1130 
1131 #endif // TpetraMultiVector class (specialization GO=long long, NO=EpetraNode)
1132 
1133 #endif // HAVE_XPETRA_EPETRA
1134 
1135 } // namespace Xpetra
1136 
1137 // Following header file inculsion is needed for the dynamic_cast to TpetraVector in
1138 // elementWiseMultiply (because we cannot dynamic_cast if target is not a complete type)
1139 // It is included here to avoid circular dependency between Vector and MultiVector
1140 // TODO: there is certainly a more elegant solution...
1141 #include "Xpetra_TpetraVector.hpp"
1142 
1143 namespace Xpetra {
1144 
1145 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
1147  elementWiseMultiply(Scalar scalarAB,
1150  Scalar scalarThis) {
1151  XPETRA_MONITOR("TpetraMultiVector::elementWiseMultiply");
1152 
1153  // XPETRA_DYNAMIC_CAST won't take TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>
1154  // as an argument, hence the following typedef.
1156  XPETRA_DYNAMIC_CAST(const tpv, A, tA, "Xpetra::TpetraMultiVectorMatrix->multiply() only accept Xpetra::TpetraMultiVector as input arguments.");
1157  XPETRA_DYNAMIC_CAST(const TpetraMultiVector, B, tB, "Xpetra::TpetraMultiVectorMatrix->multiply() only accept Xpetra::TpetraMultiVector as input arguments.");
1158  vec_->elementWiseMultiply(scalarAB, *tA.getTpetra_Vector(), *tB.getTpetra_MultiVector(), scalarThis);
1159 }
1160 
1161 } // namespace Xpetra
1162 
1163 #define XPETRA_TPETRAMULTIVECTOR_SHORT
1164 #endif // XPETRA_TPETRAMULTIVECTOR_HPP
void replaceMap(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
size_t getLocalLength() const
Local number of rows on the calling process.
Teuchos::ArrayRCP< Teuchos::ArrayRCP< const Scalar > > get2dView() const
Return const persisting pointers to values.
RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_MultiVector() const
Get the underlying Tpetra multivector.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
Teuchos::ArrayRCP< const Scalar > get1dView() const
Const persisting (1-D) view of this multivector&#39;s local values.
Teuchos::ArrayRCP< Teuchos::ArrayRCP< const Scalar > > get2dView() const
Return const persisting pointers to values.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void dot(const 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]).
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic constuctor.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void setSeed(unsigned int seed)
Set seed for Random function.
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
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::ArrayRCP< Teuchos::ArrayRCP< Scalar > > get2dViewNonConst()
Return non-const persisting pointers to values.
void reduce()
Sum values of a locally replicated multivector across all processes.
void dot(const 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]).
void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
Teuchos::ArrayRCP< Teuchos::ArrayRCP< Scalar > > get2dViewNonConst()
Return non-const persisting pointers to values.
std::string description() const
A simple one-line description of this object.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &ArrayOfPtrs, size_t NumVectors)
Create multivector by copying array of views of local data.
void reciprocal(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).
Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
constexpr struct ReadOnlyStruct ReadOnly
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
virtual ~TpetraMultiVector()
Destructor (virtual for memory safety of derived classes).
void setSeed(unsigned int seed)
Set seed for Random function.
Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)
Element-wise multiply of a Vector A with a TpetraMultiVector B.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic constuctor.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
size_t getNumVectors() const
Number of columns in the multivector.
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)
Element-wise multiply of a Vector A with a TpetraMultiVector B.
TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraMultiVectorClass
std::string description() const
A simple one-line description of this object.
void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
size_t getNumVectors() const
Number of columns in the multivector.
void setSeed(unsigned int seed)
Set seed for Random function.
void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void scale(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Replace multi-vector values with scaled values of A, this = alpha*A.
void replaceMap(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
virtual void Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
void reduce()
Sum values of a locally replicated multivector across all processes.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import data into this object using an Import object (&quot;forward mode&quot;).
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export data into this object using an Import object (&quot;reverse mode&quot;).
void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Teuchos::ArrayRCP< Scalar > get1dViewNonConst()
Nonconst persisting (1-D) view of this multivector&#39;s local values.
void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
void get2dCopy(Teuchos::ArrayView< const Teuchos::ArrayView< Scalar > > ArrayOfPtrs) const
Fill the given array with a copy of this multivector&#39;s local values.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import data into this object using an Import object (&quot;forward mode&quot;).
void meanValue(const Teuchos::ArrayView< Scalar > &means) const
Compute mean (average) value of each vector in multi-vector. The outcome of this routine is undefined...
TpetraMultiVector(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView)
Copy constructor (performs a deep copy).
Teuchos::ArrayRCP< Teuchos::ArrayRCP< Scalar > > get2dViewNonConst()
Return non-const persisting pointers to values.
TpetraMultiVector(const Teuchos::RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &vec)
TpetraMultiVector constructor to wrap a Tpetra::MultiVector object.
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import data into this object using an Import object (&quot;forward mode&quot;).
void get1dCopy(Teuchos::ArrayView< Scalar > A, size_t LDA) const
Fill the given array with a copy of this multivector&#39;s local values.
void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)
Element-wise multiply of a Vector A with a TpetraMultiVector B.
void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &beta)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
TpetraMultiVector(const Teuchos::RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &vec)
TpetraMultiVector constructor to wrap a Tpetra::MultiVector object.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &gamma)
Update multi-vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
size_t getLocalLength() const
Local number of rows on the calling process.
void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &beta)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export data into this object using an Import object (&quot;reverse mode&quot;).
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
void get2dCopy(Teuchos::ArrayView< const Teuchos::ArrayView< Scalar > > ArrayOfPtrs) const
Fill the given array with a copy of this multivector&#39;s local values.
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &beta)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
std::string description() const
A simple one-line description of this object.
Teuchos::ArrayRCP< Scalar > get1dViewNonConst()
Nonconst persisting (1-D) view of this multivector&#39;s local values.
void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void dot(const 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]).
size_t getNumVectors() const
Number of columns in the multivector.
Teuchos::ArrayRCP< Scalar > get1dViewNonConst()
Nonconst persisting (1-D) view of this multivector&#39;s local values.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
void reduce()
Sum values of a locally replicated multivector across all processes.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
void get2dCopy(Teuchos::ArrayView< const Teuchos::ArrayView< Scalar > > ArrayOfPtrs) const
Fill the given array with a copy of this multivector&#39;s local values.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraMultiVectorClass
void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void reciprocal(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
virtual ~TpetraMultiVector()
Destructor (virtual for memory safety of derived classes).
Teuchos::ArrayRCP< const Scalar > get1dView() const
Const persisting (1-D) view of this multivector&#39;s local values.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
size_t global_size_t
Global size_t object.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic constuctor.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &gamma)
Update multi-vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
TpetraMultiVector(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView)
Copy constructor (performs a deep copy).
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
virtual dual_view_type::t_dev_const_um getDeviceLocalView(Access::ReadOnlyStruct) const
void get1dCopy(Teuchos::ArrayView< Scalar > A, size_t LDA) const
Fill the given array with a copy of this multivector&#39;s local values.
void get1dCopy(Teuchos::ArrayView< Scalar > A, size_t LDA) const
Fill the given array with a copy of this multivector&#39;s local values.
void reciprocal(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).
global_size_t getGlobalLength() const
Global number of rows in the multivector.
virtual ~TpetraMultiVector()
Destructor (virtual for memory safety of derived classes).
constexpr struct OverwriteAllStruct OverwriteAll
void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_MultiVector() const
Get the underlying Tpetra multivector.
Teuchos::ArrayRCP< Teuchos::ArrayRCP< const Scalar > > get2dView() const
Return const persisting pointers to values.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &ArrayOfPtrs, size_t NumVectors)
Create multivector by copying array of views of local data.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
size_t getLocalLength() const
Local number of rows on the calling process.
void scale(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Replace multi-vector values with scaled values of A, this = alpha*A.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Scalar > &A, size_t LDA, size_t NumVectors)
Create multivector by copying two-dimensional array of local data.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Scalar > &A, size_t LDA, size_t NumVectors)
Create multivector by copying two-dimensional array of local data.
void meanValue(const Teuchos::ArrayView< Scalar > &means) const
Compute mean (average) value of each vector in multi-vector. The outcome of this routine is undefined...
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
Teuchos::ArrayRCP< const Scalar > get1dView() const
Const persisting (1-D) view of this multivector&#39;s local values.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export data into this object using an Import object (&quot;reverse mode&quot;).
CombineMode
Xpetra::Combine Mode enumerable type.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_MultiVector() const
Get the underlying Tpetra multivector.
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
constexpr struct ReadWriteStruct ReadWrite
#define XPETRA_MONITOR(funcName)
void meanValue(const Teuchos::ArrayView< Scalar > &means) const
Compute mean (average) value of each vector in multi-vector. The outcome of this routine is undefined...
global_size_t getGlobalLength() const
Global number of rows in the multivector.
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
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.
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
virtual dual_view_type::t_host_const_um getHostLocalView(Access::ReadOnlyStruct) const
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
global_size_t getGlobalLength() const
Global number of rows in the multivector.
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.
void replaceMap(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)