// @HEADER // ***************************************************************************** // Rapid Optimization Library (ROL) Package // // Copyright 2014 NTESS and the ROL contributors. // SPDX-License-Identifier: BSD-3-Clause // ***************************************************************************** // @HEADER #ifndef ROL_OED_FACTORS_HPP #define ROL_OED_FACTORS_HPP #include "ROL_Ptr.hpp" #include "ROL_SampleGenerator.hpp" #include "ROL_SampledVector.hpp" #include "ROL_SingletonVector.hpp" #include "ROL_ConstraintFromObjective.hpp" #include "ROL_Types.hpp" #include "ROL_OED_ProfiledClass.hpp" #include namespace ROL { namespace OED { template class Factors : public ProfiledClass { protected: const Ptr> model_; const Ptr> theta_; const Ptr> obs_; const Ptr> obs0_; const Ptr> c_; const Ptr> sampler_; const bool storage_; const bool obs1d_; std::vector>> X_; Ptr> g_storage_; using ProfiledClass::startTimer; using ProfiledClass::stopTimer; void evaluateModel(Vector &g, const std::vector ¶m) const; void setFactors(); public: Factors(const Ptr> &model, const Ptr> &theta, const Ptr> &obs, const Ptr> &sampler, bool storage = true, const Ptr> &c = nullPtr); Factors(const Ptr> &model, const Ptr> &theta, const Ptr> &sampler, bool storage = true); void setPredictionVector(const Vector &c); void getPredictionVector(Vector &c) const; // Create a vector in the parameter space Ptr> createParameterVector(bool dual=false) const; // Create a vector in the observation space Ptr> createObservationVector(bool dual=false) const; // Compute c^T F[k] x Real apply(const Vector &x, int k) const; // Compute Fx = F[k] x void apply(Vector &Fx, const Vector &x, int k) const; // Compute Mx = F[k]^T R F[k] x void applyProduct(Vector &Mx, const Vector &x, int k) const; // Compute y^T F[k]^T R F[k] x Real applyProduct2(const Vector &x, const Vector &y, int k) const; // Get F[k]^T c const Ptr> get(int k) const; // Compute F(param)^T c void evaluate(Vector &F, const std::vector ¶m) const; // void sumAll(Real *in, Real *out, int size) const; int numFactors() const; int numMySamples() const; std::vector getSample(int k) const; }; // class Factors } // End OED Namespace } // End ROL Namespace #include "ROL_OED_Factors_Def.hpp" #endif