Magnetization functions¶
-
namespace
mag¶ Functions
-
double
clamp(const double &x, const double &low, const double &high)¶ Clamp value between boundaries.
- Return
- value clamped between boudaries
- Parameters
x: double value as argument of clamplow: lower boundaryhigh: higher boundary
-
double
lr(const double &x)¶ log1p for magnetizations.
- Return
- value computed as log1p(exp(-2*abs(x)))
- Parameters
x: double value
-
long int
sign0(const double &x)¶ Sign operation valid also for magnetizations.
- Return
- sign evaluated as 1 - 2*signbit(x)
- Parameters
x: double value
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>bool mag::isinf(const double & x) Check if is infinite.
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>bool mag::signbit(const Mag & m) Get the sign of magnetization.
- Return
- boolean sign of magnetization
- Template Parameters
Mag: magnetization type (MagP or MagT)
- Parameters
m: Mag
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>void mag::zeros(Mag * x, const long int & n) Fill a magnetization array with zeros.
- Return
- void
- Template Parameters
Mag: magnetization type (MagP or MagT)
- Parameters
x: mag arrayn: array size
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>void mag::zero(Mag & x) Set magnetization to zero.
- Return
- void
- Template Parameters
Mag: magnetization type (MagP or MagT)
- Parameters
x: mag object
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>double mag::abs(const Mag & a) Abs for magnetization objects.
- Return
- The absolute value of the input
- Template Parameters
Mag: magnetization type (MagP or MagT)
- Parameters
a: mag object
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>Mag mag::copysign(Mag & x, const double & y) Flip magnetization sign if necessary.
- Return
- The corrected mag object
- Template Parameters
Mag: magnetization type (MagP or MagT)
- Parameters
x: mag objecty: value with desired sign
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>Mag mag::arrow(const Mag & m, const double & x) Arrow operator of original code.
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>long int mag::sign0(const Mag & x) Get magnetization sign.
- Return
- sign computed as 1 - 2 * sign(x)
- Template Parameters
Mag: magnetization type (MagP or MagT)
- Parameters
x: mag object
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>double mag::logmag2p(const Mag & x) Log operation for magnetization objects.
- Return
- The result of the operation
- Template Parameters
Mag: magnetization type (MagP or MagT)
- Parameters
x: mag object
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>Mag mag::convert(const double & x) Convert a double to a mag value (as a constructor).
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>double mag::convert(const Mag & x) Convert a mag to double.
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>Mag mag::couple(const double & x1, const double & x2) Combine values to magnetizations.
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>Mag mag::damp(const Mag & newx, const Mag & oldx, const double & l) Update magnetization.
- Return
- The result of the update computed as newx * (1 - l) + oldx * l
- Template Parameters
Mag: magnetization type (MagP or MagT)
- Parameters
newx: mag objectoldx: mag objectl: double value
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>Mag mag::mtanh(const double & x) Perform
tanhon magnetization value.- Return
- The result of
tanhas Mag. - Template Parameters
Mag: magnetization type (MagP or MagT)
- Parameters
x: double value
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>Mag mag::merf(const double & x) Perform
erfon magnetization value.
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>Mag mag::bar(const Mag & m1, const Mag & m2) Diff of magnetizations.
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>double mag::log1pxy(const Mag & x, const Mag & y) Compute the log1p for the combination of the magnetizations.
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>double mag::mcrossentropy(const Mag & x, const Mag & y) Compute the crossentropy score for magnetization objects.
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>double mag::logZ(const Mag & u0, const Mag * u, const long int & nu)
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagT64 > ::value > ::type * = nullptr>Mag mag::auxmix(const Mag & H, const double & ap, const double & am) Combine three MagT64 variables.
- Return
- combination of the input
- Note
- This operation is valid only for MagT64 variables up to now
- Template Parameters
Mag: magnetization type (MagP or MagT)
- Parameters
H: mag objectap: doubleam: double
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>Mag mag::erfmix(const Mag & H, const double & mp, const double & mm) Combine exactly three magnetizations.
-
template<class Mag, typename std ::enable_if< std ::is_same< Mag, MagP64 > ::value > ::type * = nullptr>Mag mag::exactmix(const Mag & H, const Mag & pp, const Mag & pm) Combine exactly three magnetizations.
-
double