<commit_before>namespace mant {
  inline bool isRotationMatrix(
      const arma::Mat<double>& matrix) noexcept;

  inline bool isCompatibleDimension(
      const std::size_t firstDimension,
      const std::size_t secondDimension) noexcept;

  template <typename ParameterType>
  inline bool isBetween(
      const arma::Col<ParameterType>& parameter,
      const arma::Col<ParameterType>& lowerBound,
      const arma::Col<ParameterType>& upperBound);

  template <typename ParameterType>
  inline bool isBetween(
      const arma::Col<ParameterType>& parameter,
      const ParameterType lowerBound,
      const ParameterType upperBound);

  inline void checkRotationMatrix(
      const std::string& name,
      const arma::Mat<double>& matrix);

  inline void checkCompatibleDimension(
      const std::string& firstName,
      const std::size_t firstDimension,
      const std::string& secondName,
      const std::size_t secondDimension);

  template <typename ParameterType>
  inline void checkBetween(
      const std::string& parameterName,
      const arma::Col<ParameterType>& parameter,
      const std::string& lowerBoundName,
      const arma::Col<ParameterType>& lowerBound,
      const std::string& upperBoundName,
      const arma::Col<ParameterType>& upperBound);

  template <typename ParameterType>
  inline void checkBetween(
      const std::string& parameterName,
      const arma::Col<ParameterType>& parameter,
      const std::string& lowerBoundName,
      const ParameterType lowerBound,
      const std::string& upperBoundName,
      const ParameterType upperBound);

  inline bool isRotationMatrix(
      const arma::Mat<double>& matrix) noexcept {
    // is suqare?
    if (!matrix.is_square()) {
      return false;
    // is orthonormal?
    } else if(arma::any(arma::vectorise(arma::abs(matrix.i() - matrix.t()) > 1.0e-12 * std::max(1.0, std::abs(arma::median(arma::vectorise(matrix))))))) {
      return false;
    // determinant is either 1 or -1?
    } else if(std::abs(std::abs(arma::det(matrix)) - 1.0) > 1.0e-12) {
      return false;
    }

    return true;
  }

  inline bool isCompatibleDimension(
      const std::size_t firstDimension,
      const std::size_t secondDimension) noexcept {
    return (firstDimension == secondDimension);
  }

  template <typename ParameterType>
  inline bool isBetween(
      const arma::Col<ParameterType>& parameter,
      const arma::Col<ParameterType>& lowerBound,
      const arma::Col<ParameterType>& upperBound) {
    for(std::size_t n = 0; n < parameter.n_elem; ++n) {
      const double value = parameter(n);

      if(value < lowerBound(n) || value > upperBound(n)) {
        return false;
      }
    }

    return true;
  }

  template <typename ParameterType>
  inline bool isBetween(
      const arma::Col<ParameterType>& parameter,
      const ParameterType lowerBound,
      const ParameterType upperBound) {
    for(std::size_t n = 0; n < parameter.n_elem; ++n) {
      const double value = parameter(n);

      if(value < lowerBound || value > upperBound) {
        return false;
      }
    }

    return true;
  }

  template <typename ParameterType>
  inline bool isBetween(
      const arma::Col<ParameterType>& parameter,
      const ParameterType lowerBound,
      const ParameterType upperBound) noexcept {

  }

  inline void checkRotationMatrix(
      const std::string& name,
      const arma::Mat<double>& matrix) {
    if(!isRotationMatrix(matrix)) {
      throw std::logic_error("Rotation matrix required: " + name + " must be square, orthonormal and its determinant be either 1 or -1.");
    }
  }

  inline void checkCompatibleDimension(
      const std::string& firstName,
      const std::size_t firstDimension,
      const std::string& secondName,
      const std::size_t secondDimension) {
    if(!isCompatibleDimension(firstDimension, secondDimension)) {
      throw std::logic_error("Incompatible dimensions: " + firstName + " must be equal to " + secondName);
    }
  }

  template <typename ParameterType>
  inline void checkBetween(
      const std::string& parameterName,
      const arma::Col<ParameterType>& parameter,
      const std::string& lowerBoundName,
      const arma::Col<ParameterType>& lowerBound,
      const std::string& upperBoundName,
      const arma::Col<ParameterType>& upperBound) {
    if(!isBetween(parameter, lowerBound, upperBound)) {
      throw std::logic_error();
    }
  }

  template <typename ParameterType>
  inline void checkBetween(
      const std::string& parameterName,
      const arma::Col<ParameterType>& parameter,
      const std::string& lowerBoundName,
      const ParameterType lowerBound,
      const std::string& upperBoundName,
      const ParameterType upperBound) {
    if(!isBetween(parameter, lowerBound, upperBound)) {
      throw std::logic_error();
    }
  }
}<commit_msg>Removed previously added assertions (for now)<commit_after>namespace mant {
  inline bool isRotationMatrix(
      const arma::Mat<double>& matrix) noexcept;

  inline bool isCompatibleDimension(
      const std::size_t firstDimension,
      const std::size_t secondDimension) noexcept;
  inline void checkRotationMatrix(
      const std::string& name,
      const arma::Mat<double>& matrix);

  inline void checkCompatibleDimension(
      const std::string& firstName,
      const std::size_t firstDimension,
      const std::string& secondName,
      const std::size_t secondDimension);
      const std::size_t secondValue);

  inline bool isRotationMatrix(
      const arma::Mat<double>& matrix) noexcept {
    // is suqare?
    if (!matrix.is_square()) {
      return false;
    // is orthonormal?
    } else if(arma::any(arma::vectorise(arma::abs(matrix.i() - matrix.t()) > 1.0e-12 * std::max(1.0, std::abs(arma::median(arma::vectorise(matrix))))))) {
      return false;
    // determinant is either 1 or -1?
    } else if(std::abs(std::abs(arma::det(matrix)) - 1.0) > 1.0e-12) {
      return false;
    }

    return true;
  }

  inline bool isCompatibleDimension(
      const std::size_t firstDimension,
      const std::size_t secondDimension) noexcept {
    return (firstDimension == secondDimension);
  }

  inline void checkRotationMatrix(
      const std::string& name,
      const arma::Mat<double>& matrix) {
    if(!isRotationMatrix(matrix)) {
      throw std::logic_error("Rotation matrix required: " + name + " must be square, orthonormal and its determinant be either 1 or -1.");
    }
  }

  inline void checkCompatibleDimension(
      const std::string& firstName,
      const std::size_t firstDimension,
      const std::string& secondName,
      const std::size_t secondDimension) {
    if(!isCompatibleDimension(firstDimension, secondDimension)) {
      throw std::logic_error("Incompatible dimensions: " + firstName + " must be equal to " + secondName);
    }
  }

    }
  }
}
{'fraction_non_alphanumeric': 0.11114356652548561, 'fraction_numerical': 0.004965678399298963, 'mean_word_length': 3.484610347085789, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2219667', 'n_tokens_mistral': 2021, 'n_tokens_neox': 1966, 'n_words': 518}