27 #ifndef MPBLOCKS_CUDA_LINALG_MATRIX_H_
28 #define MPBLOCKS_CUDA_LINALG_MATRIX_H_
38 template <
typename Scalar,
int ROWS,
int COLS>
40 public LValue< Scalar, Matrix<Scalar,ROWS,COLS> >,
41 public RValue< Scalar, Matrix<Scalar,ROWS,COLS> >
53 int size()
const {
return ROWS*COLS; }
56 int rows()
const {
return ROWS; }
59 int cols()
const {
return COLS; }
97 template <
typename Exp>
104 for(
int i=0; i <
rows(); i++)
106 for(
int j=0; j <
cols(); j++)
108 (*this)(i,j) = exp(i,j);
__device__ __host__ Scalar const & operator[](int i) const
vector accessor
__device__ __host__ Scalar & operator()(int i, int j)
matrix accessor
__device__ __host__ Scalar & operator[](int i)
vector accessor
__device__ __host__ Matrix()
Default constructor.
LValue< Scalar, Matrix_t > LValue_t
__device__ __host__ int rows() const
expression template for rvalues
__device__ __host__ Matrix(RValue< Scalar, Exp > const &exp)
Construct from any MatrixExpression:
__device__ __host__ Scalar const & operator()(int i, int j) const
matrix accessor
Matrix< Scalar, ROWS, COLS > Matrix_t
__device__ __host__ int size() const
expression template for rvalues
Scalar m_data[ROWS *COLS]
__device__ __host__ int cols() const