Пример #1
0
template <typename Int> inline
float Cast_( const Scalar<Int>& s, ScalarType<float,Int> )
{
	switch ( s.Type() ) {
	default: TypeCastError( s.Type(), SINGLE );
	case SINGLE:     return s.template Get_<float>();
	}
}
Пример #2
0
template <typename Int> inline
scomplex Cast_( const Scalar<Int>& s, ScalarType<scomplex,Int> q )
{
	switch ( s.Type() ) {
	default: TypeCastError( s.Type(), SCOMPLEX );
	case SINGLE:     return s.template Get_<float>();
	case SCOMPLEX:   return s.template Get_<scomplex>();
	}
}
Пример #3
0
template <typename Int> inline
double Cast_( const Scalar<Int>& s, ScalarType<double,Int> )
{
	switch ( s.Type() ) {
	default: TypeCastError( s.Type(), DOUBLE );
	case INTEGRAL:   return s.template Get_<Int>();
	case SINGLE:     return s.template Get_<float>();
	case DOUBLE:     return s.template Get_<double>();
	}
}
Пример #4
0
 bool Scalar::Equal( Scalar& a, Scalar& b )
{
    if( a.Type() != b.Type() )
        return false;

    DataType* pA = a.Get();
    DataType* pB = b.Get();

    return DataType::Equal( pA, pB );
}
Пример #5
0
template <typename Int> inline
dcomplex Cast_( const Scalar<Int>& s, ScalarType<dcomplex,Int> q )
{
	switch ( s.Type() ) {
	default: TypeCastError( s.Type(), DCOMPLEX );
	case INTEGRAL:   return s.template Get_<Int>();
	case SINGLE:     return s.template Get_<float>();
	case DOUBLE:     return s.template Get_<double>();
	case SCOMPLEX:   return s.template Get_<scomplex>();
	case DCOMPLEX:   return s.template Get_<dcomplex>();
	}
}