32 template <
typename Scalar,
class Exp1,
class Exp2>
33 class _Sum :
public _RValue<Scalar, _Sum<Scalar, Exp1, Exp2> > {
44 _Sum(Exp1
const& A, Exp2
const& B) :
A_(A),
B_(B) {
45 static_assert(Exp1::ROWS_ == Exp2::ROWS_
46 && Exp1::COLS_ == Exp2::COLS_
47 && Exp1::SIZE_ == Exp2::SIZE_,
48 "Cannot sum matrices of different sizes");
56 return (
A_[i] +
B_[i]);
60 return (
A_(i, j) +
B_(i, j));
64 template <
typename Scalar,
class Exp1,
class Exp2>
68 static_cast<Exp2 const&>(B));
74 #endif // FIBER_SUM_H_SUM_H_
expression template for rvalues
_Sum(Exp1 const &A, Exp2 const &B)
Scalar operator[](Index i) const
Scalar operator()(Index i, Index j) const
_Sum< Scalar, Exp1, Exp2 > operator+(_RValue< Scalar, Exp1 > const &A, _RValue< Scalar, Exp2 > const &B)
expression template for sum of two matrix expressions