<commit_before>#ifndef STAN__VARIATIONAL__ADVI_PARAMS_FULLRANK__HPP
#define STAN__VARIATIONAL__ADVI_PARAMS_FULLRANK__HPP

#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/prim/mat/fun/LDLT_factor.hpp>
#include <stan/math/prim/scal/meta/constants.hpp>

#include <stan/math/prim/mat/err/check_square.hpp>
#include <stan/math/prim/mat/err/check_cholesky_factor.hpp>
#include <stan/math/prim/scal/err/check_size_match.hpp>
#include <stan/math/prim/scal/err/check_not_nan.hpp>

#include <vector>

namespace stan {

  namespace variational {

    class advi_params_fullrank {
    private:
      Eigen::VectorXd mu_;      // Mean of location-scale family
      Eigen::MatrixXd L_chol_;  // Cholesky factor of scale matrix
                                // NOTE: \Sigma = L_chol_ * L_chol_.transpose()
      int dimension_;

    public:
      advi_params_fullrank(const Eigen::VectorXd& mu,
                           const Eigen::MatrixXd& L_chol) :
      mu_(mu), L_chol_(L_chol), dimension_(mu.size()) {
        static const char* function =
          "stan::variational::advi_params_fullrank";

        stan::math::check_size_match(function,
                               "Dimension of mean vector",     dimension_,
                               "Dimension of Cholesky factor", L_chol_.rows() );
        for (int i = 0; i < dimension_; ++i)
          stan::math::check_not_nan(function, "Mean vector", mu_(i));
        stan::math::check_cholesky_factor(function,
                               "Cholesky factor", L_chol_);
      }

      virtual ~advi_params_fullrank() {}  // No-op

      // Accessors
      int dimension() const { return dimension_; }
      const Eigen::VectorXd& mu()     const { return mu_; }
      const Eigen::MatrixXd& L_chol() const { return L_chol_; }

      // Mutators
      void set_mu(const Eigen::VectorXd& mu) {
        static const char* function =
          "stan::variational::advi_params_fullrank::set_mu";

        stan::math::check_size_match(function,
                               "Dimension of input vector", mu.size(),
                               "Dimension of current vector", dimension_);
        for (int i = 0; i < dimension_; ++i)
          stan::math::check_not_nan(function, "Input vector", mu(i));
        mu_ = mu;
      }

      void set_L_chol(const Eigen::MatrixXd& L_chol) {
        static const char* function =
          "stan::variational::advi_params_fullrank::set_L_chol";

        stan::math::check_size_match(function,
                               "Dimension of mean vector",     dimension_,
                               "Dimension of Cholesky factor", L_chol.rows());
        stan::math::check_cholesky_factor(function,<commit_msg>fixed cholesky check with lower triangular<commit_after>#ifndef STAN__VARIATIONAL__ADVI_PARAMS_FULLRANK__HPP
#define STAN__VARIATIONAL__ADVI_PARAMS_FULLRANK__HPP

#include <stan/math/prim/mat/fun/Eigen.hpp>
#include <stan/math/prim/mat/fun/LDLT_factor.hpp>
#include <stan/math/prim/scal/meta/constants.hpp>

#include <stan/math/prim/mat/err/check_square.hpp>
#include <stan/math/prim/mat/err/check_lower_triangular.hpp>
#include <stan/math/prim/scal/err/check_size_match.hpp>
#include <stan/math/prim/scal/err/check_not_nan.hpp>

#include <vector>

namespace stan {

  namespace variational {

    class advi_params_fullrank {
    private:
      Eigen::VectorXd mu_;      // Mean of location-scale family
      Eigen::MatrixXd L_chol_;  // Cholesky factor of scale matrix
                                // NOTE: \Sigma = L_chol_ * L_chol_.transpose()
      int dimension_;

    public:
      advi_params_fullrank(const Eigen::VectorXd& mu,
                           const Eigen::MatrixXd& L_chol) :
      mu_(mu), L_chol_(L_chol), dimension_(mu.size()) {
        static const char* function =
          "stan::variational::advi_params_fullrank";

        stan::math::check_size_match(function,
                               "Dimension of mean vector",     dimension_,
                               "Dimension of Cholesky factor", L_chol_.rows() );
        for (int i = 0; i < dimension_; ++i)
          stan::math::check_not_nan(function, "Mean vector", mu_(i));
        stan::math::check_lower_triangular(function,
                               "Cholesky factor", L_chol_);
      }

      virtual ~advi_params_fullrank() {}  // No-op

      // Accessors
      int dimension() const { return dimension_; }
      const Eigen::VectorXd& mu()     const { return mu_; }
      const Eigen::MatrixXd& L_chol() const { return L_chol_; }

      // Mutators
      void set_mu(const Eigen::VectorXd& mu) {
        static const char* function =
          "stan::variational::advi_params_fullrank::set_mu";

        stan::math::check_size_match(function,
                               "Dimension of input vector", mu.size(),
                               "Dimension of current vector", dimension_);
        for (int i = 0; i < dimension_; ++i)
          stan::math::check_not_nan(function, "Input vector", mu(i));
        mu_ = mu;
      }

      void set_L_chol(const Eigen::MatrixXd& L_chol) {
        static const char* function =
          "stan::variational::advi_params_fullrank::set_L_chol";

        stan::math::check_size_match(function,
                               "Dimension of mean vector",     dimension_,
                               "Dimension of Cholesky factor", L_chol.rows());
        stan::math::check_lower_triangular(function,
{'fraction_non_alphanumeric': 0.11420204978038068, 'fraction_numerical': 0.0007320644216691069, 'mean_word_length': 2.3692971639950677, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 19, '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': '5992094', 'n_tokens_mistral': 1704, 'n_tokens_neox': 1640, 'n_words': 330}