27 #ifndef MPBLOCKS_CUDA_LINALG_LVALUE_H_
28 #define MPBLOCKS_CUDA_LINALG_LVALUE_H_
35 template <
typename Scalar,
class Mat>
47 return static_cast<Mat const&
>(*this).size();
54 return static_cast<Mat const&
>(*this).rows();
61 return static_cast<Mat const&
>(*this).cols();
68 return static_cast<Mat&
>(*this)[i];
75 return static_cast<Mat const&
>(*this)[i];
82 return static_cast<Mat&
>(*this)(i,j);
89 return static_cast<Mat const&
>(*this)(i,j);
100 template <
class Exp2>
107 for(
int i=0; i <
rows(); i++)
108 for(
int j=0; j <
cols(); j++)
109 (*
this)(i,j) = B(i,j);
113 template <
class Exp2>
120 for(
int i=0; i <
rows(); i++)
121 for(
int j=0; j <
cols(); j++)
122 (*
this)(i,j) += B(i,j);
126 template <
class Exp2>
133 for(
int i=0; i <
rows(); i++)
134 for(
int j=0; j <
cols(); j++)
135 (*
this)(i,j) -= B(i,j);
160 #endif // MATRIXEXPRESSION_H_
__device__ __host__ Size_t cols() const
return the columns of a matrix expression
__device__ __host__ LValue< Scalar, Mat > & operator=(RValue< Scalar, Exp2 > const &B)
__device__ __host__ Scalar & operator()(Size_t i, Size_t j)
return the evaluated (i,j)'th element of a matrix expression
__device__ __host__ Scalar const & operator[](Size_t i) const
return the evaluated i'th element of a vector expression
StreamAssignment< LValue< Scalar, Mat > > Stream_t
__device__ __host__ Size_t size() const
return the size for a vector
__device__ __host__ LValue< Scalar, Mat > & operator-=(RValue< Scalar, Exp2 > const &B)
__device__ __host__ Stream_t operator<<(Scalar x)
returns a stream for assignment
expression template for rvalues
__device__ __host__ LValue< Scalar, Mat > & operator+=(RValue< Scalar, Exp2 > const &B)
__device__ __host__ Scalar & operator[](Size_t i)
return the evaluated i'th element of a vector expression
expression template for rvalues
__device__ __host__ Size_t rows() const
return the rows of a matrix expression
__device__ __host__ Scalar const & operator()(Size_t i, Size_t j) const
return the evaluated (i,j)'th element of a matrix expression