ClikaRT::Scalar
class
Header: ClikaRT/compute/ops.h
A scalar operand that keeps its KIND across the boundary: a bool, an integer (any width, stays integral), or a double. What it buys over a bare double parameter: an integer scalar against an integer tensor stays in the integer domain (ops::sub(2, int64_tensor) is Int64, exact at any magnitude), where a double would force weak-float promotion. Every ctor is implicit on purpose. Pass the bare literal. Distinct from ScalarOrTensor: a Scalar never carries a tensor, which is what keeps a two-tensor call (ops::add(a, b)) unambiguous against the tensor-first overloads.
Member functions
Scalar(bool)
Scalar(bool v)
A boolean scalar; it keeps Bool kind (never widened to int or double).
Declared in ClikaRT/compute/ops.h, line 92
Scalar(T)
template <``typename T, typename std::enable_if<std::is_integral<T>::value &&!std::is_same<T, bool>::value, int>::type = 0``>Scalar(T v)
Integral values keep their integer-ness across the boundary. Templated over the integral types so every width lands here exactly, never on the double ctor, and never ambiguously against it.
Declared in ClikaRT/compute/ops.h, line 100
Scalar(double)
Scalar(double v)
A double scalar, the weak-float kind (against an integer tensor the result promotes to float).
Declared in ClikaRT/compute/ops.h, line 102
is_bool()
bool is_bool() const
True for the Bool kind.
Declared in ClikaRT/compute/ops.h, line 104
is_int()
bool is_int() const
True for the Int kind.
Declared in ClikaRT/compute/ops.h, line 106
is_float()
bool is_float() const
True for the Float kind.
Declared in ClikaRT/compute/ops.h, line 108
bool_value()
bool bool_value() const
The boolean payload; meaningful when is_bool().
Declared in ClikaRT/compute/ops.h, line 110
int_value()
std::int64_t int_value() const
The integer payload; meaningful when is_int().
Declared in ClikaRT/compute/ops.h, line 112
float_value()
double float_value() const
The double payload; meaningful when is_float().
Declared in ClikaRT/compute/ops.h, line 114