44 #ifndef EPETRA_VBRMATRIX_H
45 #define EPETRA_VBRMATRIX_H
47 #if defined(Epetra_SHOW_DEPRECATED_WARNINGS)
49 #warning "The Epetra package is deprecated"
277 int PutScalar(
double ScalarConstant);
286 int Scale(
double ScalarConstant);
294 int DirectSubmitBlockEntry(
int GlobalBlockRow,
int GlobalBlockCol,
295 const double *values,
int LDA,
296 int NumRows,
int NumCols,
bool sum_into);
309 int BeginInsertGlobalValues(
int BlockRow,
324 int BeginInsertMyValues(
int BlockRow,
int NumBlockEntries,
int * BlockIndices);
337 int BeginReplaceGlobalValues(
int BlockRow,
int NumBlockEntries,
int *BlockIndices);
350 int BeginReplaceMyValues(
int BlockRow,
int NumBlockEntries,
int *BlockIndices);
363 int BeginSumIntoGlobalValues(
int BlockRow,
int NumBlockEntries,
int *BlockIndices);
376 int BeginSumIntoMyValues(
int BlockRow,
int NumBlockEntries,
int *BlockIndices);
403 int SubmitBlockEntry(
double *Values,
int LDA,
int NumRows,
int NumCols);
432 int EndSubmitEntries();
478 bool Filled()
const {
return(Graph_->Filled());};
507 int ExtractGlobalBlockRowPointers(
int BlockRow,
int MaxNumBlockEntries,
508 int & RowDim,
int & NumBlockEntries,
535 int ExtractMyBlockRowPointers(
int BlockRow,
int MaxNumBlockEntries,
536 int & RowDim,
int & NumBlockEntries,
557 int BeginExtractGlobalBlockRowCopy(
int BlockRow,
int MaxNumBlockEntries,
558 int & RowDim,
int & NumBlockEntries,
559 int * BlockIndices,
int * ColDims)
const;
578 int BeginExtractMyBlockRowCopy(
int BlockRow,
int MaxNumBlockEntries,
579 int & RowDim,
int & NumBlockEntries,
580 int * BlockIndices,
int * ColDims)
const;
598 int ExtractEntryCopy(
int SizeOfValues,
double * Values,
int LDA,
bool SumInto)
const;
613 int BeginExtractGlobalBlockRowView(
int BlockRow,
int & RowDim,
int & NumBlockEntries,
614 int * & BlockIndices)
const;
629 int BeginExtractMyBlockRowView(
int BlockRow,
int & RowDim,
int & NumBlockEntries,
630 int * & BlockIndices)
const;
658 int ExtractGlobalBlockRowView(
int BlockRow,
int & RowDim,
int & NumBlockEntries,
659 int * & BlockIndices,
677 int ExtractMyBlockRowView(
int BlockRow,
int & RowDim,
int & NumBlockEntries,
678 int * & BlockIndices,
702 int BeginExtractBlockDiagonalCopy(
int MaxNumBlockDiagonalEntries,
703 int & NumBlockDiagonalEntries,
int * RowColDims )
const;
720 int ExtractBlockDiagonalEntryCopy(
int SizeOfValues,
double * Values,
int LDA,
bool SumInto)
const;
731 int BeginExtractBlockDiagonalView(
int & NumBlockDiagonalEntries,
int * & RowColDims )
const;
744 int ExtractBlockDiagonalEntryView(
double * & Values,
int & LDA)
const;
863 int OptimizeStorage();
911 double NormFrobenius()
const;
934 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
940 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
952 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
973 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
979 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
985 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
991 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
997 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1033 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1034 int IndexBase()
const {
1036 if(RowMap().GlobalIndicesInt())
1037 return (
int) IndexBase64();
1038 throw "Epetra_VbrMatrix::IndexBase: GlobalIndices not int.";
1073 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1075 int LRID(
int GRID_in)
const {
return(Graph_->LRID(GRID_in));};
1077 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1078 int LRID(
long long GRID_in)
const {
return(Graph_->LRID(GRID_in));};
1082 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1083 int GRID(
int LRID_in)
const {
return(Graph_->GRID(LRID_in));};
1085 long long GRID64(
int LRID_in)
const {
return(Graph_->GRID64(LRID_in));};
1088 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1089 int LCID(
int GCID_in)
const {
return(Graph_->LCID(GCID_in));};
1091 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1092 int LCID(
long long GCID_in)
const {
return(Graph_->LCID(GCID_in));};
1096 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1097 int GCID(
int LCID_in)
const {
return(Graph_->GCID(LCID_in));};
1099 long long GCID64(
int LCID_in)
const {
return(Graph_->GCID64(LCID_in));};
1102 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1103 bool MyGRID(
int GRID_in)
const {
return(Graph_->MyGRID(GRID_in));};
1105 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1106 bool MyGRID(
long long GRID_in)
const {
return(Graph_->MyGRID(GRID_in));};
1110 bool MyLRID(
int LRID_in)
const {
return(Graph_->MyLRID(LRID_in));};
1113 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1114 bool MyGCID(
int GCID_in)
const {
return(Graph_->MyGCID(GCID_in));};
1116 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1117 bool MyGCID(
long long GCID_in)
const {
return(Graph_->MyGCID(GCID_in));};
1121 bool MyLCID(
int LCID_in)
const {
return(Graph_->MyLCID(LCID_in));};
1124 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1127 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1136 virtual void Print(std::ostream & os)
const;
1193 if (!HavePointObjects_) GeneratePointObjects();
1195 else return(*OperatorDomainMap_);
1201 if (!HavePointObjects_) GeneratePointObjects();
1203 else return(*OperatorRangeMap_);
1225 int ExtractGlobalRowCopy(
int GlobalRow,
int Length,
int & NumEntries,
double *Values,
int * Indices)
const;
1242 int ExtractMyRowCopy(
int MyRow,
int Length,
int & NumEntries,
double *Values,
int * Indices)
const;
1263 {
if (!HavePointObjects_) GeneratePointObjects();
return(*RowMatrixRowMap_); };
1267 {
if (!HavePointObjects_) GeneratePointObjects();
return(*RowMatrixColMap_); };
1271 {
if (!HavePointObjects_) GeneratePointObjects();
return(RowMatrixImporter_); };
1282 int TransformToLocal();
1289 void DeleteMemory();
1298 void InitializeDefaults();
1300 int BeginInsertValues(
int BlockRow,
int NumBlockEntries,
1301 int * BlockIndices,
bool IndicesAreLocal);
1302 int BeginReplaceValues(
int BlockRow,
int NumBlockEntries,
1303 int *BlockIndices,
bool IndicesAreLocal);
1304 int BeginSumIntoValues(
int BlockRow,
int NumBlockEntries,
1305 int *BlockIndices,
bool IndicesAreLocal);
1306 int SetupForSubmits(
int BlockRow,
int NumBlockEntries,
int * BlockIndices,
1308 int EndReplaceSumIntoValues();
1309 int EndInsertValues();
1311 int CopyMat(
double *
A,
int LDA,
int NumRows,
int NumCols,
1312 double *
B,
int LDB,
bool SumInto)
const;
1313 int BeginExtractBlockRowCopy(
int BlockRow,
int MaxNumBlockEntries,
1314 int & RowDim,
int & NumBlockEntries,
1315 int * BlockIndices,
int * ColDims,
1316 bool IndicesAreLocal)
const;
1317 int SetupForExtracts(
int BlockRow,
int & RowDim,
int NumBlockEntries,
1318 bool ExtractView,
bool IndicesAreLocal)
const;
1319 int ExtractBlockDimsCopy(
int NumBlockEntries,
int * ColDims)
const;
1320 int ExtractBlockRowPointers(
int BlockRow,
int MaxNumBlockEntries,
1321 int & RowDim,
int & NumBlockEntries,
1324 bool IndicesAreLocal)
const;
1325 int BeginExtractBlockRowView(
int BlockRow,
int & RowDim,
int & NumBlockEntries,
1326 int * & BlockIndices,
1327 bool IndicesAreLocal)
const;
1328 int CopyMatDiag(
double *
A,
int LDA,
int NumRows,
int NumCols,
1329 double * Diagonal)
const;
1330 int ReplaceMatDiag(
double *
A,
int LDA,
int NumRows,
int NumCols,
1335 void BlockRowMultiply(
bool TransA,
int RowDim,
int NumEntries,
1336 int * BlockIndices,
int RowOff,
1337 int * FirstPointInElementList,
int * ElementSizeList,
1339 double ** X,
double Beta,
double ** Y,
int NumVectors)
const;
1344 void BlockRowMultiply(
bool TransA,
int RowDim,
int NumEntries,
1345 int * BlockIndices,
int RowOff,
1346 int * FirstPointInElementList,
1347 int * ElementSizeList,
1349 double ** X,
double ** Y,
int NumVectors)
const;
1353 void FastBlockRowMultiply(
bool TransA,
int RowDim,
int NumEntries,
1354 int * BlockIndices,
int RowOff,
1355 int * FirstPointInElementList,
1356 int * ElementSizeList,
1358 double ** X,
double ** Y,
int NumVectors)
const;
1362 void BlockRowNormInf(
int RowDim,
int NumEntries,
1365 void BlockRowNormOne(
int RowDim,
int NumEntries,
int * BlockRowIndices,
1367 int * ColFirstPointInElementList,
double * x)
const;
1375 int * PermuteToLIDs,
1376 int *PermuteFromLIDs,
1404 bool Sorted()
const {
return(Graph_->Sorted());};
1407 int MergeRedundantEntries();
1414 int GeneratePointObjects()
const;
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.