AlgebraicTraits< T > Class Template Reference

#include <AlgebraicTraits.h>

Inheritance diagram for AlgebraicTraits< T >:

Inheritance graph
[legend]
Collaboration diagram for AlgebraicTraits< T >:

Collaboration graph
[legend]
List of all members.

Public Types

enum  
enum  
enum  
typedef T number_type
typedef T norm_type
typedef T scalar_type

Static Public Member Functions

static const char * name ()
static number_type zero ()
static number_type one ()
static number_type zero (const number_type &hint)
static number_type one (const number_type &hint)
static bool is_zero (const number_type &val)
static bool equals (const number_type &first, const number_type &second)
static int valuation (const number_type &arg)

Public Attributes

enum AlgebraicTraits:: { ... }  AlgebraicType

Detailed Description

template<class T>
class AlgebraicTraits< T >

Provides a way of associating useful information with a compile-time math entity. Because traits templates are non-intrusive: they allow associating information with arbitrary types, including built-in types and types defined in third-party libraries. Library users should specialize (partially) the AlgebraicTraits class with their own classes in order to be able to use all the functionality offered by the template math library with their classes. The default implementation of the class is suited for floating point numbers. Also in the math library the AlgebraicTraits class is specialized for the following types: Complex<T>, LongInt<unsigned int>, Rational<T>, Polynomial<T> and RationalFunction<T>. The kinds of information AlgebraicTraits<T> class provides about the type "T" are: related type definitions, enumerated constants and methods returning type properties or performing type specific algorithms.

Definition at line 122 of file AlgebraicTraits.h.


Member Typedef Documentation

template<class T>
typedef T AlgebraicTraits< T >::number_type

represents the type T of elements of this algebraic structure

Definition at line 130 of file AlgebraicTraits.h.

template<class T>
typedef T AlgebraicTraits< T >::norm_type

represents the norm type for elements of this algebraic structure (usually a real number)

Definition at line 134 of file AlgebraicTraits.h.

template<class T>
typedef T AlgebraicTraits< T >::scalar_type

For vectorial types (e.g. vector fields) this type represents the scalar type e.g. For Ploynomial<float> scalar_type is float.

Definition at line 138 of file AlgebraicTraits.h.


Member Enumeration Documentation

template<class T>
anonymous enum

Is Plain Old Data type must be true for basic types. For types that have a meaningful default constructor or destructor set this constant to false. One should override this in specializations of AlgebraicTraits.

Definition at line 144 of file AlgebraicTraits.h.

template<class T>
anonymous enum

true if the algebraic structure T has the commutative property and false otherwise.

Definition at line 148 of file AlgebraicTraits.h.


Member Function Documentation

template<class T>
static const char* AlgebraicTraits< T >::name (  )  [inline, static]

This method from the AlgebricTraits<T> class should return a symbolic name for the type "T" (e.g. AlgebraicTraits<Polynomial>::name() could return the string "Polynomial" ). This method is used when we want to serialize an object to an XML file and we need to know the name of the type it represents.

Reimplemented from AlgebraicTraitsBase.

Definition at line 151 of file AlgebraicTraits.h.

template<class T>
static number_type AlgebraicTraits< T >::zero (  )  [inline, static]

return the identity element of T with regard to the + (additive) operation

Definition at line 159 of file AlgebraicTraits.h.

Referenced by AlgebraicTraits< LongInt< BITS, MAY_OVERFLOW > >::abs(), AlgebraicTraits< LongInt< BITS, MAY_OVERFLOW > >::degree(), derivative(), AlgebraicTraits< Rational< IntType > >::epsilon(), AlgebraicTraits< LongInt< BITS, MAY_OVERFLOW > >::epsilon(), AlgebraicTraits< T >::equals(), gcdOfMinors(), Matrix< T, NumberTraits >::inverse(), AlgebraicTraits< LongInt< BITS, MAY_OVERFLOW > >::norm(), RationalFunction< T, NumberTraits >::operator/=(), partialDerivative(), recursiveSmithNormalForm1(), recursiveSmithNormalForm3(), Polynomial< T, NumberTraits >::roots(), smithMcMillanForm1(), smithMcMillanForm2(), smithNormalForm1(), smithNormalForm2(), smithNormalForm3(), AlgebraicTraits< RationalFunction< ScalarType, AlgebraicTraits< ScalarType > > >::zero(), AlgebraicTraits< Polynomial< ScalarType, AlgebraicTraits< ScalarType > > >::zero(), AlgebraicTraits< Rational< IntType > >::zero(), AlgebraicTraits< LongInt< BITS, MAY_OVERFLOW > >::zero(), and AlgebraicTraits< Complex< T, AlgebraicTraits< T > > >::zero().

