44#ifndef EPETRA_VBRMATRIX_H
45#define EPETRA_VBRMATRIX_H
269 int PutScalar(
double ScalarConstant);
278 int Scale(
double ScalarConstant);
286 int DirectSubmitBlockEntry(
int GlobalBlockRow,
int GlobalBlockCol,
287 const double *values,
int LDA,
288 int NumRows,
int NumCols,
bool sum_into);
301 int BeginInsertGlobalValues(
int BlockRow,
316 int BeginInsertMyValues(
int BlockRow,
int NumBlockEntries,
int * BlockIndices);
329 int BeginReplaceGlobalValues(
int BlockRow,
int NumBlockEntries,
int *BlockIndices);
342 int BeginReplaceMyValues(
int BlockRow,
int NumBlockEntries,
int *BlockIndices);
355 int BeginSumIntoGlobalValues(
int BlockRow,
int NumBlockEntries,
int *BlockIndices);
368 int BeginSumIntoMyValues(
int BlockRow,
int NumBlockEntries,
int *BlockIndices);
395 int SubmitBlockEntry(
double *Values,
int LDA,
int NumRows,
int NumCols);
424 int EndSubmitEntries();
470 bool Filled()
const {
return(Graph_->Filled());};
499 int ExtractGlobalBlockRowPointers(
int BlockRow,
int MaxNumBlockEntries,
500 int & RowDim,
int & NumBlockEntries,
527 int ExtractMyBlockRowPointers(
int BlockRow,
int MaxNumBlockEntries,
528 int & RowDim,
int & NumBlockEntries,
549 int BeginExtractGlobalBlockRowCopy(
int BlockRow,
int MaxNumBlockEntries,
550 int & RowDim,
int & NumBlockEntries,
551 int * BlockIndices,
int * ColDims)
const;
570 int BeginExtractMyBlockRowCopy(
int BlockRow,
int MaxNumBlockEntries,
571 int & RowDim,
int & NumBlockEntries,
572 int * BlockIndices,
int * ColDims)
const;
590 int ExtractEntryCopy(
int SizeOfValues,
double * Values,
int LDA,
bool SumInto)
const;
605 int BeginExtractGlobalBlockRowView(
int BlockRow,
int & RowDim,
int & NumBlockEntries,
606 int * & BlockIndices)
const;
621 int BeginExtractMyBlockRowView(
int BlockRow,
int & RowDim,
int & NumBlockEntries,
622 int * & BlockIndices)
const;
650 int ExtractGlobalBlockRowView(
int BlockRow,
int & RowDim,
int & NumBlockEntries,
651 int * & BlockIndices,
669 int ExtractMyBlockRowView(
int BlockRow,
int & RowDim,
int & NumBlockEntries,
670 int * & BlockIndices,
694 int BeginExtractBlockDiagonalCopy(
int MaxNumBlockDiagonalEntries,
695 int & NumBlockDiagonalEntries,
int * RowColDims )
const;
712 int ExtractBlockDiagonalEntryCopy(
int SizeOfValues,
double * Values,
int LDA,
bool SumInto)
const;
723 int BeginExtractBlockDiagonalView(
int & NumBlockDiagonalEntries,
int * & RowColDims )
const;
736 int ExtractBlockDiagonalEntryView(
double * & Values,
int & LDA)
const;
855 int OptimizeStorage();
903 double NormFrobenius()
const;
926#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
932#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
944#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
965#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
971#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
977#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
983#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
989#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1025#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1028 if(RowMap().GlobalIndicesInt())
1029 return (
int) IndexBase64();
1030 throw "Epetra_VbrMatrix::IndexBase: GlobalIndices not int.";
1066#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1067 int LRID(
int GRID_in)
const {
return(Graph_->LRID(GRID_in));};
1069#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1070 int LRID(
long long GRID_in)
const {
return(Graph_->LRID(GRID_in));};
1074#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1075 int GRID(
int LRID_in)
const {
return(Graph_->GRID(LRID_in));};
1077 long long GRID64(
int LRID_in)
const {
return(Graph_->GRID64(LRID_in));};
1080#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1081 int LCID(
int GCID_in)
const {
return(Graph_->LCID(GCID_in));};
1083#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1084 int LCID(
long long GCID_in)
const {
return(Graph_->LCID(GCID_in));};
1088#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1089 int GCID(
int LCID_in)
const {
return(Graph_->GCID(LCID_in));};
1091 long long GCID64(
int LCID_in)
const {
return(Graph_->GCID64(LCID_in));};
1094#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1095 bool MyGRID(
int GRID_in)
const {
return(Graph_->MyGRID(GRID_in));};
1097#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1098 bool MyGRID(
long long GRID_in)
const {
return(Graph_->MyGRID(GRID_in));};
1102 bool MyLRID(
int LRID_in)
const {
return(Graph_->MyLRID(LRID_in));};
1105#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1106 bool MyGCID(
int GCID_in)
const {
return(Graph_->MyGCID(GCID_in));};
1108#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1109 bool MyGCID(
long long GCID_in)
const {
return(Graph_->MyGCID(GCID_in));};
1113 bool MyLCID(
int LCID_in)
const {
return(Graph_->MyLCID(LCID_in));};
1116#ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1119#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1128 virtual void Print(std::ostream & os)
const;
1185 if (!HavePointObjects_) GeneratePointObjects();
1187 else return(*OperatorDomainMap_);
1193 if (!HavePointObjects_) GeneratePointObjects();
1195 else return(*OperatorRangeMap_);
1217 int ExtractGlobalRowCopy(
int GlobalRow,
int Length,
int & NumEntries,
double *Values,
int * Indices)
const;
1234 int ExtractMyRowCopy(
int MyRow,
int Length,
int & NumEntries,
double *Values,
int * Indices)
const;
1255 {
if (!HavePointObjects_) GeneratePointObjects();
return(*RowMatrixRowMap_); };
1259 {
if (!HavePointObjects_) GeneratePointObjects();
return(*RowMatrixColMap_); };
1263 {
if (!HavePointObjects_) GeneratePointObjects();
return(RowMatrixImporter_); };
1274 int TransformToLocal();
1281 void DeleteMemory();
1290 void InitializeDefaults();
1292 int BeginInsertValues(
int BlockRow,
int NumBlockEntries,
1293 int * BlockIndices,
bool IndicesAreLocal);
1294 int BeginReplaceValues(
int BlockRow,
int NumBlockEntries,
1295 int *BlockIndices,
bool IndicesAreLocal);
1296 int BeginSumIntoValues(
int BlockRow,
int NumBlockEntries,
1297 int *BlockIndices,
bool IndicesAreLocal);
1298 int SetupForSubmits(
int BlockRow,
int NumBlockEntries,
int * BlockIndices,
1300 int EndReplaceSumIntoValues();
1301 int EndInsertValues();
1303 int CopyMat(
double * A,
int LDA,
int NumRows,
int NumCols,
1304 double * B,
int LDB,
bool SumInto)
const;
1305 int BeginExtractBlockRowCopy(
int BlockRow,
int MaxNumBlockEntries,
1306 int & RowDim,
int & NumBlockEntries,
1307 int * BlockIndices,
int * ColDims,
1308 bool IndicesAreLocal)
const;
1309 int SetupForExtracts(
int BlockRow,
int & RowDim,
int NumBlockEntries,
1310 bool ExtractView,
bool IndicesAreLocal)
const;
1311 int ExtractBlockDimsCopy(
int NumBlockEntries,
int * ColDims)
const;
1312 int ExtractBlockRowPointers(
int BlockRow,
int MaxNumBlockEntries,
1313 int & RowDim,
int & NumBlockEntries,
1316 bool IndicesAreLocal)
const;
1317 int BeginExtractBlockRowView(
int BlockRow,
int & RowDim,
int & NumBlockEntries,
1318 int * & BlockIndices,
1319 bool IndicesAreLocal)
const;
1320 int CopyMatDiag(
double * A,
int LDA,
int NumRows,
int NumCols,
1321 double * Diagonal)
const;
1322 int ReplaceMatDiag(
double * A,
int LDA,
int NumRows,
int NumCols,
1327 void BlockRowMultiply(
bool TransA,
int RowDim,
int NumEntries,
1328 int * BlockIndices,
int RowOff,
1329 int * FirstPointInElementList,
int * ElementSizeList,
1331 double ** X,
double Beta,
double ** Y,
int NumVectors)
const;
1336 void BlockRowMultiply(
bool TransA,
int RowDim,
int NumEntries,
1337 int * BlockIndices,
int RowOff,
1338 int * FirstPointInElementList,
1339 int * ElementSizeList,
1341 double ** X,
double ** Y,
int NumVectors)
const;
1345 void FastBlockRowMultiply(
bool TransA,
int RowDim,
int NumEntries,
1346 int * BlockIndices,
int RowOff,
1347 int * FirstPointInElementList,
1348 int * ElementSizeList,
1350 double ** X,
double ** Y,
int NumVectors)
const;
1354 void BlockRowNormInf(
int RowDim,
int NumEntries,
1357 void BlockRowNormOne(
int RowDim,
int NumEntries,
int * BlockRowIndices,
1359 int * ColFirstPointInElementList,
double * x)
const;
1367 int * PermuteToLIDs,
1368 int *PermuteFromLIDs,
1396 bool Sorted()
const {
return(Graph_->Sorted());};
1399 int MergeRedundantEntries();
1406 int GeneratePointObjects()
const;
Epetra_BLAS: The Epetra BLAS Wrapper Class.
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
Epetra_Comm: The Epetra Communication Abstract Base Class.
Epetra_CompObject: Functionality and data that is common to all computational classes.
Epetra_CrsGraph: A class for constructing and using sparse compressed row graphs.
Epetra_DistObject: A class for constructing and using dense multi-vectors, vectors and matrices in pa...
const Epetra_BlockMap & Map() const
Returns the address of the Epetra_BlockMap for this multi-vector.
virtual int CheckSizes(const Epetra_SrcDistObject &Source)=0
Allows the source and target (this) objects to be compared for compatibility, return nonzero if not.
virtual int UnpackAndCombine(const Epetra_SrcDistObject &Source, int NumImportIDs, int *ImportLIDs, int LenImports, char *Imports, int &SizeOfPacket, Epetra_Distributor &Distor, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor)=0
Perform any unpacking and combining after call to DoTransfer().
virtual int PackAndPrepare(const Epetra_SrcDistObject &Source, int NumExportIDs, int *ExportLIDs, int &LenExports, char *&Exports, int &SizeOfPacket, int *Sizes, bool &VarSizes, Epetra_Distributor &Distor)=0
Perform any packing or preparation required for call to DoTransfer().
virtual int CopyAndPermute(const Epetra_SrcDistObject &Source, int NumSameIDs, int NumPermuteIDs, int *PermuteToLIDs, int *PermuteFromLIDs, const Epetra_OffsetIndex *Indexor, Epetra_CombineMode CombineMode=Zero)=0
Perform ID copies and permutations that are on processor.
Epetra_DistObject & operator=(const Epetra_DistObject &src)
virtual void Print(std::ostream &os) const
Print method.
Epetra_Distributor: The Epetra Gather/Scatter Setup Base Class.
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements.
Epetra_Import: This class builds an import object for efficient importing of off-processor elements.
Epetra_Map: A class for partitioning vectors and matrices.
Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
virtual const char * Label() const
Epetra_Object Label access funtion.
Epetra_OffsetIndex: This class builds index for efficient mapping of data from one Epetra_CrsGraph ba...
virtual int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
Returns the result of a Epetra_Operator applied to a Epetra_MultiVector X in Y.
virtual int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
Returns the result of a Epetra_Operator inverse applied to an Epetra_MultiVector X in Y.
virtual bool UseTranspose() const =0
Returns the current UseTranspose setting.
Epetra_RowMatrix: A pure virtual class for using real-valued double-precision row matrices.
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
Returns the result of a Epetra_RowMatrix multiplied by a Epetra_MultiVector X in Y.
virtual int ExtractDiagonalCopy(Epetra_Vector &Diagonal) const =0
Returns a copy of the main diagonal in a user-provided vector.
virtual int NumMyRowEntries(int MyRow, int &NumEntries) const =0
Returns the number of nonzero entries in MyRow.
virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
Returns result of a local-only solve using a triangular Epetra_RowMatrix with Epetra_MultiVectors X a...
virtual int MaxNumEntries() const =0
Returns the maximum of NumMyRowEntries() over all rows.
virtual int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const =0
Returns a copy of the specified local row in user-provided arrays.
virtual int InvRowSums(Epetra_Vector &x) const =0
Computes the sum of absolute values of the rows of the Epetra_RowMatrix, results returned in x.
virtual int RightScale(const Epetra_Vector &x)=0
Scales the Epetra_RowMatrix on the right with a Epetra_Vector x.
virtual double NormOne() const =0
Returns the one norm of the global matrix.
virtual double NormInf() const =0
Returns the infinity norm of the global matrix.
virtual int InvColSums(Epetra_Vector &x) const =0
Computes the sum of absolute values of the columns of the Epetra_RowMatrix, results returned in x.
virtual int LeftScale(const Epetra_Vector &x)=0
Scales the Epetra_RowMatrix on the left with a Epetra_Vector x.
Epetra_SerialDenseMatrix: A class for constructing and using real double precision general dense matr...
Epetra_SrcDistObject: A class for supporting flexible source distributed objects for import/export op...
Epetra_VbrMatrix: A class for the construction and use of real-valued double-precision variable block...
const Epetra_Export * Exporter() const
Returns the Epetra_Export object that contains the export operations for distributed operations.
bool IndicesAreLocal() const
If matrix indices has been transformed to local, this query returns true, otherwise it returns false.
int * NumBlockEntriesPerRow_
int MaxColDim() const
Returns the maximum column dimension of all block entries on this processor.
int NumMyBlockEntries() const
Returns the number of nonzero block entries in the calling processor's portion of the matrix.
bool UpperTriangular() const
If matrix is upper triangular in local index space, this query returns true, otherwise it returns fal...
long long NumGlobalCols64() const
int LRID(int GRID_in) const
Returns the local row index for given global row index, returns -1 if no local row for this global ro...
int NumGlobalBlockEntries() const
Returns the number of nonzero block entries in the global matrix.
long long NumGlobalBlockRows64() const
Epetra_Import * RowMatrixImporter_
int MaxNumNonzeros() const
Returns the maximum number of nonzero entries across all block rows on this processor.
int LRID(long long GRID_in) const
bool Filled() const
If FillComplete() has been called, this query returns true, otherwise it returns false.
Epetra_MultiVector * OperatorX_
long long GRID64(int LRID_in) const
int NumMyNonzeros() const
Returns the number of nonzero entriesowned by the calling processor .
const Epetra_BlockMap & Map() const
Map() method inherited from Epetra_DistObject.
int * FirstPointInElementList_
bool NoDiagonal() const
If matrix has no diagonal entries based on global row/column index comparisons, this query returns tr...
int CurExtractNumBlockEntries_
int GlobalMaxRowDim() const
Returns the maximum row dimension of all block entries across all processors.
long long NumGlobalBlockDiagonals64() const
bool MyGlobalBlockRow(int GID) const
Returns true of GID is owned by the calling processor, otherwise it returns false.
bool HasNormInf() const
Returns true because this class can compute an Inf-norm.
int MaxRowDim() const
Returns the maximum row dimension of all block entries on this processor.
int GlobalMaxNumBlockEntries() const
Returns the maximum number of nonzero entries across all rows on this processor.
bool MyGlobalBlockRow(long long GID) const
Epetra_MultiVector * ImportVector_
bool MyGRID(int GRID_in) const
Returns true if the GRID passed in belongs to the calling processor in this map, otherwise returns fa...
int LCID(int GCID_in) const
Returns the local column index for given global column index, returns -1 if no local column for this ...
bool constructedWithFilledGraph_
bool NoRedundancies() const
If MergeRedundantEntries() has been called, this query returns true, otherwise it returns false.
bool UseTranspose() const
Returns the current UseTranspose setting.
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator.
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.
bool MyLCID(int LCID_in) const
Returns true if the LRID passed in belongs to the calling processor in this map, otherwise returns fa...
int NumMyRows() const
Returns the number of matrix rows owned by the calling processor.
int NumGlobalDiagonals() const
Returns the number of global nonzero diagonal entries, based on global row/column index comparisions.
const Epetra_CrsGraph & Graph() const
Returns a pointer to the Epetra_CrsGraph object associated with this matrix.
bool IndicesAreGlobal() const
If matrix indices has not been transformed to local, this query returns true, otherwise it returns fa...
long long IndexBase64() const
const Epetra_Comm & Comm() const
Fills a matrix with rows from a source matrix based on the specified importer.
int NumMyBlockDiagonals() const
Returns the number of local nonzero block diagonal entries, based on global row/column index comparis...
int NumAllocatedMyBlockEntries(int Row) const
Returns the allocated number of nonzero Block entries in specified local row on this processor.
long long NumGlobalBlockEntries64() const
int MaxNumBlockEntries() const
Returns the maximum number of nonzero entries across all rows on this processor.
int SetAllocated(bool Flag)
bool Sorted() const
If SortEntries() has been called, this query returns true, otherwise it returns false.
const Epetra_Import * RowMatrixImporter() const
Returns the Epetra_Import object that contains the import operations for distributed operations.
bool squareFillCompleteCalled_
const Epetra_Import * Importer() const
Returns the Epetra_Import object that contains the import operations for distributed operations.
int NumMyBlockCols() const
Returns the number of Block matrix columns owned by the calling processor.
const Epetra_BlockMap & ColMap() const
Returns the ColMap as an Epetra_BlockMap (the Epetra_Map base class) needed for implementing Epetra_R...
Epetra_Map * RowMatrixRowMap_
int NumMyBlockRows() const
Returns the number of Block matrix rows owned by the calling processor.
int NumGlobalCols() const
Returns the number of global matrix columns.
long long NumGlobalBlockCols64() const
int LCID(long long GCID_in) const
Epetra_MultiVector * ExportVector_
bool MyGRID(long long GRID_in) const
int NumMyCols() const
Returns the number of matrix columns owned by the calling processor.
bool IndicesAreContiguous() const
If matrix indices are packed into single array (done in OptimizeStorage()) return true,...
bool LowerTriangular() const
If matrix is lower triangular in local index space, this query returns true, otherwise it returns fal...
int SetUseTranspose(bool UseTranspose_in)
If set true, transpose of this operator will be applied.
const Epetra_BlockMap & BlockImportMap() const
Use BlockColMap() instead.
long long NumGlobalNonzeros64() const
int NumGlobalBlockEntries(int Row) const
Returns the current number of nonzero Block entries in specified global row on this processor.
bool MyGCID(int GCID_in) const
Returns true if the GCID passed in belongs to the calling processor in this map, otherwise returns fa...
int GCID(int LCID_in) const
Returns the global column index for give local column index, returns IndexBase-1 if we don't have thi...
Epetra_SerialDenseMatrix *** Values() const
int NumAllocatedGlobalBlockEntries(int Row) const
Returns the allocated number of nonzero Block entries in specified global row on this processor.
int NumGlobalBlockRows() const
Returns the number of global Block matrix rows.
int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_Vector &x, Epetra_Vector &y) const
Returns the result of a solve using the Epetra_VbrMatrix on a Epetra_Vector x in y.
const Epetra_Map & RowMatrixColMap() const
Returns the Epetra_Map object associated with columns of this matrix.
const Epetra_BlockMap & RowMap() const
Returns the RowMap object as an Epetra_BlockMap (the Epetra_Map base class) needed for implementing E...
int GRID(int LRID_in) const
Returns the global row index for give local row index, returns IndexBase-1 if we don't have this loca...
bool StorageOptimized() const
If OptimizeStorage() has been called, this query returns true, otherwise it returns false.
bool CurExtractIndicesAreLocal_
Epetra_SerialDenseMatrix *** Entries_
int NumGlobalBlockDiagonals() const
Returns the number of global nonzero block diagonal entries, based on global row/column index compari...
int NumMyBlockEntries(int Row) const
Returns the current number of nonzero Block entries in specified local row on this processor.
Epetra_Map * OperatorDomainMap_
Epetra_SerialDenseMatrix ** TempEntries_
int NumGlobalNonzeros() const
Returns the number of nonzero entries in the global matrix.
const Epetra_BlockMap & RangeMap() const
Returns the Epetra_BlockMap object associated with the range of this matrix operator.
Epetra_Map * OperatorRangeMap_
bool matrixFillCompleteCalled_
long long NumGlobalDiagonals64() const
void SetStaticGraph(bool Flag)
bool MyLRID(int LRID_in) const
Returns true if the LRID passed in belongs to the calling processor in this map, otherwise returns fa...
Epetra_Map * RowMatrixColMap_
int NumGlobalBlockCols() const
Returns the number of global Block matrix columns.
long long GCID64(int LCID_in) const
int GlobalMaxColDim() const
Returns the maximum column dimension of all block entries across all processors.
const Epetra_Map & RowMatrixRowMap() const
Returns the EpetraMap object associated with the rows of this matrix.
long long NumGlobalRows64() const
int IndexBase() const
Returns the index base for row and column indices for this graph.
Epetra_CombineMode CurSubmitMode_
double * All_Values_Orig_
int NumMyDiagonals() const
Returns the number of local nonzero diagonal entries, based on global row/column index comparisons.
bool MyGCID(long long GCID_in) const
int * NumAllocatedBlockEntriesPerRow_
int NumGlobalRows() const
Returns the number of global matrix rows.
int GlobalMaxNumNonzeros() const
Returns the maximum number of nonzero entries across all block rows on all processors.
const Epetra_BlockMap & DomainMap() const
Returns the Epetra_BlockMap object associated with the domain of this matrix operator.
const char * Label() const
Returns a character string describing the operator.
Epetra_MultiVector * OperatorY_
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.