2 #include "RBGen_LapackPOD.h"
3 #include "Epetra_BLAS.h"
4 #include "Epetra_Export.h"
5 #include "Epetra_Import.h"
6 #include "Epetra_LAPACK.h"
7 #include "Epetra_Time.h"
8 #include "Epetra_Map.h"
11 #include "Epetra_MpiComm.h"
13 #include "Epetra_SerialComm.h"
19 isInitialized_( false ),
32 if ( rbmethod_params.
get(
"Basis Size", 16) < ss->NumVectors() ) {
33 basis_size_ = rbmethod_params.
get(
"Basis Size", 16);
36 basis_size_ = ss->NumVectors();
39 sv_.resize( ss->NumVectors() );
56 int num_vecs = ss_->NumVectors();
57 int dim = ss_->GlobalLength();
69 if ( comm.
MyPID() == 0 ) {
70 Proc0Map =
new Epetra_Map( dim, dim, 0, comm );
82 Proc0MV.Export(*ss_, exporter,
Insert);
84 if ( comm.
MyPID() == 0 ) {
91 double U[ 1 ], Vt[ 1 ];
92 lwork = EPETRA_MAX( 3*num_vecs + dim, 5*num_vecs );
93 std::vector<double> work( lwork );
99 lapack.
GESVD(
'O',
'N', dim, num_vecs, Proc0MV.Values(), Proc0MV.Stride(), &sv_[0], U, 1, Vt, 1, &work[0], &lwork, &info );
103 std::cout<<
"The return value of the SVD is not 0!"<< std::endl;
109 comm.
Broadcast( &sv_[0], basis_size_, 0 );
118 Epetra_Import importer( basis_->Map(), Proc0MV_front.Map() );
119 basis_->Import(Proc0MV_front, importer,
Insert);
132 double U[ 1 ], Vt[ 1 ];
133 lwork = EPETRA_MAX( 3*num_vecs + dim, 5*num_vecs );
134 std::vector<double> work( lwork );
140 lapack.
GESVD(
'O',
'N', dim, num_vecs, ss_->Values(), ss_->Stride(), &sv_[0], U, 1, Vt, 1, &work[0], &lwork, &info );
144 std::cout<<
"The return value of the SVD is not 0!"<< std::endl;
146 sv_.resize( basis_size_ );
void Initialize(const Teuchos::RCP< Teuchos::ParameterList > ¶ms, const Teuchos::RCP< const Epetra_MultiVector > &ss, const Teuchos::RCP< RBGen::FileIOHandler< Epetra_Operator > > &fileio=Teuchos::null)
Initialize the method with the given parameter list and snapshot set.
T & get(const std::string &name, T def_value)
double ElapsedTime(void) const
void GESVD(const char JOBU, const char JOBVT, const int M, const int N, float *A, const int LDA, float *S, float *U, const int LDU, float *VT, const int LDVT, float *WORK, const int *LWORK, int *INFO) const
LapackPOD()
Default constructor.
void computeBasis()
Compute a basis for the provided snapshots.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
int Broadcast(double *MyVals, int Count, int Root) const
void ResetStartTime(void)