MUQ  0.4.3
OneStepCachePiece.h
Go to the documentation of this file.
1 #ifndef ONESTEPCACHEPIECE_H
2 #define ONESTEPCACHEPIECE_H
3 
5 
6 
7 namespace muq{
8  namespace Modeling{
9  class OneStepCachePiece : public ModPiece {
10  public:
11  OneStepCachePiece(std::shared_ptr<ModPiece> baseModPiece, const double& prec = Eigen::NumTraits<double>::dummy_precision());
12 
13  virtual void EvaluateImpl(ref_vector<Eigen::VectorXd> const& input) override;
14 
15  double HitRatio();
16 
17  private:
18  unsigned int hits = 0;
19  unsigned int misses = 0;
20  bool firstEvaluation = true;
21  std::vector<Eigen::VectorXd> lastInput;
22  std::vector<Eigen::VectorXd> lastOutputs;
23 
24  std::shared_ptr<ModPiece> baseModPiece;
25  const double& prec;
26  };
27  }
28 }
29 
30 
31 #endif
Provides an abstract interface for defining vector-valued model components.
Definition: ModPiece.h:148
OneStepCachePiece(std::shared_ptr< ModPiece > baseModPiece, const double &prec=Eigen::NumTraits< double >::dummy_precision())
std::shared_ptr< ModPiece > baseModPiece
std::vector< Eigen::VectorXd > lastInput
virtual void EvaluateImpl(ref_vector< Eigen::VectorXd > const &input) override
std::vector< Eigen::VectorXd > lastOutputs
std::vector< std::reference_wrapper< const T > > ref_vector
A vector of references to something ...
Definition: WorkPiece.h:37