| 108 | |
| 109 | public: |
| 110 | BinaryOp(const MatrixBase<_Left>& left, const MatrixBase<_Right>& right, |
| 111 | const _BinaryFunctor& functor = _BinaryFunctor()) |
| 112 | : left_(left.derived()), right_(right.derived()), functor_(functor) |
| 113 | { |
| 114 | CUMAT_STATIC_ASSERT((std::is_same<typename internal::traits<_Left>::Scalar, typename internal::traits<_Right>::Scalar>::value), |
| 115 | "No implicit casting is allowed in binary operations."); |
| 116 | |
| 117 | if (RowsLeft == Dynamic && RowsRight == Dynamic) { |
| 118 | CUMAT_ASSERT_ARGUMENT(left.rows() == right.rows()); |
| 119 | } |
| 120 | CUMAT_STATIC_ASSERT(!(RowsLeft > 1 && RowsRight > 1) || (RowsLeft == RowsRight), "matrix sizes don't match"); |
| 121 | |
| 122 | if (ColumnsLeft == Dynamic && ColumnsRight == Dynamic) { |
| 123 | CUMAT_ASSERT_ARGUMENT(left.cols() == right.cols()); |
| 124 | } |
| 125 | CUMAT_STATIC_ASSERT(!(ColumnsLeft > 1 && ColumnsRight > 1) || (ColumnsLeft == ColumnsRight), "matrix sizes don't match"); |
| 126 | |
| 127 | if (BatchesLeft == Dynamic && BatchesRight == Dynamic) { |
| 128 | CUMAT_ASSERT_ARGUMENT(left.batches() == right.batches()); |
| 129 | } |
| 130 | CUMAT_STATIC_ASSERT(!(BatchesLeft > 1 && BatchesRight > 1) || (BatchesLeft == BatchesRight), "matrix sizes don't match"); |
| 131 | } |
| 132 | |
| 133 | __host__ __device__ CUMAT_STRONG_INLINE Index rows() const |
| 134 | { |