ROL
ROL::Sketch< Real > Class Template Reference

Provides an interface for randomized sketching. More...

#include <ROL_Sketch.hpp>

Public Member Functions

virtual ~Sketch (void)
 
 Sketch (const Vector< Real > &x, const int ncol, const int rank, const Real orthTol=1e-8, const int orthIt=2, const bool truncate=false, const unsigned dom_seed=0, const unsigned rng_seed=0)
 
void setStream (Ptr< std::ostream > &out)
 
void setRank (const int rank)
 
void update (void)
 
int advance (const Real nu, Vector< Real > &h, const int col, const Real eta=1.0)
 
int reconstruct (Vector< Real > &a, const int col)
 
bool test (const int rank, std::ostream &outStream=std::cout, const int verbosity=0)
 

Private Member Functions

int computeP (void)
 
void mgs2 (std::vector< Ptr< Vector< Real > > > &Y) const
 
int computeQ (void)
 
int LSsolver (LA::Matrix< Real > &A, LA::Matrix< Real > &B, const bool trans=false) const
 
int lowRankApprox (LA::Matrix< Real > &A, const int r) const
 
int computeC (void)
 
void reset (void)
 
bool testQ (std::ostream &outStream=std::cout, const int verbosity=0)
 
bool testP (std::ostream &outStream=std::cout, const int verbosity=0)
 

Private Attributes

std::vector< Ptr< Vector< Real > > > Upsilon_
 
std::vector< Ptr< Vector< Real > > > Phi_
 
std::vector< Ptr< Vector< Real > > > Y_
 
LA::Matrix< Real > Omega_
 
LA::Matrix< Real > Psi_
 
LA::Matrix< Real > X_
 
LA::Matrix< Real > Z_
 
LA::Matrix< Real > C_
 
int maxRank_
 
int ncol_
 
int rank_
 
int k_
 
int s_
 
const Real orthTol_
 
const int orthIt_
 
const bool truncate_
 
LAPACK< int, Real > lapack_
 
bool flagP_
 
bool flagQ_
 
bool flagC_
 
Ptr< std::ostream > out_
 
Ptr< Elementwise::NormalRandom< Real > > nrand_
 
Ptr< std::mt19937_64 > gen_
 
Ptr< std::normal_distribution< Real > > dist_
 

Detailed Description

template<class Real>
class ROL::Sketch< Real >

Provides an interface for randomized sketching.


Definition at line 64 of file ROL_Sketch.hpp.

Constructor & Destructor Documentation

◆ ~Sketch()

template<class Real>
virtual ROL::Sketch< Real >::~Sketch ( void )
inlinevirtual

Definition at line 287 of file ROL_Sketch.hpp.

◆ Sketch()

template<class Real>
ROL::Sketch< Real >::Sketch ( const Vector< Real > & x,
const int ncol,
const int rank,
const Real orthTol = 1e-8,
const int orthIt = 2,
const bool truncate = false,
const unsigned dom_seed = 0,
const unsigned rng_seed = 0 )
inline

Member Function Documentation

◆ computeP()

template<class Real>
int ROL::Sketch< Real >::computeP ( void )
inlineprivate

Definition at line 86 of file ROL_Sketch.hpp.

References flagP_, k_, lapack_, ncol_, and X_.

Referenced by computeC(), reconstruct(), and testP().

◆ mgs2()

template<class Real>
void ROL::Sketch< Real >::mgs2 ( std::vector< Ptr< Vector< Real > > > & Y) const
inlineprivate

Definition at line 113 of file ROL_Sketch.hpp.

References k_, orthIt_, orthTol_, and ROL::ROL_EPSILON().

Referenced by computeQ().

◆ computeQ()

template<class Real>
int ROL::Sketch< Real >::computeQ ( void )
inlineprivate

Definition at line 145 of file ROL_Sketch.hpp.

References flagQ_, mgs2(), and Y_.

Referenced by computeC(), reconstruct(), and testQ().

◆ LSsolver()

template<class Real>
int ROL::Sketch< Real >::LSsolver ( LA::Matrix< Real > & A,
LA::Matrix< Real > & B,
const bool trans = false ) const
inlineprivate

Definition at line 153 of file ROL_Sketch.hpp.

References lapack_.

Referenced by computeC().

◆ lowRankApprox()

template<class Real>
int ROL::Sketch< Real >::lowRankApprox ( LA::Matrix< Real > & A,
const int r ) const
inlineprivate

Definition at line 173 of file ROL_Sketch.hpp.

References lapack_, and zero.

