44 #include <Epetra_VbrMatrix.h> 45 #include <Epetra_CrsGraph.h> 46 #include <Epetra_Map.h> 47 #include <Epetra_BlockMap.h> 48 #include <Epetra_MultiVector.h> 49 #include <Epetra_LinearProblem.h> 51 #include <Epetra_SerialDenseMatrix.h> 52 #include <Epetra_SerialDenseVector.h> 53 #include <Epetra_SerialDenseSVD.h> 82 Epetra_VbrMatrix * OrigMatrix =
dynamic_cast<Epetra_VbrMatrix*
>( orig.GetMatrix() );
84 if( OrigMatrix->RowMap().DistributedGlobal() )
85 { std::cout <<
"FAIL for Global!\n"; abort(); }
86 if( OrigMatrix->IndicesAreGlobal() )
87 { std::cout <<
"FAIL for Global Indices!\n"; abort(); }
107 SVDs_[i] =
new Epetra_SerialDenseSVD();
117 Inverses_[i] =
new Epetra_SerialDenseMatrix( Copy, &inv, 1, 1, 1 );
123 std::cout <<
"SVDs and Inverses!\n";
126 std::cout <<
"Block: " << i <<
" Size: " <<
VbrBlockDim_[i] << std::endl;
128 std::cout << *(
Inverses_[i]) << std::endl;
132 Epetra_MultiVector * RHS = orig.GetRHS();
135 RHS->ExtractView( &A, &LDA );
136 double * currLoc = A;
155 std::cout <<
"-------------------\n";
156 std::cout <<
"BlockJacobi\n";
157 std::cout <<
"-------------------\n";
163 std::multiset<double> SVs;
170 if(
SVDs_[i]->S()[0] > MaxSV ) MaxSV =
SVDs_[i]->S()[0];
177 MaxSV = std::max( MaxSV, 1.0 );
181 std::multiset<double>::iterator iterSI = SVs.begin();
182 std::multiset<double>::iterator endSI = SVs.end();
186 std::cout << std::endl;
187 std::cout <<
"Singular Values\n";
188 for( ; iterSI != endSI; ++iterSI, i++ ) std::cout << i <<
"\t" << *iterSI << std::endl;
189 std::cout << std::endl;
192 Epetra_VbrMatrix * OrigMatrix =
dynamic_cast<Epetra_VbrMatrix*
>(
origObj_->GetMatrix() );
198 abs_thresh = MaxSV * rel_thresh;
205 SVDs_[i]->Invert( rel_thresh, abs_thresh );
214 Epetra_SerialDenseMatrix tempMat( *(
VbrBlocks_[i][j]) );
218 Epetra_SerialDenseMatrix tempMat2( *(
RHSBlocks_[i]) );
223 std::cout <<
"DiagBlock: " << i << std::endl;
225 std::cout <<
"RHSBlock: " << i << std::endl;
232 std::cout <<
"Block Jacobi'd Matrix!\n";
234 else std::cout << *(dynamic_cast<Epetra_VbrMatrix*>(
origObj_->GetMatrix())) << std::endl;
235 std::cout <<
"Block Jacobi'd RHS!\n";
237 std::cout << std::endl;
242 std::cout <<
"Min Singular Value: " << MinSV << std::endl;
243 std::cout <<
"Max Singular Value: " << MaxSV << std::endl;
244 std::cout <<
"--------------------\n";
bool fwd()
Forward transfer of data from orig object input in the operator() method call to the new object creat...
bool rvs()
Reverse transfer of data from new object created in the operator() method call to the orig object inp...
EpetraExt::BlockCrsMatrix: A class for constructing a distributed block matrix.
Epetra_LinearProblem * NewProblem_
std::vector< int > VbrBlockDim_
~LinearProblem_BlockJacobi()
std::vector< int > VbrBlockCnt_
NewTypeRef operator()(OriginalTypeRef orig)
std::vector< Epetra_SerialDenseMatrix * > RHSBlocks_
Epetra_VbrMatrix * NewMatrix_
std::vector< int * > VbrBlockIndices_
std::vector< Epetra_SerialDenseMatrix ** > VbrBlocks_
std::vector< Epetra_SerialDenseMatrix * > Inverses_
std::vector< Epetra_SerialDenseSVD * > SVDs_