[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

template<> struct SquareRootTraits<ArithmeticType> VIGRA

Unary traits for the calculation of the square root of arithmetic objects.

#include <vigra/numerictraits.hxx>

This traits class is used to determine appropriate argument and result types for the function sqrt(). These traits are typically used like this:

ArithmeticType t = ...;
SquareRootTraits<ArithmeticType>::SquareRootResult r =
sqrt((SquareRootTraits<ArithmeticType>::SquareRootArgument)t);

This approach avoids 'ambiguous overload errors' when taking the square root of an integer type. It also takes care of determining the proper result of the sqrt() function of vigra::FixedPoint and of the norm() function, when it is implemented via sqrt(squaredNorm(x)). The following members are defined in SquareRootTraits<ArithmeticType>:

typedef ArithmeticType Type; the type itself
typedef ... SquareRootArgument; required argument type for srqt(), i.e. sqrt((SquareRootArgument)x)
typedef ... SquareRootResult; result of sqrt((SquareRootArgument)x)

NormTraits for the built-in types are defined in #include <vigra/numerictraits.hxx>

Namespace: vigra

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.11.1 (Fri May 19 2017)