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, int ncol, int rank, Real orthTol=1e-8, int orthIt=2, bool truncate=false, unsigned dom_seed=0, unsigned rng_seed=0)
void setStream (Ptr< std::ostream > &out)
void reset (bool randomize=true)
void setRank (int rank)
void update (void)
int advance (Real nu, const Vector< Real > &h, int col, 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

void mgs2 (std::vector< Ptr< Vector< Real > > > &Y) const
int LSsolver (LA::Matrix< Real > &A, LA::Matrix< Real > &B, bool trans=false) const
int lowRankApprox (LA::Matrix< Real > &A, int r) const
int computeP (void)
int computeQ (void)
int computeC (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 > > > Y_
LA::Matrix< Real > X_
LA::Matrix< Real > Z_
LA::Matrix< Real > C_
std::vector< Ptr< Vector< Real > > > Upsilon_
std::vector< Ptr< Vector< Real > > > Phi_
LA::Matrix< Real > Omega_
LA::Matrix< Real > Psi_
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 31 of file ROL_Sketch.hpp.

Constructor & Destructor Documentation

◆ ~Sketch()

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

Definition at line 209 of file ROL_Sketch.hpp.

◆ Sketch()

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

Member Function Documentation

◆ mgs2()

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

Definition at line 58 of file ROL_Sketch.hpp.

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

Referenced by computeQ().

◆ LSsolver()

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

Definition at line 89 of file ROL_Sketch.hpp.

References lapack_.

Referenced by computeC().

◆ lowRankApprox()

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

Definition at line 109 of file ROL_Sketch.hpp.

References lapack_, and zero.

Referenced by computeC().

◆ computeP()

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

Definition at line 140 of file ROL_Sketch.hpp.

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

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

◆ computeQ()

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

Definition at line 167 of file ROL_Sketch.hpp.

References flagQ_, mgs2(), and Y_.

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

◆ computeC()

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

Definition at line 175 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().

◆ setStream()

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

Definition at line 239 of file ROL_Sketch.hpp.

References out_.

◆ reset()

template<class Real>
void ROL::Sketch< Real >::reset ( bool randomize = true)
inline

Definition at line 243 of file ROL_Sketch.hpp.

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

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

◆ setRank()

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

Definition at line 260 of file ROL_Sketch.hpp.

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

Referenced by main().

◆ update()

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

Definition at line 288 of file ROL_Sketch.hpp.

References reset().

Referenced by test().

◆ advance()

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

Definition at line 292 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 360 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 411 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 441 of file ROL_Sketch.hpp.

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

Referenced by test().

Member Data Documentation

◆ Y_

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

Definition at line 34 of file ROL_Sketch.hpp.

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

◆ X_

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

Definition at line 35 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 35 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 35 of file ROL_Sketch.hpp.

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

◆ Upsilon_

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

Definition at line 38 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 38 of file ROL_Sketch.hpp.

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

◆ Omega_

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

Definition at line 39 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 39 of file ROL_Sketch.hpp.

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

◆ maxRank_

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

Definition at line 41 of file ROL_Sketch.hpp.

Referenced by setRank(), and Sketch().

◆ ncol_

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

Definition at line 41 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 41 of file ROL_Sketch.hpp.

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

◆ k_

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

Definition at line 41 of file ROL_Sketch.hpp.

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

◆ s_

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

Definition at line 41 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 43 of file ROL_Sketch.hpp.

Referenced by mgs2(), and Sketch().

◆ orthIt_

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

Definition at line 44 of file ROL_Sketch.hpp.

Referenced by mgs2(), and Sketch().

◆ truncate_

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

Definition at line 46 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 48 of file ROL_Sketch.hpp.

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

◆ flagP_

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

Definition at line 50 of file ROL_Sketch.hpp.

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

◆ flagQ_

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

Definition at line 50 of file ROL_Sketch.hpp.

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

◆ flagC_

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

Definition at line 50 of file ROL_Sketch.hpp.

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

◆ out_

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

Definition at line 52 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 54 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 55 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 56 of file ROL_Sketch.hpp.

Referenced by Sketch().


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