本文整理汇总了C++中teuchos::RCP::MaxNumEntries方法的典型用法代码示例。如果您正苦于以下问题:C++ RCP::MaxNumEntries方法的具体用法?C++ RCP::MaxNumEntries怎么用?C++ RCP::MaxNumEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::RCP
的用法示例。
在下文中一共展示了RCP::MaxNumEntries方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//==============================================================================
Ifpack2_ReorderFilter::Ifpack2_ReorderFilter(const Teuchos::RCP<Tpetra_RowMatrix>& Matrix_in,
const Teuchos::RCP<Ifpack2_Reordering>& Reordering_in) :
A_(Matrix_in),
Reordering_(Reordering_in),
NumMyRows_(Matrix_in->NumMyRows()),
MaxNumEntries_(Matrix_in->MaxNumEntries())
{
}
示例2: sprintf
//==============================================================================
Ifpack2_LocalFilter::Ifpack2_LocalFilter(const Teuchos::RCP<const Tpetra_RowMatrix>& Matrix) :
Matrix_(Matrix),
NumRows_(0),
NumNonzeros_(0),
MaxNumEntries_(0),
MaxNumEntriesA_(0)
{
sprintf(Label_,"%s","Ifpack2_LocalFilter");
#ifdef HAVE_MPI
SerialComm_ = Teuchos::rcp( new Tpetra_MpiComm(MPI_COMM_SELF) );
#else
SerialComm_ = Teuchos::rcp( new Tpetra_SerialComm );
#endif
// localized matrix has all the local rows of Matrix
NumRows_ = Matrix->NumMyRows();
// build a linear map, based on the serial communicator
Map_ = Teuchos::rcp( new Tpetra_Map(NumRows_,0,*SerialComm_) );
// NumEntries_ will contain the actual number of nonzeros
// for each localized row (that is, without external nodes,
// and always with the diagonal entry)
NumEntries_.resize(NumRows_);
// want to store the diagonal vector. FIXME: am I really useful?
Diagonal_ = Teuchos::rcp( new Tpetra_Vector(*Map_) );
if (Diagonal_ == Teuchos::null) IFPACK2_CHK_ERRV(-5);
// store this for future access to ExtractMyRowCopy().
// This is the # of nonzeros in the non-local matrix
MaxNumEntriesA_ = Matrix->MaxNumEntries();
// tentative value for MaxNumEntries. This is the number of
// nonzeros in the local matrix
MaxNumEntries_ = Matrix->MaxNumEntries();
// ExtractMyRowCopy() will use these vectors
Indices_.resize(MaxNumEntries_);
Values_.resize(MaxNumEntries_);
// now compute:
// - the number of nonzero per row
// - the total number of nonzeros
// - the diagonal entries
// compute nonzeros (total and per-row), and store the
// diagonal entries (already modified)
int ActualMaxNumEntries = 0;
for (int i = 0 ; i < NumRows_ ; ++i) {
NumEntries_[i] = 0;
int Nnz, NewNnz = 0;
IFPACK2_CHK_ERRV(ExtractMyRowCopy(i,MaxNumEntries_,Nnz,&Values_[0],&Indices_[0]));
for (int j = 0 ; j < Nnz ; ++j) {
if (Indices_[j] < NumRows_ ) ++NewNnz;
if (Indices_[j] == i)
(*Diagonal_)[i] = Values_[j];
}
if (NewNnz > ActualMaxNumEntries)
ActualMaxNumEntries = NewNnz;
NumNonzeros_ += NewNnz;
NumEntries_[i] = NewNnz;
}
MaxNumEntries_ = ActualMaxNumEntries;
}
示例3: run_test
//.........这里部分代码省略.........
// Maps for original object
const Epetra_Map &sourceRowMap = matrix->RowMap();
const Epetra_Map &sourceRangeMap = matrix->RangeMap();
// const Epetra_Map &sourceColMap = matrix->ColMap();
const Epetra_Map &sourceDomainMap = matrix->DomainMap();
int numCols = matrix->NumGlobalCols();
int nMyRows = sourceRowMap.NumMyElements();
int base = sourceRowMap.IndexBase();
// Compute vertex and edge weights
Isorropia::Epetra::CostDescriber costs;
Teuchos::RCP<Epetra_Vector> vptr;
Teuchos::RCP<Epetra_CrsMatrix> eptr;
Teuchos::RCP<Epetra_Vector> hyperEdgeWeights;
if (edgeWeightType != NO_APPLICATION_SUPPLIED_WEIGHTS){
if (partitioningType == GRAPH_PARTITIONING){
// Create graph edge weights.
eptr = Teuchos::rcp(new Epetra_CrsMatrix(*matrix));
if (vertexWeightType == SUPPLY_EQUAL_WEIGHTS){
eptr->PutScalar(1.0); // set all nonzeros to 1.0
}
else{
int maxRowSize = eptr->MaxNumEntries();
double *newVal = NULL;
if (maxRowSize > 0){
newVal = new double [maxRowSize];
for (int j=0; j<maxRowSize; j++){
newVal[j] = localProc + 1 + j;
}
}
int numEntries;
int *idx;
double *val;
for (int i=0; i<nMyRows; i++){
rc = eptr->ExtractMyRowView(i, numEntries, val, idx);
for (int j=0; j<numEntries; j++){
val[j] = newVal[j];
}
}
if (newVal) delete [] newVal;
}
eptr->FillComplete(sourceDomainMap, sourceRangeMap);
costs.setGraphEdgeWeights(eptr);
}
else{
// Create hyperedge weights. (Note that the list of hyperedges that a
// process provides weights for has no relation to the columns
// that it has non-zeroes for, or the rows that is has. Hypergraphs
// in general are not square. Also more than one process can provide
// a weight for the same edge. Zoltan combines the weights according
// to the value of the PHG_EDGE_WEIGHT_OPERATION parameter. The default
// for this parameter is to use the maximum edge weight provided by any
// process for a given hyperedge.)