// Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.

// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#ifndef UUID_47B1D1217B411E08424FA0ADFD72085
#define UUID_47B1D1217B411E08424FA0ADFD72085

#include <boost/qvm/enable_if.hpp>
#include <boost/qvm/inline.hpp>
#include <boost/qvm/mat_traits.hpp>
#include <boost/qvm/static_assert.hpp>

namespace boost {
namespace qvm {
////////////////////////////////////////////////

template <int R, int C, class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A(M const &a) {
  BOOST_STATIC_ASSERT(R >= 0);
  BOOST_STATIC_ASSERT(R < mat_traits<M>::rows);
  BOOST_STATIC_ASSERT(C >= 0);
  BOOST_STATIC_ASSERT(C < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<R, C>(a);
}

template <int R, int C, class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A(M &a) {
  BOOST_STATIC_ASSERT(R >= 0);
  BOOST_STATIC_ASSERT(R < mat_traits<M>::rows);
  BOOST_STATIC_ASSERT(C >= 0);
  BOOST_STATIC_ASSERT(C < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<R, C>(a);
}

////////////////////////////////////////////////

template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A00(M const &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<0, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A01(M const &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<0, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A02(M const &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<0, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A03(M const &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<0, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A04(M const &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<0, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A05(M const &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<0, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A06(M const &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<0, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A07(M const &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<0, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A08(M const &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<0, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A09(M const &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<0, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A10(M const &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<1, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A11(M const &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<1, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A12(M const &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<1, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A13(M const &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<1, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A14(M const &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<1, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A15(M const &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<1, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A16(M const &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<1, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A17(M const &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<1, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A18(M const &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<1, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A19(M const &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<1, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A20(M const &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<2, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A21(M const &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<2, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A22(M const &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<2, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A23(M const &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<2, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A24(M const &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<2, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A25(M const &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<2, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A26(M const &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<2, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A27(M const &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<2, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A28(M const &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<2, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A29(M const &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<2, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A30(M const &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<3, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A31(M const &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<3, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A32(M const &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<3, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A33(M const &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<3, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A34(M const &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<3, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A35(M const &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<3, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A36(M const &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<3, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A37(M const &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<3, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A38(M const &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<3, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A39(M const &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<3, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A40(M const &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<4, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A41(M const &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<4, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A42(M const &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<4, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A43(M const &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<4, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A44(M const &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<4, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A45(M const &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<4, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A46(M const &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<4, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A47(M const &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<4, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A48(M const &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<4, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A49(M const &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<4, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A50(M const &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<5, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A51(M const &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<5, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A52(M const &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<5, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A53(M const &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<5, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A54(M const &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<5, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A55(M const &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<5, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A56(M const &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<5, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A57(M const &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<5, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A58(M const &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<5, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A59(M const &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<5, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A60(M const &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<6, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A61(M const &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<6, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A62(M const &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<6, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A63(M const &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<6, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A64(M const &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<6, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A65(M const &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<6, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A66(M const &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<6, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A67(M const &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<6, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A68(M const &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<6, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A69(M const &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<6, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A70(M const &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<7, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A71(M const &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<7, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A72(M const &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<7, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A73(M const &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<7, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A74(M const &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<7, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A75(M const &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<7, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A76(M const &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<7, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A77(M const &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<7, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A78(M const &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<7, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A79(M const &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<7, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A80(M const &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<8, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A81(M const &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<8, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A82(M const &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<8, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A83(M const &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<8, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A84(M const &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<8, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A85(M const &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<8, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A86(M const &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<8, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A87(M const &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<8, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A88(M const &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<8, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A89(M const &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<8, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A90(M const &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<9, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A91(M const &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<9, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A92(M const &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<9, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A93(M const &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<9, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A94(M const &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<9, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A95(M const &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<9, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A96(M const &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<9, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A97(M const &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<9, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A98(M const &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<9, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type>::type
    A99(M const &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template read_element<9, 9>(a);
}

template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A00(M &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<0, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A01(M &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<0, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A02(M &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<0, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A03(M &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<0, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A04(M &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<0, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A05(M &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<0, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A06(M &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<0, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A07(M &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<0, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A08(M &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<0, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A09(M &a) {
  BOOST_STATIC_ASSERT(0 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<0, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A10(M &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<1, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A11(M &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<1, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A12(M &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<1, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A13(M &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<1, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A14(M &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<1, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A15(M &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<1, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A16(M &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<1, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A17(M &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<1, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A18(M &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<1, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A19(M &a) {
  BOOST_STATIC_ASSERT(1 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<1, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A20(M &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<2, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A21(M &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<2, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A22(M &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<2, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A23(M &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<2, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A24(M &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<2, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A25(M &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<2, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A26(M &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<2, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A27(M &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<2, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A28(M &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<2, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A29(M &a) {
  BOOST_STATIC_ASSERT(2 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<2, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A30(M &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<3, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A31(M &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<3, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A32(M &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<3, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A33(M &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<3, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A34(M &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<3, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A35(M &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<3, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A36(M &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<3, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A37(M &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<3, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A38(M &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<3, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A39(M &a) {
  BOOST_STATIC_ASSERT(3 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<3, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A40(M &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<4, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A41(M &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<4, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A42(M &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<4, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A43(M &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<4, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A44(M &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<4, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A45(M &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<4, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A46(M &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<4, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A47(M &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<4, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A48(M &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<4, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A49(M &a) {
  BOOST_STATIC_ASSERT(4 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<4, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A50(M &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<5, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A51(M &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<5, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A52(M &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<5, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A53(M &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<5, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A54(M &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<5, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A55(M &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<5, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A56(M &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<5, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A57(M &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<5, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A58(M &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<5, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A59(M &a) {
  BOOST_STATIC_ASSERT(5 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<5, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A60(M &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<6, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A61(M &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<6, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A62(M &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<6, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A63(M &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<6, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A64(M &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<6, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A65(M &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<6, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A66(M &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<6, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A67(M &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<6, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A68(M &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<6, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A69(M &a) {
  BOOST_STATIC_ASSERT(6 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<6, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A70(M &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<7, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A71(M &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<7, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A72(M &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<7, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A73(M &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<7, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A74(M &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<7, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A75(M &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<7, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A76(M &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<7, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A77(M &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<7, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A78(M &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<7, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A79(M &a) {
  BOOST_STATIC_ASSERT(7 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<7, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A80(M &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<8, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A81(M &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<8, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A82(M &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<8, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A83(M &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<8, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A84(M &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<8, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A85(M &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<8, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A86(M &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<8, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A87(M &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<8, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A88(M &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<8, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A89(M &a) {
  BOOST_STATIC_ASSERT(8 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<8, 9>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A90(M &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 0 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<9, 0>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A91(M &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 1 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<9, 1>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A92(M &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 2 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<9, 2>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A93(M &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 3 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<9, 3>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A94(M &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 4 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<9, 4>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A95(M &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 5 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<9, 5>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A96(M &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 6 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<9, 6>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A97(M &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 7 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<9, 7>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A98(M &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 8 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<9, 8>(a);
}
template <class M>
BOOST_QVM_INLINE_TRIVIAL
    typename enable_if_c<is_mat<M>::value,
                         typename mat_traits<M>::scalar_type &>::type
    A99(M &a) {
  BOOST_STATIC_ASSERT(9 < mat_traits<M>::rows && 9 < mat_traits<M>::cols);
  return mat_traits<M>::template write_element<9, 9>(a);
}

////////////////////////////////////////////////
} // namespace qvm
} // namespace boost

#endif


/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

/*
 Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
 Copyright (C) 2003, 2004, 2005, 2006, 2007 StatPro Italia srl
 Copyright (C) 2004, 2005, 2006 Ferdinando Ametrano
 Copyright (C) 2006 Katiuscia Manzoni

 This file is part of QuantLib, a free-software/open-source library
 for financial quantitative analysts and developers - http://quantlib.org/

 QuantLib is free software: you can redistribute it and/or modify it
 under the terms of the QuantLib license.  You should have received a
 copy of the license along with this program; if not, please email
 <quantlib-dev@lists.sf.net>. The license is also available online at
 <http://quantlib.org/license.shtml>.

 This program 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 license for more details.
*/

#include <ql/time/imm.hpp>
#include "ql_settings.hpp"
#include "ql_utilities_dataparsers.hpp"
#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4))
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#endif
//#include <boost/algorithm/string/case_conv.hpp>
#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) || (__GNUC__ > 4))
#pragma GCC diagnostic pop
#endif

//using boost::algorithm::to_upper_copy;
//using std::string;

namespace QuantLib {
    template <class ExtDate> inline
    bool IMM<ExtDate>::isIMMdate(const ExtDate& dat, bool mainCycle) {
        auto date = to_DateLike(dat);
        auto s = date.serialNumber();
        if (date.weekday(s)!=Wednesday)
            return false;

        Day d = date.dayOfMonth(s);
        if (d<15 || d>21)
            return false;

        if (!mainCycle) return true;

        switch (date.month(s)) {
          case March:
          case June:
          case September:
          case December:
            return true;
          default:
            return false;
        }
    }
    template <class ExtDate>    inline
    bool IMM<ExtDate>::isIMMcode(const std::string& in, bool mainCycle) {
        if (in.length() != 2)
            return false;

        std::string str1("0123456789");
        std::string::size_type loc = str1.find(in.substr(1,1), 0);
        if (loc == std::string::npos)
            return false;

        if (mainCycle) str1 = "hmzuHMZU";
        else           str1 = "fghjkmnquvxzFGHJKMNQUVXZ";
        loc = str1.find(in.substr(0,1), 0);
        return loc != std::string::npos;
    }
    template <class ExtDate>    inline
    std::string IMM<ExtDate>::code(const ExtDate& date) {
        QL_REQUIRE(isIMMdate(date, false),
                   "{} is not an IMM date",date);

        std::ostringstream IMMcode;
        auto d = to_DateLike(date);
        auto s = d.serialNumber();
        unsigned int y = d.year(s) % 10;
        switch(d.month(s)) {
          case January:
            IMMcode << 'F' << y;
            break;
          case February:
            IMMcode << 'G' << y;
            break;
          case March:
            IMMcode << 'H' << y;
            break;
          case April:
            IMMcode << 'J' << y;
            break;
          case May:
            IMMcode << 'K' << y;
            break;
          case June:
            IMMcode << 'M' << y;
            break;
          case July:
            IMMcode << 'N' << y;
            break;
          case August:
            IMMcode << 'Q' << y;
            break;
          case September:
            IMMcode << 'U' << y;
            break;
          case October:
            IMMcode << 'V' << y;
            break;
          case November:
            IMMcode << 'X' << y;
            break;
          case December:
            IMMcode << 'Z' << y;
            break;
          default:
            QL_FAIL("not an IMM month (and it should have been)");
        }

        #if defined(QL_EXTRA_SAFETY_CHECKS)
        QL_ENSURE(isIMMcode(IMMcode.str(), false),
                  "the result {} is an invalid IMM code",IMMcode.str());
        #endif
        return IMMcode.str();
    }
    template <class ExtDate>    inline
    ExtDate IMM<ExtDate>::date(const std::string& immCode, const ExtDate& refDate) {
        QL_REQUIRE(isIMMcode(immCode, false), "{} is not a valid IMM code"
            , immCode);

        DateLike<ExtDate> referenceDate{
            to_DateLike(refDate) != ExtDate() ?
                to_DateLike(refDate) :
                DateLike<ExtDate>{Settings<ExtDate>::instance().evaluationDate()}};
        auto to_upper_copy = [](const std::string& s) { std::string res; for (auto i:s) res.push_back(std::toupper(i)); return res;};
        std::string code = to_upper_copy(immCode);
        std::string ms = code.substr(0,1);
        QuantLib::Month m;
        if (ms=="F")      m = January;
        else if (ms=="G") m = February;
        else if (ms=="H") m = March;
        else if (ms=="J") m = April;
        else if (ms=="K") m = May;
        else if (ms=="M") m = June;
        else if (ms=="N") m = July;
        else if (ms=="Q") m = August;
        else if (ms=="U") m = September;
        else if (ms=="V") m = October;
        else if (ms=="X") m = November;
        else if (ms=="Z") m = December;
        else QL_FAIL("invalid IMM month letter");

//        Year y = boost::lexical_cast<Year>(); // lexical_cast causes compilation errors with x64

        Year y= io::to_integer(code.substr(1,1));
        /* year<1900 are not valid QuantLib years: to avoid a run-time
           exception few lines below we need to add 10 years right away */
        auto s = referenceDate.serialNumber();
        if (y==0 && referenceDate.year(s)<=1909) y+=10;
        Year referenceYear = (referenceDate.year(s) % 10);
        y += referenceDate.year(s) - referenceYear;
        ExtDate result = IMM<ExtDate>::nextDate(DateAdaptor<ExtDate>::Date(1, m, y), false);
        if (result<referenceDate)
            return IMM<ExtDate>::nextDate(DateAdaptor<ExtDate>::Date(1, m, y + 10), false);

        return result;
    }
    template <class ExtDate>    inline
    ExtDate IMM<ExtDate>::nextDate(const ExtDate& date, bool mainCycle) {
        DateLike<ExtDate> refDate{(to_DateLike(date) == ExtDate() ?
                                       ExtDate(Settings<ExtDate>::instance().evaluationDate()) :
                                       date)};
        auto s = refDate.serialNumber();
        Year y = refDate.year(s);
        QuantLib::Month m = refDate.month(s);

        Size offset = mainCycle ? 3 : 1;
        Size skipMonths = offset-(m%offset);
        if (skipMonths != offset || refDate.dayOfMonth(s) > 21) {
            skipMonths += Size(m);
            if (skipMonths<=12) {
                m = QuantLib::Month(skipMonths);
            } else {
                m = QuantLib::Month(skipMonths-12);
                y += 1;
            }
        }

        ExtDate result = DateLike<ExtDate>::nthWeekday(3, Wednesday, m, y);
        if (result<=refDate)
            result = nextDate(DateAdaptor<ExtDate>::Date(22, m, y), mainCycle);
        return result;
    }
    template <class ExtDate>    inline
    ExtDate IMM<ExtDate>::nextDate(const std::string& IMMcode,
                       bool mainCycle,
                       const ExtDate& referenceDate)  {
        ExtDate immDate = date(IMMcode, referenceDate);
        return nextDate(immDate+1, mainCycle);
    }
    template <class ExtDate>    inline
    std::string IMM<ExtDate>::nextCode(const ExtDate& d,
                              bool mainCycle) {
        ExtDate date = nextDate(d, mainCycle);
        return code(date);
    }
    template <class ExtDate>    inline
    std::string IMM<ExtDate>::nextCode(const std::string& immCode,
                              bool mainCycle,
                              const ExtDate& referenceDate) {
        ExtDate date = nextDate(immCode, mainCycle, referenceDate);
        return code(date);
    }

}