<commit_before>//-----------------------------------------------------------------------bl-
//--------------------------------------------------------------------------
//
// QUESO - a library to support the Quantification of Uncertainty
// for Estimation, Simulation and Optimization
//
// Copyright (C) 2008,2009,2010,2011,2012,2013 The PECOS Development Team
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the Version 2.1 GNU Lesser General
// Public License as published by the Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc. 51 Franklin Street, Fifth Floor,
// Boston, MA  02110-1301  USA
//
//-----------------------------------------------------------------------el-

#ifndef UQ_TRANSFORMED_SCALEDCOV_TK_GROUP_H
#define UQ_TRANSFORMED_SCALEDCOV_TK_GROUP_H

#include <queso/TKGroup.h>
#include <queso/VectorRV.h>
#include <queso/ScalarFunctionSynchronizer.h>
#include <queso/InvLogitGaussianVectorRV.h>

namespace QUESO {

//*****************************************************
// TK with scaled cov matrix
//*****************************************************
/*! \class TransformedScaledCovMatrixTKGroup
 *  \brief This class allows the representation of a transition kernel with a scaled covariance matrix. */
 
template<class V, class M>
class TransformedScaledCovMatrixTKGroup : public BaseTKGroup<V, M> {
public:
  //! @name Constructor/Destructor methods
  //@{ 
  //! Default constructor.
  TransformedScaledCovMatrixTKGroup(const char * prefix,
      const BoxSubset<V, M> & boxSubset, const std::vector<double> & scales,
      const M & covMatrix);

  //! Destructor.
  ~TransformedScaledCovMatrixTKGroup();
  //@}
  
  //! @name Statistical/Mathematical methods
  //@{
  //! Whether or not the matrix is symmetric. Always 'true'.
  /*! \todo: It only returns 'true', thus a test for its symmetricity must be included.*/
  bool symmetric() const;
  
  //! InvLogitGaussian increment property to construct a transition kernel.
  const InvLogitGaussianVectorRV<V, M> & rv(unsigned int stageId);
  
  //! InvLogitGaussian increment property to construct a transition kernel.
  const InvLogitGaussianVectorRV<V, M> & rv(
      const std::vector<unsigned int> & stageIds);
  
  //! Scales the covariance matrix.
  /*! The covariance matrix is scaled by a factor of \f$ 1/scales^2 \f$.*/
  void updateLawCovMatrix(const M & covMatrix);
  //@}
  
  //! @name Misc methods
  //@{
  //! Sets the pre-computing positions \c m_preComputingPositions[stageId] with a new vector of size \c position.  
  bool setPreComputingPosition(const V & position, unsigned int stageId);
  
  //! Clears the pre-computing positions \c m_preComputingPositions[stageId]
  void clearPreComputingPositions();
  //@}
  
  //! @name I/O methods
  //@{
  //! TODO: Prints the transition kernel.
  /*! \todo: implement me!*/
  void print(std::ostream & os) const;
  //@}

private:
  //! Sets the mean of the RVs to zero.
  void setRVsWithZeroMean();
  using BaseTKGroup<V, M>::m_env;
  using BaseTKGroup<V, M>::m_prefix;
  using BaseTKGroup<V, M>::m_vectorSpace;
  using BaseTKGroup<V, M>::m_scales;
  using BaseTKGroup<V, M>::m_preComputingPositions;
  using BaseTKGroup<V, M>::m_rvs;

  const BoxSubset<V, M> & m_boxSubset;
  M m_originalCovMatrix;

  void transformToGaussianSpace(const V & physicalPoint,
      V & transformedPoint) const;
};

}  // End namespace QUESO

#endif // UQ_TRANSFORMED_SCALEDCOV_TK_GROUP_H<commit_msg>Add docs for the new TK<commit_after>//-----------------------------------------------------------------------bl-
//--------------------------------------------------------------------------
//
// QUESO - a library to support the Quantification of Uncertainty
// for Estimation, Simulation and Optimization
//
// Copyright (C) 2008,2009,2010,2011,2012,2013 The PECOS Development Team
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the Version 2.1 GNU Lesser General
// Public License as published by the Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc. 51 Franklin Street, Fifth Floor,
// Boston, MA  02110-1301  USA
//
//-----------------------------------------------------------------------el-

