| 85 | |
| 86 | public: |
| 87 | SolveOp(const _Solver& decomposition, const MatrixBase<_RHS>& rhs) |
| 88 | : decomposition_(decomposition) |
| 89 | , rhs_(rhs.derived()) |
| 90 | { |
| 91 | CUMAT_STATIC_ASSERT((std::is_same< |
| 92 | typename internal::NumTraits<typename _Solver::Scalar>::ElementalType, |
| 93 | typename internal::NumTraits<typename internal::traits<_RHS>::Scalar>::ElementalType>::value), |
| 94 | "Datatype of left- and right hand side must match"); |
| 95 | CUMAT_STATIC_ASSERT(CUMAT_IMPLIES(_Solver::Batches > 1 && _RHS::Batches > 0, _Solver::Batches == _RHS::Batches), |
| 96 | "Static count of batches must match"); //note: _Solver::Batches>1 to allow broadcasting |
| 97 | CUMAT_STATIC_ASSERT(CUMAT_IMPLIES(_Solver::Rows > 0 && _Solver::Columns > 0, _Solver::Rows == _Solver::Columns), |
| 98 | "Static count of rows and columns must be equal (square matrix)"); |
| 99 | CUMAT_STATIC_ASSERT(CUMAT_IMPLIES(_Solver::Rows > 0 && _RHS::Rows > 0, _Solver::Rows == _RHS::Rows), |
| 100 | "Left and right hand side are not compatible"); |
| 101 | |
| 102 | CUMAT_ASSERT(CUMAT_IMPLIES(_Solver::Batches!=1, decomposition.batches() == rhs.batches()) && "batch size of the matrix and the right hand side does not match"); |
| 103 | CUMAT_ASSERT(decomposition.rows() == decomposition.cols() && "matrix must be square"); //TODO: relax for Least-Squares problems |
| 104 | CUMAT_ASSERT(decomposition.cols() == rhs.rows() && "matrix size does not match right-hand-side"); |
| 105 | } |
| 106 | |
| 107 | __host__ __device__ CUMAT_STRONG_INLINE Index rows() const { return rhs_.rows(); } |
| 108 | __host__ __device__ CUMAT_STRONG_INLINE Index cols() const { return rhs_.cols(); } |