|
MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
|
Lazy expression for element-wise binary operations with broadcasting. More...
#include <broadcast.hpp>
Public Types | |
| using | value_type |
| using | size_type = std::size_t |
Public Member Functions | |
| template<typename L, typename R> | |
| broadcast_expr (L &&lhs, R &&rhs, Op op) | |
| const ::mtl::array::shape< N > & | get_shape () const |
| size_type | size () const |
| value_type | operator[] (const std::array< size_type, N > &idx) const |
| Evaluate at a multi-index. | |
| ndarray< value_type, N > | eval () const |
| Materialize the expression into a new ndarray: one walk over the result, with the three arrays' offsets advanced together (#856: two offset computations and a checked write per element before). | |
| operator ndarray< value_type, N > () const | |
| Allow implicit conversion to ndarray (materialization). | |
Static Public Attributes | |
| static constexpr size_type | rank = N |
Lazy expression for element-wise binary operations with broadcasting.
LHS and RHS are the operand types as stored: const A& for an lvalue operand, A itself for an rvalue one, so make_arr() + b and auto e = a.transpose() + b keep their temporaries alive (#856: both were held by const reference and dangled). An ndarray view is cheap to copy; an owning temporary is moved in.
| using mtl::array::broadcast_expr< LHS, RHS, Op, N >::size_type = std::size_t |
| using mtl::array::broadcast_expr< LHS, RHS, Op, N >::value_type |
|
inline |
|
inline |
Materialize the expression into a new ndarray: one walk over the result, with the three arrays' offsets advanced together (#856: two offset computations and a checked write per element before).
|
inline |
|
inline |
Allow implicit conversion to ndarray (materialization).
|
inline |
Evaluate at a multi-index.
Checked against the result's shape when bounds_checking is on, as ndarray's operator[] is (#856).
|
inline |
|
staticconstexpr |