46 #ifndef XPETRA_TPETRACRSMATRIX_DEF_HPP
47 #define XPETRA_TPETRACRSMATRIX_DEF_HPP
50 #include "Tpetra_Details_residual.hpp"
54 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
56 : mtx_ (Teuchos::rcp (new Tpetra::
CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> (
toTpetra(rowMap), maxNumEntriesPerRow, Tpetra::StaticProfile, params))) { }
58 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
60 : mtx_(Teuchos::rcp(new Tpetra::
CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> (
toTpetra(rowMap), NumEntriesPerRowToAlloc(), Tpetra::StaticProfile, params))) { }
62 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
63 TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::TpetraCrsMatrix(
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
size_t maxNumEntriesPerRow,
const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
64 : mtx_(Teuchos::rcp(new Tpetra::
CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
toTpetra(rowMap),
toTpetra(colMap), maxNumEntriesPerRow, Tpetra::StaticProfile, params))) { }
66 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
67 TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::TpetraCrsMatrix(
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc,
const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
68 : mtx_(Teuchos::rcp(new Tpetra::
CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >(
toTpetra(rowMap),
toTpetra(colMap), NumEntriesPerRowToAlloc(), Tpetra::StaticProfile, params))) { }
70 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
72 : mtx_(Teuchos::rcp(new Tpetra::
CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >(
toTpetra(graph), params))) { }
76 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
81 const Teuchos::RCP<Teuchos::ParameterList>& params)
83 typedef Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> MyTpetraCrsMatrix;
85 RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSourceMatrix.getTpetra_CrsMatrix();
87 RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myDomainMap = domainMap!=Teuchos::null ?
toTpetra(domainMap) : Teuchos::null;
88 RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myRangeMap = rangeMap!=Teuchos::null ?
toTpetra(rangeMap) : Teuchos::null;
89 mtx_=Tpetra::importAndFillCompleteCrsMatrix<MyTpetraCrsMatrix>(tSourceMatrix.getTpetra_CrsMatrix(),
toTpetra(importer),myDomainMap,myRangeMap,params);
90 bool restrictComm=
false;
91 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
92 if(restrictComm && mtx_->getRowMap().is_null()) mtx_=Teuchos::null;
96 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
101 const Teuchos::RCP<Teuchos::ParameterList>& params)
103 typedef Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> MyTpetraCrsMatrix;
105 RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSourceMatrix.getTpetra_CrsMatrix();
107 RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myDomainMap = domainMap!=Teuchos::null ?
toTpetra(domainMap) : Teuchos::null;
108 RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myRangeMap = rangeMap!=Teuchos::null ?
toTpetra(rangeMap) : Teuchos::null;
109 mtx_=Tpetra::exportAndFillCompleteCrsMatrix<MyTpetraCrsMatrix>(tSourceMatrix.getTpetra_CrsMatrix(),
toTpetra(exporter),myDomainMap,myRangeMap,params);
113 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
119 const Teuchos::RCP<Teuchos::ParameterList>& params)
121 typedef Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> MyTpetraCrsMatrix;
123 RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSourceMatrix.getTpetra_CrsMatrix();
125 RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myDomainMap = domainMap!=Teuchos::null ?
toTpetra(domainMap) : Teuchos::null;
126 RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myRangeMap = rangeMap!=Teuchos::null ?
toTpetra(rangeMap) : Teuchos::null;
128 mtx_=Tpetra::importAndFillCompleteCrsMatrix<MyTpetraCrsMatrix>(tSourceMatrix.getTpetra_CrsMatrix(),
toTpetra(RowImporter),
toTpetra(*DomainImporter),myDomainMap,myRangeMap,params);
129 bool restrictComm=
false;
130 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
131 if(restrictComm && mtx_->getRowMap().is_null()) mtx_=Teuchos::null;
134 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
140 const Teuchos::RCP<Teuchos::ParameterList>& params)
142 typedef Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> MyTpetraCrsMatrix;
144 RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSourceMatrix.getTpetra_CrsMatrix();
146 RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myDomainMap = domainMap!=Teuchos::null ?
toTpetra(domainMap) : Teuchos::null;
147 RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myRangeMap = rangeMap!=Teuchos::null ?
toTpetra(rangeMap) : Teuchos::null;
149 mtx_=Tpetra::exportAndFillCompleteCrsMatrix<MyTpetraCrsMatrix>(tSourceMatrix.getTpetra_CrsMatrix(),
toTpetra(RowExporter),
toTpetra(*DomainExporter),myDomainMap,myRangeMap,params);
155 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
156 #ifdef HAVE_XPETRA_TPETRA
157 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
160 const local_matrix_type& lclMatrix,
161 const Teuchos::RCP<Teuchos::ParameterList>& params)
162 : mtx_(Teuchos::rcp(new Tpetra::
CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
toTpetra(rowMap),
toTpetra(colMap), lclMatrix, params))) { }
164 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
166 const local_matrix_type& lclMatrix,
167 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
168 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
169 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
170 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap,
171 const Teuchos::RCP<Teuchos::ParameterList>& params)
172 : mtx_(Teuchos::rcp(new Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(lclMatrix,
toTpetra(rowMap),
toTpetra(colMap),
toTpetra(domainMap),
toTpetra(rangeMap), params))) { }
176 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
179 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
182 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
185 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
188 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
191 const ArrayView<const LocalOrdinal> &cols,
192 const ArrayView<const Scalar> &vals)
195 typedef typename ArrayView<const LocalOrdinal>::size_type size_type;
196 const LocalOrdinal numValid =
197 mtx_->replaceLocalValues (localRow, cols, vals);
198 TEUCHOS_TEST_FOR_EXCEPTION(
199 static_cast<size_type> (numValid) != cols.size (), std::runtime_error,
200 "replaceLocalValues returned " << numValid <<
" != cols.size() = " <<
201 cols.size () <<
".");
204 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
207 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
210 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
212 {
XPETRA_MONITOR(
"TpetraCrsMatrix::allocateAllValues"); rowptr.resize(getNodeNumRows()+1); colind.resize(numNonZeros); values.resize(numNonZeros);}
214 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
216 {
XPETRA_MONITOR(
"TpetraCrsMatrix::setAllValues"); mtx_->setAllValues(rowptr,colind,values); }
218 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
220 {
XPETRA_MONITOR(
"TpetraCrsMatrix::getAllValues"); mtx_->getAllValues(rowptr,colind,values); }
222 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
224 {
return mtx_->haveGlobalConstants();}
226 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
229 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
230 void TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::fillComplete(
const RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap,
const RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap,
const RCP< ParameterList > ¶ms) {
XPETRA_MONITOR(
"TpetraCrsMatrix::fillComplete"); mtx_->fillComplete(
toTpetra(domainMap),
toTpetra(rangeMap), params); }
232 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
236 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
240 RCP<const Tpetra::Import<LocalOrdinal,GlobalOrdinal,Node> > myImport = tImporter.getTpetra_Import();
241 mtx_->replaceDomainMapAndImporter(
toTpetra(newDomainMap),myImport);
244 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
249 const RCP<ParameterList> ¶ms) {
251 RCP<const Tpetra::Import<LocalOrdinal,GlobalOrdinal,Node> > myImport;
252 RCP<const Tpetra::Export<LocalOrdinal,GlobalOrdinal,Node> > myExport;
254 if(importer!=Teuchos::null) {
256 myImport = tImporter.getTpetra_Import();
258 if(exporter!=Teuchos::null) {
260 myExport = tExporter.getTpetra_Export();
263 mtx_->expertStaticFillComplete(
toTpetra(domainMap),
toTpetra(rangeMap),myImport,myExport,params);
266 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
269 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
272 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
275 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
278 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
281 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
284 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
287 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
290 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
293 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
296 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
299 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
302 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
305 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
308 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
311 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
314 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
317 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
320 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
323 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
326 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
329 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
332 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
335 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
336 void TpetraCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::apply(
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X,
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode, Scalar alpha, Scalar beta)
const {
XPETRA_MONITOR(
"TpetraCrsMatrix::apply"); mtx_->apply(
toTpetra(X),
toTpetra(Y), mode, alpha, beta); }
338 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
341 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
344 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
347 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
350 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
353 Teuchos::LabeledObject::setObjectLabel(objectLabel);
354 mtx_->setObjectLabel(objectLabel);
359 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
361 : mtx_(Teuchos::rcp(new Tpetra::
CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>(*(matrix.mtx_),Teuchos::Copy))) {}
363 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
367 mtx_->getLocalDiagCopy(*tDiag.getTpetra_Vector());
370 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
373 mtx_->getLocalDiagOffsets(offsets);
376 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
379 mtx_->getLocalDiagCopy(*(
toTpetra(diag)), offsets);
382 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
385 Tpetra::replaceDiagonalCrsMatrix(*mtx_, *(
toTpetra(diag)));
388 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
394 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
400 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
403 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
409 RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_CrsMatrix();
415 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
421 RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_CrsMatrix();
426 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
432 RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_CrsMatrix();
437 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
443 RCP< const Tpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_CrsMatrix();
448 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
451 mtx_->removeEmptyProcessesInPlace(
toTpetra(newMap));
454 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
456 return ! mtx_.is_null ();
459 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
462 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
466 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
470 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
486 #endif // XPETRA_TPETRACRSMATRIX_DEF_HPP
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
std::string description() const
A simple one-line description of this object.
void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row indices.
void residual(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const
Compute a residual R = B - (*this) * X.
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using global IDs.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries in the (locally owned) global row.
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const
Computes the sparse matrix-multivector multiplication.
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets the 1D pointer arrays of the graph.
void allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
void resumeFill(const RCP< ParameterList > ¶ms=null)
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using local IDs.
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
void setObjectLabel(const std::string &objectLabel)
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newMap)
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this.
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix. ...
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
Gets the 1D pointer arrays of the graph.
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &newImporter)
Replaces the current domainMap and importer with the user-specified objects.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calli...
void expertStaticFillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=Teuchos::null, const RCP< ParameterList > ¶ms=Teuchos::null)
Expert static fill complete.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Right scale operator with given vector values.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
size_t global_size_t
Global size_t object.
TpetraCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Constructor specifying fixed number of entries for each row.
virtual ~TpetraCrsMatrix()
Destructor.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the range of this operator, which must be compatible with Y...
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
RCP< const Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsMatrix() const
Get the underlying Tpetra matrix.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
RCP< Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsMatrixNonConst() const
Get the underlying Tpetra matrix.
bool hasMatrix() const
Does this have an underlying matrix.
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
Replace the diagonal entries of the matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
CombineMode
Xpetra::Combine Mode enumerable type.
#define XPETRA_MONITOR(funcName)
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Left scale operator with given vector values.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > ¶ms=null)
Signal that data entry is complete, specifying domain and range maps.
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &indices, const ArrayView< Scalar > &values, size_t &numEntries) const
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage...
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
bool isFillActive() const
Returns true if the matrix is in edit mode.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.