*/
bool is_finite (const std::complex<double> x);
+ /**
+ * Return @p true if real and
+ * imaginary parts of the given
+ * complex number are finite.
+ */
+ bool is_finite (const std::complex<float> x);
+
/**
* Return @p true if real and
* imaginary parts of the given
*/
static
real_type abs_square (const number &x);
+
+ /**
+ * Return the absolute value of a
+ * number.
+ */
+ static
+ real_type abs (const number &x);
};
*/
static
real_type abs_square (const std::complex<number> &x);
+
+
+ /**
+ * Return the absolute value of a
+ * complex number.
+ */
+ static
+ real_type abs (const std::complex<number> &x);
};
}
+ template <typename number>
+ typename NumberTraits<number>::real_type
+ NumberTraits<number>::abs (const number &x)
+ {
+ return std::fabs(x);
+ }
+
+
+
template <typename number>
std::complex<number>
NumberTraits<std::complex<number> >::conjugate (const std::complex<number> &x)
+ template <typename number>
+ typename NumberTraits<std::complex<number> >::real_type
+ NumberTraits<std::complex<number> >::abs (const std::complex<number> &x)
+ {
+ return std::abs(x);
+ }
+
+
+
template <typename number>
typename NumberTraits<std::complex<number> >::real_type
NumberTraits<std::complex<number> >::abs_square (const std::complex<number> &x)
// $Id$
// Version: $Name$
//
-// Copyright (C) 2006 by the deal.II authors
+// Copyright (C) 2006, 2007 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
+ bool is_finite (const std::complex<float> x)
+ {
+ // Check complex numbers for infinity
+ // by testing real and imaginary part
+ return ( is_finite (x.real())
+ &&
+ is_finite (x.imag()) );
+ }
+
+
+
bool is_finite (const std::complex<long double> x)
{
// Same for std::complex<long double>
deallog << numbers::NumberTraits<number>::abs_square (x)
<< std::endl;
+
+ deallog << numbers::NumberTraits<number>::abs (x)
+ << std::endl;
}
DEAL::typeid(NumberTraits<number>::real_type).name() = f
DEAL::(1.50,-2.50)
DEAL::8.50
+DEAL::2.92
DEAL::typeid(x).name() = St7complexIfE
DEAL::typeid(NumberTraits<number>::real_type).name() = f
DEAL::(-1.50,2.50)
DEAL::8.50
+DEAL::2.92
DEAL::typeid(x).name() = St7complexIdE
DEAL::typeid(NumberTraits<number>::real_type).name() = d
DEAL::(1.50,-2.50)
DEAL::8.50
+DEAL::2.92
DEAL::typeid(x).name() = St7complexIdE
DEAL::typeid(NumberTraits<number>::real_type).name() = d
DEAL::(-1.50,2.50)
DEAL::8.50
+DEAL::2.92
DEAL::typeid(x).name() = St7complexIeE
DEAL::typeid(NumberTraits<number>::real_type).name() = e
DEAL::(1.50,-2.50)
DEAL::8.50
+DEAL::2.92
DEAL::typeid(x).name() = St7complexIeE
DEAL::typeid(NumberTraits<number>::real_type).name() = e
DEAL::(-1.50,2.50)
DEAL::8.50
+DEAL::2.92
deallog << numbers::NumberTraits<number>::abs_square (x)
<< std::endl;
+
+ deallog << numbers::NumberTraits<number>::abs (x)
+ << std::endl;
}
DEAL::typeid(NumberTraits<number>::real_type).name() = f
DEAL::1.50
DEAL::2.25
+DEAL::1.50
DEAL::typeid(x).name() = f
DEAL::typeid(NumberTraits<number>::real_type).name() = f
DEAL::-1.50
DEAL::2.25
+DEAL::1.50
DEAL::typeid(x).name() = d
DEAL::typeid(NumberTraits<number>::real_type).name() = d
DEAL::1.50
DEAL::2.25
+DEAL::1.50
DEAL::typeid(x).name() = d
DEAL::typeid(NumberTraits<number>::real_type).name() = d
DEAL::-1.50
DEAL::2.25
+DEAL::1.50
DEAL::typeid(x).name() = e
DEAL::typeid(NumberTraits<number>::real_type).name() = e
DEAL::1.50
DEAL::2.25
+DEAL::1.50
DEAL::typeid(x).name() = e
DEAL::typeid(NumberTraits<number>::real_type).name() = e
DEAL::-1.50
DEAL::2.25
+DEAL::1.50