Referenced by computeC().

◆ computeC()

template<class Real>
int ROL::Sketch< Real >::computeC ( void )
inlineprivate

Definition at line 204 of file ROL_Sketch.hpp.

References C_, computeP(), computeQ(), flagC_, k_, lowRankApprox(), LSsolver(), ncol_, Phi_, Psi_, rank_, s_, truncate_, X_, Y_, Z_, and zero.

Referenced by reconstruct().

◆ reset()

template<class Real>
void ROL::Sketch< Real >::reset ( void )
inlineprivate

Definition at line 245 of file ROL_Sketch.hpp.

References C_, k_, ncol_, nrand_, Omega_, Phi_, Psi_, s_, Upsilon_, X_, Y_, Z_, and zero.

Referenced by Sketch(), and update().

◆ setStream()

template<class Real>
void ROL::Sketch< Real >::setStream ( Ptr< std::ostream > & out)
inline

Definition at line 324 of file ROL_Sketch.hpp.

References out_.

◆ setRank()

template<class Real>
void ROL::Sketch< Real >::setRank ( const int rank)
inline

Definition at line 328 of file ROL_Sketch.hpp.

References C_, k_, maxRank_, ncol_, Omega_, out_, Phi_, Psi_, rank_, s_, update(), Upsilon_, X_, Y_, and Z_.

Referenced by main().

◆ update()

template<class Real>
void ROL::Sketch< Real >::update ( void )
inline

Definition at line 358 of file ROL_Sketch.hpp.

References flagC_, flagP_, flagQ_, and reset().

Referenced by setRank(), and test().

◆ advance()

template<class Real>
int ROL::Sketch< Real >::advance ( const Real nu,
Vector< Real > & h,
const int col,
const Real eta = 1.0 )
inline

Definition at line 366 of file ROL_Sketch.hpp.

References ROL::Vector< Real >::dot(), flagC_, flagP_, flagQ_, k_, ncol_, ROL::Vector< Real >::norm(), Omega_, out_, Phi_, Psi_, s_, Upsilon_, X_, Y_, and Z_.

Referenced by test().

◆ reconstruct()

template<class Real>
int ROL::Sketch< Real >::reconstruct ( Vector< Real > & a,
const int col )
inline

◆ test()

template<class Real>
bool ROL::Sketch< Real >::test ( const int rank,
std::ostream & outStream = std::cout,
const int verbosity = 0 )
inline

Definition at line 450 of file ROL_Sketch.hpp.

References advance(), ncol_, reconstruct(), ROL::ROL_EPSILON(), testP(), testQ(), update(), and Y_.

Referenced by main().

◆ testQ()

template<class Real>
bool ROL::Sketch< Real >::testQ ( std::ostream & outStream = std::cout,
const int verbosity = 0 )
inlineprivate

Definition at line 499 of file ROL_Sketch.hpp.

References computeQ(), k_, ROL::ROL_EPSILON(), and Y_.

Referenced by test().

◆ testP()

template<class Real>
bool ROL::Sketch< Real >::testP ( std::ostream & outStream = std::cout,
const int verbosity = 0 )
inlineprivate

Definition at line 537 of file ROL_Sketch.hpp.

References computeP(), k_, ncol_, ROL::ROL_EPSILON(), X_, and zero.

Referenced by test().

Member Data Documentation

◆ Upsilon_

template<class Real>
std::vector<Ptr<Vector<Real> > > ROL::Sketch< Real >::Upsilon_
private

Definition at line 66 of file ROL_Sketch.hpp.

Referenced by advance(), reset(), setRank(), and Sketch().

◆ Phi_

template<class Real>
std::vector<Ptr<Vector<Real> > > ROL::Sketch< Real >::Phi_
private

Definition at line 66 of file ROL_Sketch.hpp.

Referenced by advance(), computeC(), reset(), setRank(), and Sketch().

◆ Y_

template<class Real>
std::vector<Ptr<Vector<Real> > > ROL::Sketch< Real >::Y_
private

Definition at line 66 of file ROL_Sketch.hpp.

Referenced by advance(), computeC(), computeQ(), reconstruct(), reset(), setRank(), Sketch(), test(), and testQ().

◆ Omega_

template<class Real>
LA::Matrix<Real> ROL::Sketch< Real >::Omega_
private

Definition at line 67 of file ROL_Sketch.hpp.

Referenced by advance(), reset(), setRank(), and Sketch().

◆ Psi_

template<class Real>
LA::Matrix<Real> ROL::Sketch< Real >::Psi_
private