#ifndef UQ_TRANSFORMED_SCALEDCOV_TK_GROUP_H
#define UQ_TRANSFORMED_SCALEDCOV_TK_GROUP_H

#include <queso/TKGroup.h>
#include <queso/VectorRV.h>
#include <queso/ScalarFunctionSynchronizer.h>
#include <queso/InvLogitGaussianVectorRV.h>

namespace QUESO {

/*!
 * \class TransformedScaledCovMatrixTKGroup
 * \brief This class represents a transition kernel with a scaled covariance matrix on hybrid bounded/unbounded state spaces.
 *
 * The unbounded directions utilise a standard Gaussian proposal.  The bounded
 * or half-bounded directions utilise a transformed Gaussian proposal, so that
 * no realizations are generated outside of the state space.
 */

template<class V, class M>
class TransformedScaledCovMatrixTKGroup : public BaseTKGroup<V, M> {
public:
  //! @name Constructor/Destructor methods
  //@{
  //! Default constructor.
  TransformedScaledCovMatrixTKGroup(const char * prefix,
      const BoxSubset<V, M> & boxSubset, const std::vector<double> & scales,
      const M & covMatrix);

  //! Destructor.
  ~TransformedScaledCovMatrixTKGroup();
  //@}

  //! @name Statistical/Mathematical methods
  //@{
  //! Whether or not the matrix is symmetric.  Always 'false'.
  bool symmetric() const;

  //! InvLogitGaussian increment property to construct a transition kernel.
  const InvLogitGaussianVectorRV<V, M> & rv(unsigned int stageId);

  //! InvLogitGaussian increment property to construct a transition kernel.
  const InvLogitGaussianVectorRV<V, M> & rv(
      const std::vector<unsigned int> & stageIds);

  //! Scales the covariance matrix of the underlying Gaussian distribution.
  /*! The covariance matrix is scaled by a factor of \f$ 1/scales^2 \f$.*/
  void updateLawCovMatrix(const M & covMatrix);
  //@}

  //! @name Misc methods
  //@{
  //! Sets the pre-computing positions \c m_preComputingPositions[stageId] with a new vector of size \c position.
  /*!
   * The vector \c position is in *physical* space.  This is then transformed
   * using transformToGaussianSpace to map to a point in Gaussian space where
   * we can, for example, update the mean of the underlying Gaussian RV.
   */
  bool setPreComputingPosition(const V & position, unsigned int stageId);

  //! Clears the pre-computing positions \c m_preComputingPositions[stageId]
  void clearPreComputingPositions();
  //@}

  //! @name I/O methods
  //@{
  //! TODO: Prints the transition kernel.
  /*! \todo: implement me!*/
  void print(std::ostream & os) const;
  //@}

private:
  //! Sets the mean of the underlying Gaussian RVs to zero.
  void setRVsWithZeroMean();

  using BaseTKGroup<V, M>::m_env;
  using BaseTKGroup<V, M>::m_prefix;
  using BaseTKGroup<V, M>::m_vectorSpace;
  using BaseTKGroup<V, M>::m_scales;
  using BaseTKGroup<V, M>::m_preComputingPositions;
  using BaseTKGroup<V, M>::m_rvs;

  const BoxSubset<V, M> & m_boxSubset;
  M m_originalCovMatrix;

  void transformToGaussianSpace(const V & physicalPoint,
      V & transformedPoint) const;
};

}  // End namespace QUESO

#endif // UQ_TRANSFORMED_SCALEDCOV_TK_GROUP_H
{'fraction_non_alphanumeric': 0.1618798955613577, 'fraction_numerical': 0.00969787392763894, 'mean_word_length': 3.038152610441767, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6809427', 'n_tokens_mistral': 2434, 'n_tokens_neox': 2278, 'n_words': 792}