LAMA
lama::Scalar Class Reference

The class Scalar represents a multi precision scalar. More...

#include <Scalar.hpp>

Inheritance diagram for lama::Scalar:

Public Types

enum  ScalarType {
  INDEX_TYPE, FLOAT, DOUBLE, LONG_DOUBLE,
  COMPLEX, DOUBLE_COMPLEX, LONG_DOUBLE_COMPLEX, UNKNOWN
}
typedef const Scalar ExpressionMemberType
 ExpressionMemberType is the type that is used the template Expression to store a Scalar.

Public Member Functions

 Scalar ()
 Constructs a scalar representing 0.
template<typename T >
 Scalar (const T value)
 Constructs a scalar representing the passed real value.
 Scalar (const float value)
 Constructs a scalar representing the passed real value.
 Scalar (const double value)
 Constructs a scalar representing the passed real value.
 Scalar (const long double value)
 Constructs a scalar representing the passed real value.
template<typename T >
 Scalar (const std::complex< T > value)
 Constructs a scalar representing the passed complex value.
virtual ~Scalar ()
 Releases all allocated resources.
template<typename T >
getValue () const
 returns the value this Scalar represents as type T.
Scalar operator- () const
 Unary minus operator for Scalar.
bool isReal () const
 Query that scalar values has no imaginary part.
virtual void writeAt (std::ostream &stream) const
 Override virtual method of base class Printable to Write the represented value of this to the passed stream.

Static Public Member Functions

template<typename T >
static ScalarType getType ()
static size_t getTypeSize (const ScalarType type)

Protected Member Functions

 LAMA_LOG_DECL_STATIC_LOGGER (logger)

Private Attributes

std::complex< long double > mValue

Detailed Description

The class Scalar represents a multi precision scalar.


Member Typedef Documentation

ExpressionMemberType is the type that is used the template Expression to store a Scalar.


Member Enumeration Documentation

Enumerator:
INDEX_TYPE 
FLOAT 
DOUBLE 
LONG_DOUBLE 
COMPLEX 
DOUBLE_COMPLEX 
LONG_DOUBLE_COMPLEX 
UNKNOWN 

Constructor & Destructor Documentation

lama::Scalar::Scalar ( ) [inline]

Constructs a scalar representing 0.

Referenced by operator-().

template<typename T >
lama::Scalar::Scalar ( const T  value) [inline, explicit]

Constructs a scalar representing the passed real value.

The templated converstion constructor needs to be explicit, because the operator==(Scalar,Scalar) can lead to ambiguities.

Parameters:
[in]valuethe value this scalar should represent
lama::Scalar::Scalar ( const float  value) [inline]

Constructs a scalar representing the passed real value.

Parameters:
[in]valuethe value this scalar should represent
lama::Scalar::Scalar ( const double  value) [inline]

Constructs a scalar representing the passed real value.

Parameters:
[in]valuethe value this scalar should represent
lama::Scalar::Scalar ( const long double  value) [inline]

Constructs a scalar representing the passed real value.

Parameters:
[in]valuethe value this scalar should represent
template<typename T >
lama::Scalar::Scalar ( const std::complex< T >  value) [inline]

Constructs a scalar representing the passed complex value.

Parameters:
[in]valuethe value this scalar should represent
lama::Scalar::~Scalar ( ) [inline, virtual]

Releases all allocated resources.


Member Function Documentation

Scalar::ScalarType lama::Scalar::getType< long double > ( ) [inline, static]

References UNKNOWN.

bool lama::Scalar::isReal ( ) const [inline]

Query that scalar values has no imaginary part.

References mValue.

Referenced by lama::max(), lama::min(), lama::operator<(), and lama::operator>().

Scalar lama::Scalar::operator- ( ) const [inline]

Unary minus operator for Scalar.

References mValue, and Scalar().

void lama::Scalar::writeAt ( std::ostream &  stream) const [inline, virtual]

Override virtual method of base class Printable to Write the represented value of this to the passed stream.

Parameters:
[in]streamthe stream to write this to.

Reimplemented from Printable.

References mValue.


Field Documentation

std::complex<long double> lama::Scalar::mValue [private]

Referenced by getValue(), isReal(), operator-(), and writeAt().


The documentation for this class was generated from the following file: