<commit_before>#ifndef EBITEN_GAME_VIDEO_AFFINE_MATRIX_HPP
#define EBITEN_GAME_VIDEO_AFFINE_MATRIX_HPP

#include <boost/mpl/int.hpp>
#include <boost/noncopyable.hpp>
#include <boost/range.hpp>
#include <boost/static_assert.hpp>
#include <algorithm>
#include <cassert>
#include <initializer_list>

namespace ebiten {
namespace game {
namespace video {

template<class Float, int Dimension>
class affine_matrix : private boost::noncopyable {
  BOOST_STATIC_ASSERT(0 < Dimension);
private:
  static const std::size_t size = Dimension * (Dimension - 1);
  Float elements_[size];
public:
  // TODO: accepts iterators
  affine_matrix(const std::initializer_list<Float>& elements_)
    : elements_{} {
    assert(static_cast<std::size_t>(boost::size(elements_)) <= size);
    std::copy(boost::begin(elements_), boost::end(elements_), this->elements_);
  }
  template<int I, int J>
  Float
  element() const {
    BOOST_STATIC_ASSERT(0 <= I);
    BOOST_STATIC_ASSERT(I < Dimension);
    BOOST_STATIC_ASSERT(0 <= J);
    BOOST_STATIC_ASSERT(J < Dimension);
    return this->element(boost::mpl::int_<I>(), boost::mpl::int_<J>());
  }
  template<int I, int J>
  Float
  set_element(Float element) {
    BOOST_STATIC_ASSERT(0 <= I);
    BOOST_STATIC_ASSERT(I < Dimension - 1);
    BOOST_STATIC_ASSERT(0 <= J);
    BOOST_STATIC_ASSERT(J < Dimension);
    return this->elements_[I * Dimension + J] = element;
  }<commit_msg>replace raw array to std::array<commit_after>#ifndef EBITEN_GAME_VIDEO_AFFINE_MATRIX_HPP
#define EBITEN_GAME_VIDEO_AFFINE_MATRIX_HPP

#include <boost/mpl/int.hpp>
#include <boost/noncopyable.hpp>
#include <boost/range.hpp>
#include <boost/static_assert.hpp>
#include <algorithm>
#include <array>
#include <cassert>
#include <initializer_list>

namespace ebiten {
namespace game {
namespace video {

template<class Float, int Dimension>
class affine_matrix : private boost::noncopyable {
  BOOST_STATIC_ASSERT(0 < Dimension);
private:
  static const std::size_t size = Dimension * (Dimension - 1);
  std::array<Float, size> elements_;
public:
  // TODO: accepts iterators
  affine_matrix(const std::initializer_list<Float>& elements_) {
    assert(static_cast<std::size_t>(boost::size(elements_)) <= size);
    this->elements_.fill(0);
    std::copy(boost::begin(elements_), boost::end(elements_), this->elements_.begin());
  }
  template<int I, int J>
  Float
  element() const {
    BOOST_STATIC_ASSERT(0 <= I);
    BOOST_STATIC_ASSERT(I < Dimension);
    BOOST_STATIC_ASSERT(0 <= J);
    BOOST_STATIC_ASSERT(J < Dimension);
    return this->element(boost::mpl::int_<I>(), boost::mpl::int_<J>());
  }
  template<int I, int J>
  Float
  set_element(Float element) {
    BOOST_STATIC_ASSERT(0 <= I);
    BOOST_STATIC_ASSERT(I < Dimension - 1);
    BOOST_STATIC_ASSERT(0 <= J);
    BOOST_STATIC_ASSERT(J < Dimension);
    return this->elements_[I * Dimension + J] = element;
  }
{'fraction_non_alphanumeric': 0.1365211365211365, 'fraction_numerical': 0.005197505197505198, 'mean_word_length': 5.3034934497816595, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 40, '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': '2352175', 'n_tokens_mistral': 1038, 'n_tokens_neox': 990, 'n_words': 199}