Class Constant¶
Defined in File expr.hpp
Inheritance Relationships¶
Base Type¶
public sequant::Expr
(Class Expr)
Class Documentation¶
-
class Constant : public sequant::Expr¶
a constant number
This is represented as a “compile-time” complex rational number
Public Functions
-
Constant() = delete¶
-
virtual ~Constant() = default¶
-
template<typename U, typename = std::enable_if_t<!is_constant_v<U>>>
inline explicit Constant(U &&value)¶
-
template<typename T = decltype(value_)>
inline auto value() const¶ - Template Parameters:
T – the result type; default to the type of value_
- Throws:
std::invalid_argument – if conversion to T is not possible
boost::numeric::positive_overflow – or boost::numeric::negative_overflow if cast fails
- Returns:
the value cast to ResultType
-
inline virtual std::wstring to_latex() const override¶
- Returns:
the string representation of
this
in the LaTeX format
-
inline virtual std::wstring to_wolfram() const override¶
- Returns:
the string representation of
this
in the Wolfram Language format
-
inline virtual type_id_type type_id() const override¶
Computes and returns the derived type identifier
See also
Note
this function must be overridden in the derived class
- Returns:
the hash value for this Expr
-
inline virtual ExprPtr clone() const override¶
Note
- must be overridden in the derived class.
the default implementation throws an exception
- Returns:
a clone of this object, i.e. an object that is equal to
this
-
inline virtual Expr &operator*=(const Expr &that) override¶
in-place multiply
*this
bythat
- Throws:
std::logic_error – if not implemented for this class, or cannot be implemented for the particular
that
- Returns:
reference to
*this
-
inline virtual Expr &operator+=(const Expr &that) override¶
in-place add
that
to*this
- Throws:
std::logic_error – if not implemented for this class, or cannot be implemented for the particular
that
- Returns:
reference to
*this
-
inline virtual Expr &operator-=(const Expr &that) override¶
in-place subtract
that
from*this
- Throws:
std::logic_error – if not implemented for this class, or cannot be implemented for the particular
that
- Returns:
reference to
*this
-
inline bool is_zero() const¶
- Returns:
Constant::is_zero(this->value())
Public Static Functions
-
static inline bool is_zero(scalar_type v)¶
- Parameters:
v – [in] a scalar
- Returns:
true if this is a soft zero, i.e. its magnitude is less than
std::sqrt(std::numeric_limits<float>::epsilon())
-
Constant() = delete¶