Template Function sign#

Function Documentation#

template<typename T>
T sign(T x)#

Mathematical utility functions for NRG calculations.

This header provides template utility functions including sign calculation, vector operations, and string formatting commonly used in NRG algorithms.

Compute the sign of a number.

Returns:

  • +1 if x > 0

  • -1 if x < 0

  • 0 if x == 0

Note

Useful for determining orientation and symmetry in quantum operators

Template Parameters:

T – Numeric type supporting relational operators

Parameters:

x – Input value

Returns:

Sign of x: -1, 0, or +1