Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::math Namespace Reference

Namespace for mathematical functions. More...

Functions

__host__ __device__ Real3 vecMul (Real3 u, Real3 v)
 Vector cross product of u by v in \(R^3\).
__host__ __device__ Real vecMul2D (Real3 u, Real3 v)
 Vector cross product of u by v in \(R^2\).
__host__ __device__ Real cross2D (Real3 u, Real3 v)
 Vector cross product of u by v in \(R^2\).
__host__ __device__ Real dot (Real2 u, Real2 v)
 Dot product of u by v in \(R^2\).
__host__ __device__ Real scaMul (Real2 u, Real2 v)
 Dot product of u by v in \(R^2\).
__host__ __device__ Real dot (Real3 u, Real3 v)
 Dot product of u by v.
__host__ __device__ Real scaMul (Real3 u, Real3 v)
 Dot product of u by v.
__host__ __device__ Real mixteMul (Real3 u, Real3 v, Real3 w)
 Mixed product of u, v and w.
__host__ __device__ Real matDet (Real3 u, Real3 v, Real3 w)
 Determinant of the matrix u,v,w.
Real3x3 prodTens (Real3 u, Real3 v)
 Tensor product of two Real3 vectors.
__host__ __device__ Real3 prodTensVec (Real3x3 t, Real3 v)
 Matrix-vector product between a tensor and a vector.
__host__ __device__ Real2 prodTensVec (Real2x2 t, Real2 v)
__host__ __device__ Real3 prodVecTens (Real3 v, Real3x3 t)
 Transposed(vector) matrix product between the transpose of a vector and a matrix.
__host__ __device__ Real3x3 matrixProduct (const Real3x3 &t, const Real3x3 &v)
 Matrix-matrix product between two tensors.
__host__ __device__ Real3x3 transpose (const Real3x3 &t)
 Transpose the matrix.
__host__ __device__ Real3x3 matrixTranspose (const Real3x3 &t)
 Transpose the matrix.
__host__ __device__ Real doubleContraction (const Real3x3 &u, const Real3x3 &v)
__host__ __device__ Real doubleContraction (const Real2x2 &u, const Real2x2 &v)
__host__ __device__ Real2 min (Real2 a, Real2 b)
 Returns the minimum of two Real2.
__host__ __device__ Real3 min (Real3 a, Real3 b)
 Returns the minimum of two Real3s.
__host__ __device__ Real2x2 min (const Real2x2 &a, const Real2x2 &b)
 Returns the minimum of two Real2x2s.
__host__ __device__ Real3x3 min (const Real3x3 &a, const Real3x3 &b)
 Returns the minimum of two Real3x3s.
template<class T>
min (const T &a, const T &b, const T &c)
 Returns the minimum of three elements.
template<class T>
max (const T &a, const T &b, const T &c)
 Returns the maximum of three elements.
__host__ __device__ Real2 max (Real2 a, Real2 b)
 Returns the maximum of two Real2s.
__host__ __device__ Real3 max (Real3 a, Real3 b)
 Returns the maximum of two Real3s.
__host__ __device__ Real2x2 max (const Real2x2 &a, const Real2x2 &b)
 Returns the maximum of two Real2x2s.
__host__ __device__ Real3x3 max (const Real3x3 &a, const Real3x3 &b)
 Returns the maximum of two Real3x3s.
__host__ __device__ Real min4Real (Real a, Real b, Real c, Real d)
 Returns the minimum of four Reals.
__host__ __device__ Real max4Real (Real a, Real b, Real c, Real d)
 Returns the maximum of four Reals.
__host__ __device__ Real min8Real (const Real a[8])
 Returns the minimum of eight Reals.
Real max8Real (const Real a[8])
 Returns the maximum of eight Reals.
__host__ __device__ Real minMod (Real a, Real b, Real c, Real d)
 Returns the Min mod of four Reals.
__host__ __device__ Real minMod2 (Real a, Real b)
 Returns the Min mod of two Reals.
__host__ __device__ Real maxMod2 (Real a, Real b)
 Returns the Max mod of two Reals.
Real relativeError (Real a, Real b)
 Returns the relative error between two scalars a and b.
Real relativeError (const Real3x3 &T1, const Real3x3 &T2)
 Returns the relative error between two tensors T1 and T2.
Real relativeError2 (Real a, Real b)
 Returns the relative error between two scalars a and b relative to b.
Real relativeError1 (Real a, Real b)
 Returns the relative error between two scalars a and b relative to a.
bool searchExtrema (ConstArrayView< Real2 > array, Real &xmin, Real &xmax, Real &ymin, Real &ymax, bool need_init)
 Searches for the extreme values of an array of pairs (x,y).
__host__ __device__ Real matrixDeterminant (Real3x3 m)
 Calculates the determinant of a 3x3 matrix.
Real normeR3 (Real3 v1)
 Norm of a vector.
__host__ __device__ Real3x3 matrix3x3Id ()
 Identity matrix.
__host__ __device__ Real3x3 inverseMatrix (const Real3x3 &m, Real d)
 Calculates the inverse of a matrix m assuming its determinant d is known.
__host__ __device__ Real3x3 inverseMatrix (const Real3x3 &m)
 Calculates the inverse of a matrix m.
Real3 crossProduct3 (Real3 v1, Real3 v2)
 Cross product of two 3-component vectors.
__host__ __device__ Real3 cross (Real3 v1, Real3 v2)
 Cross product of two 3-component vectors.
__host__ __device__ Real3 normalizeReal3 (Real3 v)
 Normalization of a Real3.
Real3 normalizedCrossProduct3 (Real3 v1, Real3 v2)
 Normalized cross product.
Real3x3 matrix3x3Transp (Real3x3 m)
Real3x3 matrix3x3Prod (Real3x3 m1, Real3x3 m2)
 Multiplication of 2 3x3 matrices.
__host__ __device__ Real3 multiply (const Real3x3 &m, Real3 v)
 3x3 matrix multiplied by a vector.
bool isNearlyId (Real3x3 m, Real epsilon=1.e-10)
 Checks if a matrix is the identity matrix.
Real3 planarSymmetric (Real3 u, Real3 n)
 Symmetry of a vector u with respect to a normal plane n.
Real3 axisSymmetric (Real3 u, Real3 a)
 Symmetry of a vector u with respect to an axis defined by direction vector a.
template<typename T>
void add (ArrayView< T > lhs, ConstArrayView< T > copy_array)
 Adds the array copy_array to the instance.
template<typename T>
void add (ArrayView< T > lhs, ArrayView< T > copy_array)
 Adds the array copy_array to the instance.
template<typename T>
void sub (ArrayView< T > lhs, ConstArrayView< T > copy_array)
 Subtracts the array copy_array from the instance.
template<typename T>
void sub (ArrayView< T > lhs, ArrayView< T > copy_array)
 Subtracts the array copy_array from the instance.
template<typename T>
void mult (ArrayView< T > lhs, ConstArrayView< T > copy_array)
 Multiplies the elements of the instance term-by-term by the elements of the array copy_array.
template<typename T>
void mult (ArrayView< T > lhs, ArrayView< T > copy_array)
 Multiplies the elements of the instance term-by-term by the elements of the array copy_array.
template<typename T>
void mult (ArrayView< T > lhs, T o)
 Multiplies all elements of the array by the real number o.
template<typename T>
void power (ArrayView< T > lhs, T o)
 Raises all elements of the array to the power o.
SimdReal3 cross (const SimdReal3 &u, const SimdReal3 &v)
 Vector product of u by v in R^3.
SimdReal cross2D (const SimdReal3 &u, const SimdReal3 &v)
 Vector product of u by v in R^2.
SimdReal dot (const SimdReal3 &u, const SimdReal3 &v)
SimdReal dot (const SimdReal2 &u, const SimdReal2 &v)
SimdReal abs (const SimdReal3 &sr)
SimdReal abs (const SimdReal2 &sr)
SimdReal normL2 (const SimdReal3 &sr)
SimdReal normL2 (const SimdReal2 &sr)
SimdReal mixteMul (const SimdReal3 &u, const SimdReal3 &v, const SimdReal3 &w)
 Mixed product of u, v and w.
SimdReal3x3 prodTens (const SimdReal3 &u, const SimdReal3 &v)
SimdReal3x3 matrixProduct (const SimdReal3x3 &t, const SimdReal3x3 &v)
 Matrix-matrix product between two tensors.
SimdReal3x3 matrixTranspose (const SimdReal3x3 &t)
 Transpose the matrix.
__host__ __device__ SimdReal2 min (const SimdReal2 &a, const SimdReal2 &b)
 Returns the minimum of two SimdReal2.
__host__ __device__ SimdReal3 min (const SimdReal3 &a, const SimdReal3 &b)
 Returns the minimum of two SimdReal3.
SimdReal2x2 min (const SimdReal2x2 &a, const SimdReal2x2 &b)
 Returns the minimum of two SimdReal2x2.
SimdReal3x3 min (const SimdReal3x3 &a, const SimdReal3x3 &b)
 Returns the minimum of two SimdReal3x3.
__host__ __device__ SimdReal2 max (const SimdReal2 &a, const SimdReal2 &b)
 Returns the maximum of two SimdReal2.
__host__ __device__ SimdReal3 max (const SimdReal3 &a, const SimdReal3 &b)
 Returns the maximum of two SimdReal3.
SimdReal2x2 max (const SimdReal2x2 &a, const SimdReal2x2 &b)
 Returns the maximum of two SimdReal2x2.
SimdReal3x3 max (const SimdReal3x3 &a, const SimdReal3x3 &b)
 Returns the maximum of two SimdReal3x3.
template<class _Type>
bool isNearlyZero (const BuiltInProxy< _Type > &a)
template<class _Type>
bool isZero (const BuiltInProxy< _Type > &a)
 Tests if a value is exactly equal to zero.
__host__ __device__ double log (double v)
 Natural logarithm of v.
__host__ __device__ long double log (long double v)
 Natural logarithm of v.
__host__ __device__ double log10 (double v)
 Decimal logarithm of v.
__host__ __device__ long double log10 (long double v)
 Decimal logarithm of v.
__host__ __device__ double floor (double v)
 Round v down to the immediately lower integer.
__host__ __device__ long double floor (long double v)
 Round v down to the immediately lower integer.
__host__ __device__ double exp (double v)
 Exponential of v.
__host__ __device__ long double exp (long double v)
 Exponential of v.
__host__ __device__ double sqrt (double v)
 Square root of v.
__host__ __device__ long double sqrt (long double v)
 Square root of v.
__host__ __device__ double pow (double x, double y)
 Power function.
__host__ __device__ long double pow (long double x, long double y)
 Power function.
__host__ __device__ long double pow (double x, long double y)
 Power function.
__host__ __device__ long double pow (long double x, double y)
 Power function.
template<class T>
__host__ __device__ T min (const T &a, const T &b)
 Returns the minimum of two elements.
__host__ __device__ long double min (long double a, long double b)
 Returns the minimum of two real numbers.
__host__ __device__ long double min (double a, long double b)
 Returns the minimum of two real numbers.
__host__ __device__ long double min (long double a, double b)
 Returns the minimum of two real numbers.
__host__ __device__ double min (double a, double b)
 Returns the minimum of two real numbers.
__host__ __device__ float min (float a, float b)
 Returns the minimum of two real numbers.
__host__ __device__ int min (int a, int b)
 Returns the minimum of two integers.
template<class T>
__host__ __device__ T max (const T &a, const T &b)
 Returns the maximum of two elements.
__host__ __device__ long double max (long double a, long double b)
 Returns the maximum of two real numbers.
__host__ __device__ long double max (double a, long double b)
 Returns the maximum of two real numbers.
__host__ __device__ long double max (long double a, double b)
 Returns the maximum of two real numbers.
__host__ __device__ unsigned long max (unsigned long a, unsigned long b)
 Returns the maximum of two integers.
__host__ __device__ double max (double a, double b)
 Returns the maximum of two real numbers.
__host__ __device__ float max (float a, float b)
 Returns the maximum of two real numbers.
__host__ __device__ Int16 max (Int16 a, Int16 b)
 Returns the maximum of two Int16.
__host__ __device__ Int32 max (Int32 a, Int32 b)
 Returns the maximum of two Int32.
__host__ __device__ Int64 max (Int32 a, Int64 b)
 Returns the maximum of two Int32.
__host__ __device__ Int64 max (Int64 a, Int32 b)
 Returns the maximum of two Int64.
__host__ __device__ Int64 max (Int64 a, Int64 b)
 Returns the maximum of two Int64.
__host__ __device__ long double abs (long double a)
 Returns the absolute value of a real number.
__host__ __device__ double abs (double a)
 Returns the absolute value of a real number.
__host__ __device__ float abs (float a)
 Returns the absolute value of a real number.
__host__ __device__ short abs (short a)
 Returns the absolute value of an 'int'.
__host__ __device__ int abs (int a)
 Returns the absolute value of an 'int'.
__host__ __device__ long abs (long a)
 Returns the absolute value of a 'long'.
__host__ __device__ long long abs (long long a)
 Returns the absolute value of a 'long'.
double truncateDouble (double v, Integer nb_digit)
 Truncates the precision of the real number v to nb_digit significant figures.
void truncateDouble (ArrayView< double > values, Integer nb_digit)
 Truncates the precision of the array of real numbers values to nb_digit significant figures.
apfloat log (apfloat v)
 Natural logarithm of v.
apfloat floor (apfloat v)
 Round v down to the immediately lower integer.
apfloat exp (apfloat v)
 Exponential of v.
apfloat sqrt (apfloat v)
 Square root of v.
apfloat pow (apfloat x, apfloat y)
 Power function.
apfloat min (apfloat a, apfloat b)
 Returns the minimum of two real numbers.
apfloat max (apfloat a, apfloat b)
 Returns the maximum of two real numbers.
apfloat abs (apfloat a)
 Returns the absolute value of a real number.
template<class _Type>
constexpr __host__ __device__ bool isNearlyEqual (const _Type &a, const _Type &b)
 Tests if two values are approximately equal. For integer types, this function is equivalent to IsEqual(). In the case of real types, the two numbers are considered equal if and only if the absolute value of their relative difference is less than a given epsilon. This epsilon is equal to float_info<_Type>::nearlyEpsilon().
constexpr __host__ __device__ bool isNearlyEqual (Real a, Real b)
 Overload for reals.
template<class _Type>
constexpr __host__ __device__ bool isNearlyEqualWithEpsilon (const _Type &a, const _Type &b, const _Type &epsilon)
 Tests if two values are approximately equal. For integer types, this function is equivalent to IsEqual(). In the case of real types, the two numbers are considered equal if and only if the absolute value of their relative difference is less than epsilon.
__host__ __device__ constexpr bool isNearlyEqualWithEpsilon (Real a, Real b, Real epsilon)
 Overload for reals.
template<class _Type>
constexpr __host__ __device__ bool isEqual (const _Type &a, const _Type &b)
 Tests the bit-by-bit equality between two values.
__host__ __device__ constexpr bool isEqual (Real a, Real b)
 Overload for reals.
template<class _Type>
constexpr __host__ __device__ bool isNearlyZeroWithEpsilon (const _Type &a, const _Type &epsilon)
 Tests if a value is approximately equal to zero within an epsilon.
template<class _Type>
constexpr __host__ __device__ bool isNearlyZero (const _Type &a)
 Tests if a value is approximately equal to zero using the standard epsilon.
template<class _Type>
constexpr __host__ __device__ bool isZero (const _Type &a)
 Tests if a value is exactly equal to zero.
constexpr __host__ __device__ bool isNearlyZero (const Real2 &v)
 Indicates if the instance is close to the zero instance.
constexpr __host__ __device__ Real squareNormL2 (const Real2 &v)
 Returns the squared norm of the pair $ \(x^2+y^2+z^2$\).
__host__ __device__ Real normL2 (const Real2 &v)
 Returns the norm of the pair $ \(\sqrt{x^2+y^2+z^2}$\).
Real2mutableNormalize (Real2 &v)
 Normalizes the pair.
Real2 normalizeL2 (const Real2 &v)
 Returns the pair v normalized by the L2 norm.
constexpr __host__ __device__ bool isNearlyZero (const Real2x2 &v)
 Compares the matrix with the zero matrix.
constexpr __host__ __device__ Real squareNormL2 (const Real3 &v)
 Returns the square of the L2 norm of the triplet $ \(x^2+y^2+z^2\).
constexpr __host__ __device__ bool isNearlyZero (const Real3 &v)
 Indicates if the instance is close to the zero instance.
__host__ __device__ Real normL2 (const Real3 &v)
 Returns the L2 norm of the triplet $ \(\sqrt{v.x^2+v.y^2+v.z^2}\).
Real3mutableNormalize (Real3 &v)
 Normalizes the triplet v.
Real3 normalizeL2 (const Real3 &v)
 Returns the triplet v normalized with the L2 norm.
constexpr __host__ __device__ bool isNearlyZero (const Real3x3 &v)
 Compares the matrix with the zero matrix.
EMULSimdReal min (EMULSimdReal a, EMULSimdReal b)
EMULSimdReal min (EMULSimdReal a, Real b)
EMULSimdReal min (Real a, EMULSimdReal b)
EMULSimdReal max (EMULSimdReal a, EMULSimdReal b)
EMULSimdReal max (EMULSimdReal a, Real b)
EMULSimdReal max (Real a, EMULSimdReal b)
EMULSimdReal sqrt (EMULSimdReal a)
EMULSimdReal exp (EMULSimdReal a)
EMULSimdReal log10 (EMULSimdReal a)

Detailed Description

Namespace for mathematical functions.

This namespace contains all the mathematical functions used by the code.

This namespace contains all mathematical functions used by the code.

Function Documentation

◆ abs() [1/2]

SimdReal Arcane::math::abs ( const SimdReal2 & sr)
inline

Definition at line 76 of file SimdMathUtils.h.

◆ abs() [2/2]

SimdReal Arcane::math::abs ( const SimdReal3 & sr)
inline

Definition at line 63 of file SimdMathUtils.h.

◆ add() [1/2]

template<typename T>
void Arcane::math::add ( ArrayView< T > lhs,
ArrayView< T > copy_array )
inline

Adds the array copy_array to the instance.

Since no memory allocation is performed, the number of elements in copy_array must be less than or equal to the current number of elements. If it is smaller, the elements of the current array located at the end of the array remain unchanged

Definition at line 946 of file MathUtils.h.

References Arcane::ArrayView< T >::data(), and Arcane::ArrayView< T >::size().

◆ add() [2/2]

template<typename T>
void Arcane::math::add ( ArrayView< T > lhs,
ConstArrayView< T > copy_array )
inline

Adds the array copy_array to the instance.

Since no memory allocation is performed, the number of elements in copy_array must be less than or equal to the current number of elements. If it is smaller, the elements of the current array located at the end of the array remain unchanged

Definition at line 927 of file MathUtils.h.

References Arcane::ArrayView< T >::data(), Arcane::ConstArrayView< T >::data(), Arcane::ArrayView< T >::size(), and Arcane::ConstArrayView< T >::size().

◆ cross()

SimdReal3 Arcane::math::cross ( const SimdReal3 & u,
const SimdReal3 & v )
inline

Vector product of u by v in R^3.

Definition at line 32 of file SimdMathUtils.h.

◆ cross2D()

SimdReal Arcane::math::cross2D ( const SimdReal3 & u,
const SimdReal3 & v )
inline

Vector product of u by v in R^2.

Definition at line 44 of file SimdMathUtils.h.

◆ crossProduct3()

Real3 Arcane::math::crossProduct3 ( Real3 v1,
Real3 v2 )
inline

Cross product of two 3-component vectors.

Deprecated
Use cross() instead.

Definition at line 741 of file MathUtils.h.

References Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ dot() [1/2]

SimdReal Arcane::math::dot ( const SimdReal2 & u,
const SimdReal2 & v )
inline

Definition at line 56 of file SimdMathUtils.h.

◆ dot() [2/2]

SimdReal Arcane::math::dot ( const SimdReal3 & u,
const SimdReal3 & v )
inline

Definition at line 50 of file SimdMathUtils.h.

◆ doubleContraction() [1/2]

__host__ __device__ Real Arcane::math::doubleContraction ( const Real2x2 & u,
const Real2x2 & v )
inline

} U_{i,j}V_{i,j}

Definition at line 324 of file MathUtils.h.

References Arcane::Real2POD::x, Arcane::Real2x2::x, Arcane::Real2POD::y, and Arcane::Real2x2::y.

◆ doubleContraction() [2/2]

__host__ __device__ Real Arcane::math::doubleContraction ( const Real3x3 & u,
const Real3x3 & v )
inline

◆ exp() [1/4]

apfloat Arcane::math::exp ( apfloat v)
inline

Exponential of v.

Definition at line 57 of file MathApfloat.h.

◆ exp() [2/4]

__host__ __device__ double Arcane::math::exp ( double v)
inline

Exponential of v.

Definition at line 121 of file Math.h.

◆ exp() [3/4]

EMULSimdReal Arcane::math::exp ( EMULSimdReal a)
inline

Definition at line 118 of file SimdOperation.h.

◆ exp() [4/4]

__host__ __device__ long double Arcane::math::exp ( long double v)
inline

Exponential of v.

Definition at line 130 of file Math.h.

◆ floor() [1/3]

apfloat Arcane::math::floor ( apfloat v)
inline

Round v down to the immediately lower integer.

Definition at line 45 of file MathApfloat.h.

◆ floor() [2/3]

__host__ __device__ double Arcane::math::floor ( double v)
inline

Round v down to the immediately lower integer.

Definition at line 100 of file Math.h.

Referenced by Arcane::OutputChecker::check(), pow(), pow(), and pow().

◆ floor() [3/3]

__host__ __device__ long double Arcane::math::floor ( long double v)
inline

Round v down to the immediately lower integer.

Definition at line 109 of file Math.h.

◆ inverseMatrix() [1/2]

__host__ __device__ Real3x3 Arcane::math::inverseMatrix ( const Real3x3 & m)
inline

Calculates the inverse of a matrix m.

Definition at line 726 of file MathUtils.h.

References Arcane::Real3x3::determinant(), and inverseMatrix().

◆ inverseMatrix() [2/2]

__host__ __device__ Real3x3 Arcane::math::inverseMatrix ( const Real3x3 & m,
Real d )
inline

Calculates the inverse of a matrix m assuming its determinant d is known.

Definition at line 710 of file MathUtils.h.

References Arcane::Real3POD::x, Arcane::Real3x3::x, Arcane::Real3POD::y, Arcane::Real3x3::y, Arcane::Real3POD::z, and Arcane::Real3x3::z.

Referenced by inverseMatrix().

◆ isEqual() [1/2]

template<class _Type>
__host__ __device__ bool Arcane::math::isEqual ( const _Type & a,
const _Type & b )
inlineconstexpr

Tests the bit-by-bit equality between two values.

Return values
trueif the two values are equal,
falseotherwise.

Definition at line 260 of file Numeric.h.

References Arcane::TypeEqualT< T >::isEqual().

Referenced by Arcane::CaseTable::_findValue(), Arcane::OutputChecker::check(), and Arcane::VariableRefScalarT< Byte >::isEqual().

◆ isEqual() [2/2]

__host__ __device__ constexpr bool Arcane::math::isEqual ( Real a,
Real b )
inlineconstexpr

Overload for reals.

Definition at line 267 of file Numeric.h.

References Arcane::TypeEqualT< T >::isEqual().

◆ isNearlyEqual() [1/2]

template<class _Type>
__host__ __device__ bool Arcane::math::isNearlyEqual ( const _Type & a,
const _Type & b )
inlineconstexpr

Tests if two values are approximately equal. For integer types, this function is equivalent to IsEqual(). In the case of real types, the two numbers are considered equal if and only if the absolute value of their relative difference is less than a given epsilon. This epsilon is equal to float_info<_Type>::nearlyEpsilon().

Return values
trueif the two values are equal,
falseotherwise.

Definition at line 219 of file Numeric.h.

References Arcane::TypeEqualT< T >::isNearlyEqual().

Referenced by Arcane::VariableRefScalarT< Byte >::isNearlyEqual().

◆ isNearlyEqual() [2/2]

__host__ __device__ bool Arcane::math::isNearlyEqual ( Real a,
Real b )
inlineconstexpr

Overload for reals.

Definition at line 226 of file Numeric.h.

References Arcane::TypeEqualT< T >::isNearlyEqual().

◆ isNearlyEqualWithEpsilon() [1/2]

template<class _Type>
__host__ __device__ bool Arcane::math::isNearlyEqualWithEpsilon ( const _Type & a,
const _Type & b,
const _Type & epsilon )
inlineconstexpr

Tests if two values are approximately equal. For integer types, this function is equivalent to IsEqual(). In the case of real types, the two numbers are considered equal if and only if the absolute value of their relative difference is less than epsilon.

Return values
trueif the two values are equal,
falseotherwise.

Definition at line 242 of file Numeric.h.

References Arcane::TypeEqualT< T >::isNearlyEqualWithEpsilon().

◆ isNearlyEqualWithEpsilon() [2/2]

__host__ __device__ constexpr bool Arcane::math::isNearlyEqualWithEpsilon ( Real a,
Real b,
Real epsilon )
inlineconstexpr

Overload for reals.

Definition at line 249 of file Numeric.h.

References Arcane::TypeEqualT< T >::isNearlyEqualWithEpsilon().

◆ isNearlyId()

bool Arcane::math::isNearlyId ( Real3x3 m,
Real epsilon = 1.e-10 )
inline

Checks if a matrix is the identity matrix.

Definition at line 861 of file MathUtils.h.

References Arcane::Real3POD::x, Arcane::Real3x3::x, Arcane::Real3POD::y, Arcane::Real3x3::y, Arcane::Real3POD::z, and Arcane::Real3x3::z.

◆ isNearlyZero() [1/6]

template<class _Type>
__host__ __device__ bool Arcane::math::isNearlyZero ( const _Type & a)
inlineconstexpr

Tests if a value is approximately equal to zero using the standard epsilon.

The standard epsilon is the one returned by FloatInfo<_Type>::nearlyEpsilon().

See also
isNearlyZero(const _Type& a,const _Type& epsilon).

Definition at line 296 of file Numeric.h.

References Arcane::TypeEqualT< T >::isNearlyZero().

◆ isNearlyZero() [2/6]

template<class _Type>
bool Arcane::math::isNearlyZero ( const BuiltInProxy< _Type > & a)
inline

Definition at line 180 of file BuiltInProxy.h.

◆ isNearlyZero() [3/6]

__host__ __device__ bool Arcane::math::isNearlyZero ( const Real2 & v)
inlineconstexpr

Indicates if the instance is close to the zero instance.

Return values
trueif math::isNearlyZero() is true for every component.
falseotherwise.

Definition at line 470 of file Real2.h.

References Arcane::Real2POD::x, and Arcane::Real2POD::y.

◆ isNearlyZero() [4/6]

__host__ __device__ bool Arcane::math::isNearlyZero ( const Real2x2 & v)
constexpr

Compares the matrix with the zero matrix.

The matrix is zero if and only if each of its components is less than a given epsilon. The epsilon value used is that of float_info<value_type>::nearlyEpsilon():

\[A=0 \Leftrightarrow |A.x|<\epsilon,|A.y|<\epsilon\]

Return values
trueif the matrix is equal to the zero matrix,
falseotherwise.

Definition at line 457 of file Real2x2.h.

References Arcane::Real2x2::x, and Arcane::Real2x2::y.

◆ isNearlyZero() [5/6]

__host__ __device__ bool Arcane::math::isNearlyZero ( const Real3 & v)
inlineconstexpr

Indicates if the instance is close to the zero instance.

Return values
trueif math::isNearlyZero() is true for every component.
falseotherwise.

Definition at line 516 of file Real3.h.

References Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ isNearlyZero() [6/6]

__host__ __device__ bool Arcane::math::isNearlyZero ( const Real3x3 & v)
inlineconstexpr

Compares the matrix with the zero matrix.

The matrix is zero if and only if each of its components is less than a given epsilon. The epsilon value used is that of float_info<value_type>::nearlyEpsilon():

\[A=0 \Leftrightarrow |A.x|<\epsilon,|A.y|<\epsilon,|A.z|<\epsilon \]

Return values
trueif the matrix is equal to the zero matrix,
falseotherwise.

Definition at line 452 of file Real3x3.h.

References Arcane::Real3x3::x, Arcane::Real3x3::y, and Arcane::Real3x3::z.

◆ isNearlyZeroWithEpsilon()

template<class _Type>
__host__ __device__ bool Arcane::math::isNearlyZeroWithEpsilon ( const _Type & a,
const _Type & epsilon )
inlineconstexpr

Tests if a value is approximately equal to zero within an epsilon.

For integer types, this function is equivalent to IsZero(). In the case of real types, the value is considered equal to zero if and only if its absolute value is less than an epsilon given by the function float_info<_Type>::nearlyEpsilon().

Return values
trueif the two values are equal,
falseotherwise.

Definition at line 283 of file Numeric.h.

◆ isZero() [1/2]

template<class _Type>
__host__ __device__ bool Arcane::math::isZero ( const _Type & a)
inlineconstexpr

Tests if a value is exactly equal to zero.

Return values
trueif is zero,
falseotherwise.

Definition at line 307 of file Numeric.h.

References Arcane::TypeEqualT< T >::isZero().

◆ isZero() [2/2]

template<class _Type>
bool Arcane::math::isZero ( const BuiltInProxy< _Type > & a)
inline

◆ log() [1/3]

apfloat Arcane::math::log ( apfloat v)
inline

Natural logarithm of v.

Definition at line 32 of file MathApfloat.h.

References Arcane::arcaneMathError(), and Arcane::Convert::toDouble().

◆ log() [2/3]

__host__ __device__ double Arcane::math::log ( double v)
inline

Natural logarithm of v.

Definition at line 42 of file Math.h.

References Arcane::arcaneMathError().

◆ log() [3/3]

__host__ __device__ long double Arcane::math::log ( long double v)
inline

Natural logarithm of v.

Definition at line 55 of file Math.h.

References Arcane::arcaneMathError().

◆ log10() [1/3]

__host__ __device__ double Arcane::math::log10 ( double v)
inline

Decimal logarithm of v.

Definition at line 71 of file Math.h.

References Arcane::arcaneMathError().

◆ log10() [2/3]

EMULSimdReal Arcane::math::log10 ( EMULSimdReal a)
inline

Definition at line 127 of file SimdOperation.h.

◆ log10() [3/3]

__host__ __device__ long double Arcane::math::log10 ( long double v)
inline

Decimal logarithm of v.

Definition at line 84 of file Math.h.

References Arcane::arcaneMathError().

◆ matDet()

__host__ __device__ Real Arcane::math::matDet ( Real3 u,
Real3 v,
Real3 w )
inline

Determinant of the matrix u,v,w.

Definition at line 173 of file MathUtils.h.

References Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ matrix3x3Id()

__host__ __device__ Real3x3 Arcane::math::matrix3x3Id ( )
inline

Identity matrix.

Definition at line 696 of file MathUtils.h.

◆ matrix3x3Prod()

Real3x3 Arcane::math::matrix3x3Prod ( Real3x3 m1,
Real3x3 m2 )
inline

Multiplication of 2 3x3 matrices.

Warning
This method does not use the usual convention for Real3x3. It assumes they are stored in columns. Generally, you should use matrixProduct() instead.

Definition at line 827 of file MathUtils.h.

References Arcane::Real3x3::fromColumns(), Arcane::Real3POD::x, Arcane::Real3x3::x, Arcane::Real3POD::y, Arcane::Real3x3::y, Arcane::Real3POD::z, and Arcane::Real3x3::z.

◆ matrixDeterminant()

__host__ __device__ Real Arcane::math::matrixDeterminant ( Real3x3 m)
inline

Calculates the determinant of a 3x3 matrix.

Definition at line 670 of file MathUtils.h.

References Arcane::Real3x3::determinant().

◆ max() [1/3]

EMULSimdReal Arcane::math::max ( EMULSimdReal a,
EMULSimdReal b )
inline

Definition at line 87 of file SimdOperation.h.

◆ max() [2/3]

EMULSimdReal Arcane::math::max ( EMULSimdReal a,
Real b )
inline

Definition at line 92 of file SimdOperation.h.

◆ max() [3/3]

EMULSimdReal Arcane::math::max ( Real a,
EMULSimdReal b )
inline

Definition at line 97 of file SimdOperation.h.

◆ max4Real()

__host__ __device__ Real Arcane::math::max4Real ( Real a,
Real b,
Real c,
Real d )
inline

Returns the maximum of four Reals.

Definition at line 477 of file MathUtils.h.

References max().

Referenced by max8Real(), and minMod().

◆ max8Real()

Real Arcane::math::max8Real ( const Real a[8])
inline

Returns the maximum of eight Reals.

Definition at line 500 of file MathUtils.h.

References max(), and max4Real().

◆ min() [1/3]

EMULSimdReal Arcane::math::min ( EMULSimdReal a,
EMULSimdReal b )
inline

Definition at line 70 of file SimdOperation.h.

◆ min() [2/3]

EMULSimdReal Arcane::math::min ( EMULSimdReal a,
Real b )
inline

Definition at line 75 of file SimdOperation.h.

◆ min() [3/3]

EMULSimdReal Arcane::math::min ( Real a,
EMULSimdReal b )
inline

Definition at line 80 of file SimdOperation.h.

◆ min4Real()

__host__ __device__ Real Arcane::math::min4Real ( Real a,
Real b,
Real c,
Real d )
inline

Returns the minimum of four Reals.

Definition at line 465 of file MathUtils.h.

References min().

Referenced by min8Real(), and minMod().

◆ min8Real()

__host__ __device__ Real Arcane::math::min8Real ( const Real a[8])
inline

Returns the minimum of eight Reals.

Definition at line 489 of file MathUtils.h.

References min(), and min4Real().

◆ mixteMul()

SimdReal Arcane::math::mixteMul ( const SimdReal3 & u,
const SimdReal3 & v,
const SimdReal3 & w )
inline

Mixed product of u, v and w.

Definition at line 115 of file SimdMathUtils.h.

References cross(), and dot().

◆ mult() [1/3]

template<typename T>
void Arcane::math::mult ( ArrayView< T > lhs,
ArrayView< T > copy_array )
inline

Multiplies the elements of the instance term-by-term by the elements of the array copy_array.

Since no memory allocation is performed, the number of elements in copy_array must be less than or equal to the current number of elements. If it is smaller, the elements of the current array located at the end of the array remain unchanged

Definition at line 1026 of file MathUtils.h.

References Arcane::ArrayView< T >::constView(), and mult().

◆ mult() [2/3]

template<typename T>
void Arcane::math::mult ( ArrayView< T > lhs,
ConstArrayView< T > copy_array )
inline

Multiplies the elements of the instance term-by-term by the elements of the array copy_array.

Since no memory allocation is performed, the number of elements in copy_array must be less than or equal to the current number of elements. If it is smaller, the elements of the current array located at the end of the array remain unchanged

Definition at line 1005 of file MathUtils.h.

References Arcane::ArrayView< T >::data(), Arcane::ConstArrayView< T >::data(), Arcane::ArrayView< T >::size(), and Arcane::ConstArrayView< T >::size().

Referenced by mult().

◆ mult() [3/3]

template<typename T>
void Arcane::math::mult ( ArrayView< T > lhs,
T o )
inline

Multiplies all elements of the array by the real number o.

Definition at line 1035 of file MathUtils.h.

References Arcane::ArrayView< T >::data(), and Arcane::ArrayView< T >::size().

◆ multiply()

__host__ __device__ Real3 Arcane::math::multiply ( const Real3x3 & m,
Real3 v )
inline

3x3 matrix multiplied by a vector.

Definition at line 848 of file MathUtils.h.

References Arcane::Real3POD::x, Arcane::Real3x3::x, Arcane::Real3POD::y, Arcane::Real3x3::y, Arcane::Real3POD::z, and Arcane::Real3x3::z.

◆ mutableNormalize() [1/2]

Real2 & Arcane::math::mutableNormalize ( Real2 & v)
inline

Normalizes the pair.

If the pair is non-zero, divides each component by the norm of the pair (abs()), such that after calling this method, abs() equals 1. If the pair is zero, does nothing.

Definition at line 494 of file Real2.h.

References Arcane::Real2::divSame(), isZero(), and mutableNormalize().

Referenced by mutableNormalize(), mutableNormalize(), and Arcane::Real2::normalize().

◆ mutableNormalize() [2/2]

Real3 & Arcane::math::mutableNormalize ( Real3 & v)
inline

Normalizes the triplet v.

If the triplet is non-zero, divides each component by the norm of the triplet (abs()), so that after calling this method, math::normL2() equals 1. If the triplet is zero, does nothing.

Definition at line 534 of file Real3.h.

References Arcane::Real3::divSame(), isZero(), and mutableNormalize().

◆ normalizeL2() [1/2]

Real2 Arcane::math::normalizeL2 ( const Real2 & v)
inline

Returns the pair v normalized by the L2 norm.

If math::normL2(v) is non-zero, returns the pair v divided by math::normL2(v). Otherwise, returns v.

Definition at line 508 of file Real2.h.

References isZero(), and normalizeL2().

Referenced by normalizeL2(), and normalizeL2().

◆ normalizeL2() [2/2]

Real3 Arcane::math::normalizeL2 ( const Real3 & v)
inline

Returns the triplet v normalized with the L2 norm.

If math::normL2(v) is non-zero, returns the triplet v divided by math::normL2(v). Otherwise, returns v.

Definition at line 548 of file Real3.h.

References isZero(), and normalizeL2().

◆ normeR3()

Real Arcane::math::normeR3 ( Real3 v1)
inline

Norm of a vector.

Deprecated
Use Real3.abs() instead.

Definition at line 684 of file MathUtils.h.

References sqrt(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ normL2() [1/4]

__host__ __device__ Real Arcane::math::normL2 ( const Real2 & v)
inline

Returns the norm of the pair $ \(\sqrt{x^2+y^2+z^2}$\).

Definition at line 482 of file Real2.h.

References sqrt(), and squareNormL2().

◆ normL2() [2/4]

__host__ __device__ Real Arcane::math::normL2 ( const Real3 & v)
inline

Returns the L2 norm of the triplet $ \(\sqrt{v.x^2+v.y^2+v.z^2}\).

Definition at line 522 of file Real3.h.

References sqrt(), and squareNormL2().

◆ normL2() [3/4]

SimdReal Arcane::math::normL2 ( const SimdReal2 & sr)
inline

Definition at line 100 of file SimdMathUtils.h.

◆ normL2() [4/4]

SimdReal Arcane::math::normL2 ( const SimdReal3 & sr)
inline

Definition at line 88 of file SimdMathUtils.h.

◆ pow() [1/5]

apfloat Arcane::math::pow ( apfloat x,
apfloat y )
inline

Power function.

Calculates x raised to the power of y.

Precondition
x>=0 or y is an integer

Definition at line 89 of file MathApfloat.h.

References Arcane::arcaneMathError(), floor(), and Arcane::Convert::toDouble().

◆ pow() [2/5]

__host__ __device__ double Arcane::math::pow ( double x,
double y )
inline

Power function.

Calculates x to the power of y.

Precondition
x>=0 or y is an integer

Definition at line 175 of file Math.h.

References Arcane::arcaneMathError(), and floor().

Referenced by power().

◆ pow() [3/5]

__host__ __device__ long double Arcane::math::pow ( double x,
long double y )
inline

Power function.

Calculates x to the power of y.

Precondition
x>=0 or y is an integer

Definition at line 214 of file Math.h.

References Arcane::arcaneMathError().

◆ pow() [4/5]

__host__ __device__ long double Arcane::math::pow ( long double x,
double y )
inline

Power function.

Calculates x to the power of y.

Precondition
x>=0 or y is an integer

Definition at line 232 of file Math.h.

References Arcane::arcaneMathError(), and floor().

◆ pow() [5/5]

__host__ __device__ long double Arcane::math::pow ( long double x,
long double y )
inline

Power function.

Calculates x to the power of y.

Precondition
x>=0 or y is an integer

Definition at line 196 of file Math.h.

References Arcane::arcaneMathError().

◆ power()

template<typename T>
void Arcane::math::power ( ArrayView< T > lhs,
T o )
inline

Raises all elements of the array to the power o.

Definition at line 1046 of file MathUtils.h.

References Arcane::ArrayView< T >::data(), pow(), and Arcane::ArrayView< T >::size().

◆ prodTens()

SimdReal3x3 Arcane::math::prodTens ( const SimdReal3 & u,
const SimdReal3 & v )
inline

Definition at line 124 of file SimdMathUtils.h.

◆ prodTensVec()

__host__ __device__ Real2 Arcane::math::prodTensVec ( Real2x2 t,
Real2 v )
inline

Definition at line 216 of file MathUtils.h.

◆ relativeError() [1/2]

Real Arcane::math::relativeError ( const Real3x3 & T1,
const Real3x3 & T2 )
inline

Returns the relative error between two tensors T1 and T2.

The relative error is calculated as the maximum of the relative errors on each of the tensor components.

Definition at line 575 of file MathUtils.h.

References max(), relativeError(), Arcane::Real3POD::x, Arcane::Real3x3::x, Arcane::Real3POD::y, Arcane::Real3x3::y, Arcane::Real3POD::z, and Arcane::Real3x3::z.

◆ relativeError() [2/2]

Real Arcane::math::relativeError ( Real a,
Real b )
inline

Returns the relative error between two scalars a and b.

The relative error is calculated by:

\(\frac{a-b}{|a|+|b|}\)

Definition at line 558 of file MathUtils.h.

References isZero().

Referenced by relativeError().

◆ relativeError1()

Real Arcane::math::relativeError1 ( Real a,
Real b )
inline

Returns the relative error between two scalars a and b relative to a.

The relative error is calculated by:

\(\frac{a-b}{(|b|)}\)

Definition at line 619 of file MathUtils.h.

References isZero().

◆ relativeError2()

Real Arcane::math::relativeError2 ( Real a,
Real b )
inline

Returns the relative error between two scalars a and b relative to b.

The relative error is calculated by:

\(\frac{a-b}{(|b|)}\)

Definition at line 602 of file MathUtils.h.

References isZero().

◆ searchExtrema()

bool Arcane::math::searchExtrema ( ConstArrayView< Real2 > array,
Real & xmin,
Real & xmax,
Real & ymin,
Real & ymax,
bool need_init )
inline

Searches for the extreme values of an array of pairs (x,y).

Definition at line 632 of file MathUtils.h.

References Arcane::ConstArrayView< T >::size().

◆ sqrt() [1/4]

apfloat Arcane::math::sqrt ( apfloat v)
inline

Square root of v.

Definition at line 69 of file MathApfloat.h.

References Arcane::arcaneMathError(), and Arcane::Convert::toDouble().

◆ sqrt() [2/4]

__host__ __device__ double Arcane::math::sqrt ( double v)
inline

Square root of v.

Definition at line 142 of file Math.h.

References Arcane::arcaneMathError().

Referenced by normalizeReal3(), normeR3(), normL2(), and normL2().

◆ sqrt() [3/4]

EMULSimdReal Arcane::math::sqrt ( EMULSimdReal a)
inline

Definition at line 109 of file SimdOperation.h.

◆ sqrt() [4/4]

__host__ __device__ long double Arcane::math::sqrt ( long double v)
inline

Square root of v.

Definition at line 155 of file Math.h.

References Arcane::arcaneMathError().

◆ squareNormL2() [1/2]

__host__ __device__ Real Arcane::math::squareNormL2 ( const Real2 & v)
inlineconstexpr

Returns the squared norm of the pair $ \(x^2+y^2+z^2$\).

Definition at line 476 of file Real2.h.

References squareNormL2(), Arcane::Real2POD::x, and Arcane::Real2POD::y.

Referenced by normL2(), normL2(), squareNormL2(), and squareNormL2().

◆ squareNormL2() [2/2]

__host__ __device__ Real Arcane::math::squareNormL2 ( const Real3 & v)
inlineconstexpr

Returns the square of the L2 norm of the triplet $ \(x^2+y^2+z^2\).

Definition at line 505 of file Real3.h.

References squareNormL2(), Arcane::Real3POD::x, Arcane::Real3POD::y, and Arcane::Real3POD::z.

◆ sub() [1/2]

template<typename T>
void Arcane::math::sub ( ArrayView< T > lhs,
ArrayView< T > copy_array )
inline

Subtracts the array copy_array from the instance.

Since no memory allocation is performed, the number of elements in copy_array must be less than or equal to the current number of elements. If it is smaller, the elements of the current array located at the end of the array remain unchanged

Definition at line 984 of file MathUtils.h.

References Arcane::ArrayView< T >::data(), and Arcane::ArrayView< T >::size().

◆ sub() [2/2]

template<typename T>
void Arcane::math::sub ( ArrayView< T > lhs,
ConstArrayView< T > copy_array )
inline

Subtracts the array copy_array from the instance.

Since no memory allocation is performed, the number of elements in copy_array must be less than or equal to the current number of elements. If it is smaller, the elements of the current array located at the end of the array remain unchanged

Definition at line 965 of file MathUtils.h.

References Arcane::ArrayView< T >::data(), Arcane::ConstArrayView< T >::data(), Arcane::ArrayView< T >::size(), and Arcane::ConstArrayView< T >::size().

◆ transpose()

__host__ __device__ Real3x3 Arcane::math::transpose ( const Real3x3 & t)
inline

◆ truncateDouble() [1/2]

void Arcane::math::truncateDouble ( ArrayView< double > values,
Integer nb_digit )
extern

Truncates the precision of the array of real numbers values to nb_digit significant figures.

On exit, each element of values is modified as if after calling truncateDouble(double v,Integer nb_digit).

Definition at line 89 of file Math.cc.

References Arcane::ArrayView< T >::size().

◆ truncateDouble() [2/2]

double Arcane::math::truncateDouble ( double v,
Integer nb_digit )
extern

Truncates the precision of the real number v to nb_digit significant figures.

For a double-precision real number in IEEE 754, the number of significant bits is 15 or 16 depending on the value. It should be noted that it is not possible to simply and quickly truncate the precision to a given value. This is why nb_digit represents an approximate number of digits. Notably, it is not possible to go below 8 significant figures.

If nb_digit is less than or equal to zero or greater than 15, the value v is returned.

Definition at line 80 of file Math.cc.