Mathematics and formatting

Operations on values and their textual representations.

std::string snt::val::to_string(val::BaseValue::PointerType value, int precision = static_cast<int>(std::cout.precision()))

Format a VAL value.

Parameters:
  • value – Value to format.

  • precision – Number of significant digits.

Returns:

Formatted value.

std::string snt::val::to_string(const val::Array::ShapeType &shape)

Format an array shape.

Parameters:

shape – Dimensions of the array.

Returns:

Formatted shape.

val::BaseValue::PointerType snt::val::math::abs(val::BaseValue::PointerType a)

Return the element-wise absolute value of a VAL value.

val::BaseValue::PointerType snt::val::math::cbrt(val::BaseValue::PointerType a)

Apply the cube root operation to a value.

val::BaseValue::PointerType snt::val::math::exp(val::BaseValue::PointerType e)

Return the element-wise exponential of a VAL value.

Parameters:

e – Value whose exponential is evaluated.

val::BaseValue::PointerType snt::val::math::log(val::BaseValue::PointerType a)

Return the element-wise natural logarithm of a VAL value.

Parameters:

a – Value whose logarithm is evaluated.

val::BaseValue::PointerType snt::val::math::log10(val::BaseValue::PointerType a)

Return the element-wise base-10 logarithm of a VAL value.

Parameters:

a – Value whose logarithm is evaluated.

val::BaseValue::PointerType snt::val::math::max(val::BaseValue::PointerType a1, val::BaseValue::PointerType a2)

Apply the max operation to this operand.

Parameters:
  • a1 – First operand.

  • a2 – Second operand.

val::BaseValue::PointerType snt::val::math::pow(val::BaseValue::PointerType a, const double e)

Apply the pow operation to this operand.

Parameters:
  • a – First operand.

  • e – Exponent value.

val::BaseValue::PointerType snt::val::math::pow(val::BaseValue::PointerType a, val::BaseValue::PointerType e)

Apply the pow operation to this operand.

Parameters:
  • a – First operand.

  • e – Exponent value.

val::BaseValue::PointerType snt::val::math::sqrt(val::BaseValue::PointerType a)

Return the element-wise square root of a VAL value.

Parameters:

a – Value whose square root is evaluated.