| 391 | __host__ __device__ CUMAT_STRONG_INLINE Index batches() const { return child_.batches(); } |
| 392 | |
| 393 | __device__ CUMAT_STRONG_INLINE Scalar coeff(Index row, Index col, Index batch, Index index) const |
| 394 | { |
| 395 | using Functor = typename internal::AsDiagonalFunctor<VectorType>; |
| 396 | if (row == col) |
| 397 | { |
| 398 | if (IsRowVector) |
| 399 | return Functor::asDiagonal(child_.derived().coeff(0, col, batch, -1)); |
| 400 | else |
| 401 | return Functor::asDiagonal(child_.derived().coeff(row, 0, batch, -1)); |
| 402 | } else |
| 403 | { |
| 404 | return typename Functor::MatrixType(0); |
| 405 | } |
| 406 | } |
| 407 | }; |
| 408 | |
| 409 | |