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
1026 int IndexBase()
const {
1028 if(RowMap().GlobalIndicesInt())
1029 return (
int) IndexBase64();
1030 throw "Epetra_VbrMatrix::IndexBase: GlobalIndices not int.";
1065 #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;
1482 #if defined(Epetra_SHOW_DEPRECATED_WARNINGS)
1484 #warning "The Epetra package is deprecated"
const Epetra_Import * Importer() const
Returns the Epetra_Import object that contains the import operations for distributed operations...
Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
int NumMyBlockEntries(int Row) const
Returns the current number of nonzero Block entries in specified local row on this processor...
bool MyGlobalBlockRow(long long GID) const
int SetUseTranspose(bool UseTranspose_in)
If set true, transpose of this operator will be applied.
long long IndexBase64() const
Epetra_Map: A class for partitioning vectors and matrices.
int MaxNumNonzeros() const
Returns the maximum number of nonzero entries across all block rows on this processor.
const Epetra_Import * RowMatrixImporter() const
Returns the Epetra_Import object that contains the import operations for distributed operations...
const Epetra_BlockMap & RangeMap() const
Returns the Epetra_BlockMap object associated with the range of this matrix operator.
virtual int RightScale(const Epetra_Vector &x)=0
Scales the Epetra_RowMatrix on the right with a Epetra_Vector x.
const Epetra_Map & RowMatrixColMap() const
Returns the Epetra_Map object associated with columns of this matrix.
int SetAllocated(bool Flag)
int NumGlobalCols() const
Returns the number of global matrix columns.
virtual double NormOne() const =0
Returns the one norm of the global matrix.
bool CurExtractIndicesAreLocal_
Epetra_Distributor: The Epetra Gather/Scatter Setup Base Class.
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_OffsetIndex: This class builds index for efficient mapping of data from one Epetra_CrsGraph ba...
const Epetra_CrsGraph & Graph() const
Returns a pointer to the Epetra_CrsGraph object associated with this matrix.
long long NumGlobalDiagonals64() const
bool NoDiagonal() const
If matrix has no diagonal entries based on global row/column index comparisons, this query returns tr...
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 void Print(std::ostream &os) const
Print method.
bool NoRedundancies() const
If MergeRedundantEntries() has been called, this query returns true, otherwise it returns false...
long long NumGlobalBlockDiagonals64() const
const Epetra_BlockMap & ColMap() const
Returns the ColMap as an Epetra_BlockMap (the Epetra_Map base class) needed for implementing Epetra_R...
const Epetra_BlockMap & BlockImportMap() const
Use BlockColMap() instead.
void SetStaticGraph(bool Flag)
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 NumGlobalBlockEntries(int Row) const
Returns the current number of nonzero Block entries in specified global row on this processor...
bool IndicesAreGlobal() const
If matrix indices has not been transformed to local, this query returns true, otherwise it returns fa...
Epetra_SerialDenseMatrix *** Values() const
int NumMyRows() const
Returns the number of matrix rows owned by the calling processor.
int NumMyBlockRows() const
Returns the number of Block matrix rows owned by the calling processor.
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements...
bool squareFillCompleteCalled_
Epetra_VbrMatrix: A class for the construction and use of real-valued double-precision variable block...
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
virtual int ExtractDiagonalCopy(Epetra_Vector &Diagonal) const =0
Returns a copy of the main diagonal in a user-provided vector.
virtual int LeftScale(const Epetra_Vector &x)=0
Scales the Epetra_RowMatrix on the left with a Epetra_Vector x.
bool matrixFillCompleteCalled_
int * NumAllocatedBlockEntriesPerRow_
Epetra_CompObject & operator=(const Epetra_CompObject &src)
const Epetra_Export * Exporter() const
Returns the Epetra_Export object that contains the export operations for distributed operations...
Epetra_SerialDenseMatrix: A class for constructing and using real double precision general dense matr...
double * All_Values_Orig_
Epetra_Import: This class builds an import object for efficient importing of off-processor elements...
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 * OperatorRangeMap_
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...
int NumGlobalBlockCols() const
Returns the number of global Block matrix columns.
bool MyGCID(long long GCID_in) const
bool Filled() const
If FillComplete() has been called, this query returns true, otherwise it returns false.
bool UseTranspose() const
Returns the current UseTranspose setting.
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...
virtual int CheckSizes(const Epetra_SrcDistObject &Source)=0
Allows the source and target (this) objects to be compared for compatibility, return nonzero if not...
bool StorageOptimized() const
If OptimizeStorage() has been called, this query returns true, otherwise it returns false...
const Epetra_Comm & Comm() const
Fills a matrix with rows from a source matrix based on the specified importer.
int MaxColDim() const
Returns the maximum column dimension of all block entries on this processor.
bool MyGRID(long long GRID_in) const
Epetra_Map * RowMatrixRowMap_
const Epetra_BlockMap & Map() const
Map() method inherited from Epetra_DistObject.
long long GRID64(int LRID_in) const
bool LowerTriangular() const
If matrix is lower triangular in local index space, this query returns true, otherwise it returns fal...
Epetra_MultiVector * ImportVector_
int LCID(long long GCID_in) const
Epetra_BLAS: The Epetra BLAS Wrapper Class.
const Epetra_BlockMap & DomainMap() const
Returns the Epetra_BlockMap object associated with the domain of this matrix operator.
virtual int NumMyRowEntries(int MyRow, int &NumEntries) const =0
Returns the number of nonzero entries in MyRow.
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 MaxNumEntries() const =0
Returns the maximum of NumMyRowEntries() over all rows.
virtual const char * Label() const
Epetra_Object Label access funtion.
long long NumGlobalBlockEntries64() const
int GlobalMaxColDim() const
Returns the maximum column dimension of all block entries across all processors.
Epetra_MultiVector * OperatorY_
Epetra_Comm: The Epetra Communication Abstract Base Class.
int NumMyNonzeros() const
Returns the number of nonzero entriesowned by the calling processor .
virtual bool UseTranspose() const =0
Returns the current UseTranspose setting.
int GlobalMaxNumBlockEntries() const
Returns the maximum number of nonzero entries across all rows on this processor.
long long NumGlobalBlockRows64() const
int NumMyBlockDiagonals() const
Returns the number of local nonzero block diagonal entries, based on global row/column index comparis...
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 CurExtractNumBlockEntries_
Epetra_MultiVector * ExportVector_
int NumGlobalBlockEntries() const
Returns the number of nonzero block entries in the global matrix.
int * FirstPointInElementList_
Epetra_CompObject: Functionality and data that is common to all computational classes.
virtual double NormInf() const =0
Returns the infinity norm of the global matrix.
bool constructedWithFilledGraph_
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().
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
int * NumBlockEntriesPerRow_
const Epetra_BlockMap & RowMap() const
Returns the RowMap object as an Epetra_BlockMap (the Epetra_Map base class) needed for implementing E...
int NumGlobalDiagonals() const
Returns the number of global nonzero diagonal entries, based on global row/column index comparisions...
bool MyGlobalBlockRow(int GID) const
Returns true of GID is owned by the calling processor, otherwise it returns false.
int MaxRowDim() const
Returns the maximum row dimension of all block entries on this processor.
bool IndicesAreLocal() const
If matrix indices has been transformed to local, this query returns true, otherwise it returns false...
int GlobalMaxRowDim() const
Returns the maximum row dimension of all block entries across all processors.
int NumMyCols() const
Returns the number of matrix columns owned by the calling processor.
Epetra_Import * RowMatrixImporter_
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.
const Epetra_Map & RowMatrixRowMap() const
Returns the EpetraMap object associated with the rows of this matrix.
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 NumMyDiagonals() const
Returns the number of local nonzero diagonal entries, based on global row/column index comparisons...
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.
int GlobalMaxNumNonzeros() const
Returns the maximum number of nonzero entries across all block rows on all processors.
long long NumGlobalRows64() const
int LRID(long long GRID_in) const
int LCID(int GCID_in) const
Returns the local column index for given global column index, returns -1 if no local column for this ...
Epetra_CombineMode CurSubmitMode_
int NumGlobalRows() const
Returns the number of global matrix rows.
Epetra_SerialDenseMatrix *** Entries_
Epetra_Map * RowMatrixColMap_
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator. ...
Epetra_Map * OperatorDomainMap_
long long NumGlobalNonzeros64() const
bool UpperTriangular() const
If matrix is upper triangular in local index space, this query returns true, otherwise it returns fal...
int NumMyBlockCols() const
Returns the number of Block matrix columns owned by the calling processor.
long long NumGlobalBlockCols64() const
int NumAllocatedMyBlockEntries(int Row) const
Returns the allocated number of nonzero Block entries in specified local row on this processor...
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.
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...
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...
Epetra_SerialDenseMatrix ** TempEntries_
int NumAllocatedGlobalBlockEntries(int Row) const
Returns the allocated number of nonzero Block entries in specified global row on this processor...
Epetra_SrcDistObject: A class for supporting flexible source distributed objects for import/export op...
Epetra_MultiVector * OperatorX_
Epetra_RowMatrix: A pure virtual class for using real-valued double-precision row matrices...
bool HasNormInf() const
Returns true because this class can compute an Inf-norm.
bool IndicesAreContiguous() const
If matrix indices are packed into single array (done in OptimizeStorage()) return true...
int NumMyBlockEntries() const
Returns the number of nonzero block entries in the calling processor's portion of the matrix...
int MaxNumBlockEntries() const
Returns the maximum number of nonzero entries across all rows on this processor.
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...
long long NumGlobalCols64() const
const char * Label() const
Returns a character string describing the operator.
long long GCID64(int LCID_in) const
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 NumGlobalNonzeros() const
Returns the number of nonzero entries in the global matrix.
int NumGlobalBlockRows() const
Returns the number of global Block matrix rows.
int NumGlobalBlockDiagonals() const
Returns the number of global nonzero block diagonal entries, based on global row/column index compari...
Epetra_CrsGraph: A class for constructing and using sparse compressed row graphs. ...
bool Sorted() const
If SortEntries() has been called, this query returns true, otherwise it returns false.
Epetra_DistObject: A class for constructing and using dense multi-vectors, vectors and matrices in pa...
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().
const Epetra_BlockMap & Map() const
Returns the address of the Epetra_BlockMap for this multi-vector.