Definition at line 67 of file ROL_Sketch.hpp.

Referenced by advance(), computeC(), reset(), setRank(), and Sketch().

◆ X_

template<class Real>
LA::Matrix<Real> ROL::Sketch< Real >::X_
private

Definition at line 67 of file ROL_Sketch.hpp.

Referenced by advance(), computeC(), computeP(), reconstruct(), reset(), setRank(), Sketch(), and testP().

◆ Z_

template<class Real>
LA::Matrix<Real> ROL::Sketch< Real >::Z_
private

Definition at line 67 of file ROL_Sketch.hpp.

Referenced by advance(), computeC(), reset(), setRank(), and Sketch().

◆ C_

template<class Real>
LA::Matrix<Real> ROL::Sketch< Real >::C_
private

Definition at line 67 of file ROL_Sketch.hpp.

Referenced by computeC(), reconstruct(), reset(), setRank(), and Sketch().

◆ maxRank_

template<class Real>
int ROL::Sketch< Real >::maxRank_
private

Definition at line 69 of file ROL_Sketch.hpp.

Referenced by setRank(), and Sketch().

◆ ncol_

template<class Real>
int ROL::Sketch< Real >::ncol_
private

Definition at line 69 of file ROL_Sketch.hpp.

Referenced by advance(), computeC(), computeP(), reconstruct(), reset(), setRank(), Sketch(), test(), and testP().

◆ rank_

template<class Real>
int ROL::Sketch< Real >::rank_
private

Definition at line 69 of file ROL_Sketch.hpp.

Referenced by computeC(), setRank(), and Sketch().

◆ k_

template<class Real>
int ROL::Sketch< Real >::k_
private

Definition at line 69 of file ROL_Sketch.hpp.

Referenced by advance(), computeC(), computeP(), mgs2(), reconstruct(), reset(), setRank(), Sketch(), testP(), and testQ().

◆ s_

template<class Real>
int ROL::Sketch< Real >::s_
private

Definition at line 69 of file ROL_Sketch.hpp.

Referenced by advance(), computeC(), reset(), setRank(), and Sketch().

◆ orthTol_

template<class Real>
const Real ROL::Sketch< Real >::orthTol_
private

Definition at line 71 of file ROL_Sketch.hpp.

Referenced by mgs2(), and Sketch().

◆ orthIt_

template<class Real>
const int ROL::Sketch< Real >::orthIt_
private

Definition at line 72 of file ROL_Sketch.hpp.

Referenced by mgs2(), and Sketch().

◆ truncate_

template<class Real>
const bool ROL::Sketch< Real >::truncate_
private

Definition at line 74 of file ROL_Sketch.hpp.

Referenced by computeC(), and Sketch().

◆ lapack_

template<class Real>
LAPACK<int,Real> ROL::Sketch< Real >::lapack_
private

Definition at line 76 of file ROL_Sketch.hpp.

Referenced by computeP(), lowRankApprox(), and LSsolver().

◆ flagP_

template<class Real>
bool ROL::Sketch< Real >::flagP_
private

Definition at line 78 of file ROL_Sketch.hpp.

Referenced by advance(), computeP(), Sketch(), and update().

◆ flagQ_

template<class Real>
bool ROL::Sketch< Real >::flagQ_
private

Definition at line 78 of file ROL_Sketch.hpp.

Referenced by advance(), computeQ(), Sketch(), and update().

◆ flagC_

template<class Real>
bool ROL::Sketch< Real >::flagC_
private

Definition at line 78 of file ROL_Sketch.hpp.

Referenced by advance(), computeC(), Sketch(), and update().

◆ out_

template<class Real>
Ptr<std::ostream> ROL::Sketch< Real >::out_
private

Definition at line 80 of file ROL_Sketch.hpp.

Referenced by advance(), reconstruct(), setRank(), setStream(), and Sketch().

◆ nrand_

template<class Real>
Ptr<Elementwise::NormalRandom<Real> > ROL::Sketch< Real >::nrand_
private

Definition at line 82 of file ROL_Sketch.hpp.

Referenced by reset(), and Sketch().

◆ gen_

template<class Real>
Ptr<std::mt19937_64> ROL::Sketch< Real >::gen_
private

Definition at line 83 of file ROL_Sketch.hpp.

Referenced by Sketch().

◆ dist_

template<class Real>
Ptr<std::normal_distribution<Real> > ROL::Sketch< Real >::dist_
private

Definition at line 84 of file ROL_Sketch.hpp.

Referenced by Sketch().


The documentation for this class was generated from the following file: