#include <boost/la/mat.hpp>
#include <boost/la/mat_traits.hpp>
#include <boost/la/vec.hpp>
#include <boost/la/vec_traits.hpp>
namespace
boost
{
namespace
la
{
//*** Matrix and vector types ***
template <class T,int Rows,int Cols>
struct
mat
{
T a[Rows][Cols];
template <class R>
operator R() const
{
R r;
assign(r,*this);
return r;
}
};
template <class Matrix>
struct matrix_traits;
template <class T,int Rows,int Cols>
struct
matrix_traits< mat<T,Rows,Cols> >
{
typedef T scalar_type;
static int const rows=Rows;
static int const cols=Cols;
template <int Row,int Col>
static
scalar_type
r( mat<T,Rows,Cols> const & x )
{
return x.a[Row][Col];
}
template <int Row,int Col>
static
scalar_type &
w( mat<T,Rows,Cols> & x )
{
return x.a[Row][Col];
}
static
scalar_type
ir( int row, int col, mat<T,Rows,Cols> const & x )
{
return x.a[row][col];
}
static
scalar_type &
iw( int row, int col, mat<T,Rows,Cols> & x )
{
return x.a[row][col];
}
};
template <class T,int Dim>
struct
vec
{
T a[Dim];
template <class R>
operator R() const
{
R r;
assign(r,*this);
return r;
}
};
template <class Vector>
struct vector_traits;
template <class T,int Dim>
struct
vector_traits< vec<T,Dim> >
{
typedef T scalar_type;
static int const dim=Dim;
template <int I>
static
scalar_type
r( vec<T,Dim> const & x )
{
return x.a[I];
}
template <int I>
static
scalar_type &
w( vec<T,Dim> & x )
{
return x.a[I];
}
static
scalar_type
ir( int i, vec<T,Dim> const & x )
{
return x.a[i];
}
static
scalar_type &
iw( int i, vec<T,Dim> & x )
{
return x.a[i];
}
};
}
}