⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fixablestatemodel.hpp

📁 dysii是一款非常出色的滤波函数库
💻 HPP
字号:
#ifndef INDII_ML_FILTER_FIXABLESTATEMODEL_HPP#define INDII_ML_FILTER_FIXABLESTATEMODEL_HPP#include "../aux/vector.hpp"#include "../aux/matrix.hpp"namespace indii {  namespace ml {    namespace filter {/** * Model with fixable state variables. * * @author Lawrence Murray <lawrence@indii.org> * @version $Version$ * @date $Date: 2008-03-05 14:52:55 +0000 (Wed, 05 Mar 2008) $ * * Allows one or more state variables to be fixed. Fixing a variable removes * it from the state, reducing the state size by one. The state may then be * projected up into the full space of both state and fixed variables using * the fromState() method, and back again using the toState() method. * * The main purpose of this class is to allow the fixing of parameters, which * is useful for diagnostics and model testing, with minimal changes to a * model. For example, the transition() method of a ParticleFilterModel * derived class can apply fromState() to the particle @c s passed to it to * standardise its representation regardless of which variables are fixed, * transition the standardised particle, then apply toState() before * returning the result. */class FixableStateModel {public:  /**   * Default constructor for restoring from serialization.   */  FixableStateModel();  /**   * Constructor.   *    * @param N Initial state size. One or more components of the state may   * subsequently be fixed and the state size will be reduced.   */  FixableStateModel(const unsigned int N);  /**   * Destructor.   */  virtual ~FixableStateModel();  /**   * Get number of non-fixed variables.   */  virtual unsigned int getVariableSize() const;  /**   * Get number of fixed variables.   */  virtual unsigned int getFixedSize() const;  /**   * Fix the value of a variable. If the variable is already fixed, its value   * is updated to the new value given.   *   * @param i The index of the variable amongst both the fixed and state   * variables.   * @param value Value to which to fix the variable.   */  void fixVariable(const unsigned int i, const double value);  /**   * Project vector of both fixed and state variables to state variables   * only.   *   * @param x Vector of both fixed and state variables.   *   * @return Vector of state variables only.   */  indii::ml::aux::vector toState(const indii::ml::aux::vector& x) const;  /**   * Project vector of state variables into state and fixed variables.   *   * @param x Vector of state variables only.   *   * @return Vector of both fixed and state variables.   */  indii::ml::aux::vector fromState(const indii::ml::aux::vector& x) const;  /**   * Project symmetric matrix (e.g. covariance matrix) of both fixed and   * state variables to state variables only.   *   * @param x Symmetric matrix of both fixed and state variables.   *   * @return Symmetric matrix of state variables only.   */  indii::ml::aux::symmetric_matrix toState(      const indii::ml::aux::symmetric_matrix& x) const;  /**   * Project symmetric matrix (e.g. covariance matrix) of state variables   * only to both fixed and state variables.   *   * @param x Symmetric matrix of state variables only.   *   * @return Symmetric matrix of both fixed and state variables.   */  indii::ml::aux::symmetric_matrix fromState(      const indii::ml::aux::symmetric_matrix& x) const;private:  /**   * Size of state.   */  unsigned int N;    /**   * Number of fixed variables.   */  unsigned int F;    /**   * Fixed variable values. Zero for all others.   */  indii::ml::aux::sparse_vector fixed;  /**   * Projection of fixed and state variables to state variables only.   */  indii::ml::aux::projection_matrix projectState;  /**   * Serialize, or restore from serialization.   */  template<class Archive>  void serialize(Archive& ar, const unsigned int version);  /*   * Boost.Serialization requirements.   */  friend class boost::serialization::access;  };    }  }}template<class Archive>void indii::ml::filter::FixableStateModel::serialize(Archive& ar,    const unsigned int version) {  ar & N;  ar & F;  ar & fixed;  ar & projectState;}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -