chsvlib
chsv helper source code

◆ MultiplicativeInverseMe()

T& Chusov::Math::MultiplicativeInverseMe ( T &  x)
noexcept

A helper function that calculates a multiplicative inversion of a given value of a given type and writes result to the same location as the input value.

Template Parameters
Tis a type of an object to be multiplicatively inverted. It can be either one of the built-in arithmetic type (for which std::is_arithmetic<T>::value is true), or a type supplied by a user.
Parameters
xis an object to be inverted in-place.
Returns
A reference to x.

If std::is_arithmetic<T>::value is true, the call is equivalent to

@ multiplicative_identity
A tag to construct multiplicative identity element. See ring_concept.
Definition: chsvmath.h:1005

, and, if this expression is ill-formed, the call is also ill-formed.

Otherwise, if std::is_arithmetic<T>::value is false, the type T is supposed to be implemented by a user-supplied class or structure providing inverting method

T & MultiplicativeInverseMe(T &x) noexcept(Implementation::is_nothrow_invertible< T >::value)
A helper function that calculates a multiplicative inversion of a given value of a given type and wri...
Definition: chsvmath.h:1062

so that the call

x.MultiplicativeInverseMe()

is valid. Otherwise, the program is ill-formed.

Examples
chsvmath\algebraic_traits.cpp.