Here is the caller graph for this function:

template<class T>
static number_type AlgebraicTraits< T >::one (  )  [inline, static]

return the identity element of T with regard to the * (multiplicative) operation

Definition at line 167 of file AlgebraicTraits.h.

Referenced by derivative(), Rational< IntType >::display(), fastDerivative(), Polynomial< T, NumberTraits >::fromRoots(), gcdOfMinors(), RationalFunction< T, NumberTraits >::normalize(), AlgebraicTraits< RationalFunction< ScalarType, AlgebraicTraits< ScalarType > > >::one(), AlgebraicTraits< Polynomial< ScalarType, AlgebraicTraits< ScalarType > > >::one(), AlgebraicTraits< Rational< IntType > >::one(), AlgebraicTraits< LongInt< BITS, MAY_OVERFLOW > >::one(), AlgebraicTraits< Complex< T, AlgebraicTraits< T > > >::one(), partialDerivative(), RationalFunction< T, NumberTraits >::RationalFunction(), recursiveSmithNormalForm1(), recursiveSmithNormalForm3(), smithMcMillanForm1(), smithMcMillanForm2(), smithNormalForm1(), smithNormalForm2(), smithNormalForm3(), AlgebraicTraits< T >::valuation(), and AlgebraicTraits< RationalFunction< ScalarType, AlgebraicTraits< ScalarType > > >::zero().

Here is the caller graph for this function:

template<class T>
static number_type AlgebraicTraits< T >::zero ( const number_type hint  )  [inline, static]

return the zero value for the type "T". The parameter "hint" is a number used to synthesize the zero value. Not all types contain at compile time all the necessary information needed to generate a zero of that particular type, thus we need a "model", supplied at runtime, of the same exact type to do this. Consider, for example, that we need to generate the null matrix but the number of rows and the number of columns of that matrix is not (in this implementation) a compile time constant so in order to know the number of rows and the number of columns of the null matrix we want to create we need another matrix of the same type to find out the sizes of our null matrix.

Definition at line 183 of file AlgebraicTraits.h.

template<class T>
static number_type AlgebraicTraits< T >::one ( const number_type hint  )  [inline, static]

return the multiplicative identity value for the type "T". The parameter "hint" is a number used to synthesize the zero value. Not all types contain at compile time all the necessary information needed to generate a zero of that particular type, thus we need a "model", supplied at runtime, of the same exact type to do this. Consider, for example, that we need to generate the identity matrix but the number of rows and the number of columns of that matrix is not (in this implementation) a compile time constant so in order to know the number of rows and the number of columns of the null matrix we want to create we need another matrix of the same type to find out the sizes of our null matrix.

Definition at line 200 of file AlgebraicTraits.h.

template<class T>
static bool AlgebraicTraits< T >::is_zero ( const number_type val  )  [inline, static]

Return true if the parameter supplied to it is zero and false otherwise. This method should use some tolerance to determine if a floating point value is zero.

Definition at line 209 of file AlgebraicTraits.h.

Referenced by AlgebraicTraits< Rational< IntType > >::is_zero(), and AlgebraicTraits< Complex< T, AlgebraicTraits< T > > >::is_zero().

Here is the caller graph for this function:

template<class T>
static bool AlgebraicTraits< T >::equals ( const number_type first,
const number_type second 
) [inline, static]

return true if the first parameter equals to the second parameter. In the implementation of this function one should also consider a tolerance if comparing two floating point values

Definition at line 219 of file AlgebraicTraits.h.

References AlgebraicTraits< T >::zero().

Referenced by AlgebraicTraits< Rational< IntType > >::equals(), and AlgebraicTraits< Complex< T, AlgebraicTraits< T > > >::equals().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
static int AlgebraicTraits< T >::valuation ( const number_type arg  )  [inline, static]

Compute the valuation for an element of an Euclidean domain

Definition at line 229 of file AlgebraicTraits.h.

References AlgebraicTraits< T >::one().

Here is the call graph for this function:


Member Data Documentation

enum { ... } AlgebraicTraits< T >::AlgebraicType

This constant from the AlgebricTraits<T> class should represent the type of the algebraic structure formed by the elements that have the type "T". (e.g. AlgebraicTraits<int>::type should return the value AlgebraicTraitsBase::integral_domain and AlgebraicTraits<double>::type should return the value AlgebraicTraitsBase::field)

Reimplemented from AlgebraicTraitsBase.


The documentation for this class was generated from the following file:
Math-Objects Library Docs  Generated by: doxygen