TRIQS/nda 1.3.0
Multi-dimensional array library for C++
|
#include <nda/arithmetic.hpp>
Lazy binary expression for nda::ArrayOrScalar types.
A lazy binary expression contains a two operands and a binary operation. It fulfills the nda::Array concept and can therefore be used in any other expression or function that expects an nda::Array type.
The supported binary operations are addition ('+'), subtraction ('-'), multiplication ('*') and division ('/').
OP | Char representing the unary operation. |
L | nda::ArrayOrScalar type of left hand side. |
R | nda::ArrayOrScalar type of right hand side. |
Definition at line 106 of file arithmetic.hpp.
Public Types | |
using | L_t = std::decay_t<L> |
Decay type of the left hand side operand. | |
using | R_t = std::decay_t<R> |
Decay type of the right hand side operand. | |
Public Member Functions | |
template<typename... Args> | |
auto | operator() (Args const &...args) const |
Function call operator. | |
template<typename Arg > | |
auto | operator[] (Arg &&arg) const |
Subscript operator. | |
constexpr decltype(auto) | shape () const |
Get the shape of the expression (result of the operation). | |
constexpr long | size () const |
Get the total size of the expression (result of the operation). | |
Static Public Member Functions | |
static constexpr layout_info_t | compute_layout_info () |
Compute the layout information of the expression. | |
Public Attributes | |
L | l |
nda::ArrayOrScalar left hand side operand. | |
R | r |
nda::ArrayOrScalar right hand side operand. | |
Static Public Attributes | |
static constexpr char | algebra = (l_is_scalar ? get_algebra<R> : get_algebra<L>) |
Constexpr variable specifying the algebra of one of the non-scalar operands. | |
static constexpr bool | l_is_scalar = nda::is_scalar_v<L> |
Constexpr variable that is true if the left hand side operand is a scalar. | |
static constexpr bool | r_is_scalar = nda::is_scalar_v<R> |
Constexpr variable that is true if the right hand side operand is a scalar. | |
|
inlinestaticconstexpr |
Compute the layout information of the expression.
Definition at line 133 of file arithmetic.hpp.
|
inline |
Function call operator.
Forwards the arguments to the nda::Array operands and performs the binary operation.
Args | Types of the arguments. |
args | Function call arguments. |
Definition at line 180 of file arithmetic.hpp.
|
inline |
Subscript operator.
Simply forwards the argument to the function call operator.
Arg | Type of the argument. |
arg | Subscript argument. |
Definition at line 269 of file arithmetic.hpp.
|
inlinenodiscardconstexpr |
Get the shape of the expression (result of the operation).
std::array<long, Rank>
object specifying the shape of the expression. Definition at line 143 of file arithmetic.hpp.
|
inlinenodiscardconstexpr |
Get the total size of the expression (result of the operation).
Definition at line 158 of file arithmetic.hpp.