aboutsummaryrefslogtreecommitdiffhomepage
path: root/tvmet-1.7.1/include/tvmet
diff options
context:
space:
mode:
Diffstat (limited to 'tvmet-1.7.1/include/tvmet')
-rw-r--r--tvmet-1.7.1/include/tvmet/MatrixFunctions.h4
-rw-r--r--tvmet-1.7.1/include/tvmet/MatrixImpl.h12
-rw-r--r--tvmet-1.7.1/include/tvmet/NumericTraits.h323
-rw-r--r--tvmet-1.7.1/include/tvmet/Traits.h122
-rw-r--r--tvmet-1.7.1/include/tvmet/VectorFunctions.h18
-rw-r--r--tvmet-1.7.1/include/tvmet/VectorImpl.h12
-rw-r--r--tvmet-1.7.1/include/tvmet/meta/Matrix.h2
-rw-r--r--tvmet-1.7.1/include/tvmet/meta/Vector.h4
-rw-r--r--tvmet-1.7.1/include/tvmet/util/Random.h88
-rw-r--r--tvmet-1.7.1/include/tvmet/xpr/MMProduct.h4
-rw-r--r--tvmet-1.7.1/include/tvmet/xpr/MMProductTransposed.h4
-rw-r--r--tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h4
-rw-r--r--tvmet-1.7.1/include/tvmet/xpr/MVProduct.h4
-rw-r--r--tvmet-1.7.1/include/tvmet/xpr/MatrixFunctions.h4
-rw-r--r--tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h4
-rw-r--r--tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h4
-rw-r--r--tvmet-1.7.1/include/tvmet/xpr/VectorFunctions.h16
17 files changed, 170 insertions, 459 deletions
diff --git a/tvmet-1.7.1/include/tvmet/MatrixFunctions.h b/tvmet-1.7.1/include/tvmet/MatrixFunctions.h
index add1184b1..49db418ae 100644
--- a/tvmet-1.7.1/include/tvmet/MatrixFunctions.h
+++ b/tvmet-1.7.1/include/tvmet/MatrixFunctions.h
@@ -337,7 +337,7 @@ trans(const Matrix<T, Rows, Cols>& rhs) _tvmet_always_inline;
template<class T, int Sz>
-typename NumericTraits<T>::sum_type
+typename Traits<T>::sum_type
trace(const Matrix<T, Sz, Sz>& m) _tvmet_always_inline;
@@ -972,7 +972,7 @@ trans(const Matrix<T, Rows, Cols>& rhs) {
*/
template<class T, int Sz>
inline
-typename NumericTraits<T>::sum_type
+typename Traits<T>::sum_type
trace(const Matrix<T, Sz, Sz>& m) {
return meta::Matrix<Sz, Sz, 0, 0>::trace(m);
}
diff --git a/tvmet-1.7.1/include/tvmet/MatrixImpl.h b/tvmet-1.7.1/include/tvmet/MatrixImpl.h
index 8704366fc..32d8624a6 100644
--- a/tvmet-1.7.1/include/tvmet/MatrixImpl.h
+++ b/tvmet-1.7.1/include/tvmet/MatrixImpl.h
@@ -51,12 +51,12 @@ std::ostream& Matrix<T, NRows, NCols>::print_xpr(std::ostream& os, int l) const
template<class T, int NRows, int NCols>
std::ostream& Matrix<T, NRows, NCols>::print_on(std::ostream& os) const
{
- enum {
- complex_type = NumericTraits<value_type>::is_complex
- };
-
- std::streamsize w = IoPrintHelper<Matrix>::width(dispatch<complex_type>(), *this);
-
+ std::streamsize w;
+ if(Traits<value_type>::isComplex())
+ w = IoPrintHelper<Matrix>::width(dispatch<true>(), *this);
+ else
+ w = IoPrintHelper<Matrix>::width(dispatch<false>(), *this);
+
os << std::setw(0) << "[\n";
for(int i = 0; i < Rows; ++i) {
os << " [";
diff --git a/tvmet-1.7.1/include/tvmet/NumericTraits.h b/tvmet-1.7.1/include/tvmet/NumericTraits.h
deleted file mode 100644
index 53540fcdc..000000000
--- a/tvmet-1.7.1/include/tvmet/NumericTraits.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Tiny Vector Matrix Library
- * Dense Vector Matrix Libary of Tiny size using Expression Templates
- *
- * Copyright (C) 2001 - 2003 Olaf Petzold <opetzold@users.sourceforge.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id: NumericTraits.h,v 1.11 2004/11/04 18:10:35 opetzold Exp $
- */
-
-#ifndef TVMET_NUMERIC_TRAITS_H
-#define TVMET_NUMERIC_TRAITS_H
-
-#if defined(EIGEN_USE_COMPLEX)
-# include <complex>
-#endif
-
-#include <cmath>
-#include <limits>
-
-#include <tvmet/CompileTimeError.h>
-#include <tvmet/util/Random.h>
-
-namespace tvmet {
-
-/**
- * \class NumericTraits NumericTraits.h "tvmet/NumericTraits.h"
- * \brief Traits for integral types for operations.
- *
- * For each type we have to specialize this traits.
- */
-template<class T>
-struct NumericTraits {
- typedef T real_type;
- typedef T value_type;
- typedef T float_type;
- typedef const T & argument_type;
-
- static inline
- real_type real(argument_type x);
-
- static inline
- real_type imag(argument_type x);
-
- static inline
- value_type conj(argument_type x);
-
- static inline
- real_type abs(argument_type x);
-
- static inline
- value_type sqrt(argument_type x);
-
- enum{ is_complex = false };
-};
-
-/*
- * numeric traits for built-in types
- */
-
-/**
- * \class NumericTraits<int> NumericTraits.h "tvmet/NumericTraits.h"
- * \brief Traits specialized for int.
- */
-template<>
-struct NumericTraits<int> {
- typedef int value_type;
- typedef value_type real_type;
- typedef double float_type;
- typedef value_type argument_type;
-
- static inline
- real_type real(argument_type x) { return x; }
-
- static inline
- real_type imag(argument_type x) { TVMET_UNUSED(x); return 0; }
-
- static inline
- value_type conj(argument_type x) { return x; }
-
- static inline
- value_type sqrt(argument_type x) {
- return static_cast<value_type>(std::sqrt(static_cast<float_type>(x)));
- }
-
- static inline
- value_type abs(argument_type x) {
- return std::abs(x);
- }
-
- enum { is_complex = false };
-
- /** Complexity on operations. */
- enum {
- ops_plus = 1, /**< Complexity on plus/minus ops. */
- ops_muls = 1 /**< Complexity on multiplications. */
- };
-};
-
-/**
- * \class NumericTraits<float> NumericTraits.h "tvmet/NumericTraits.h"
- * \brief Traits specialized for float.
- */
-template<>
-struct NumericTraits<float> {
- typedef float value_type;
- typedef value_type real_type;
- typedef value_type float_type;
- typedef value_type argument_type;
-
- static inline
- real_type real(argument_type x) { return x; }
-
- static inline
- real_type imag(argument_type x) { TVMET_UNUSED(x); return 0; }
-
- static inline
- value_type conj(argument_type x) { return x; }
-
- static inline
- value_type sqrt(argument_type x) {
- return std::sqrt(x);
- }
-
- static inline
- value_type abs(argument_type x) {
- return std::abs(x);
- }
-
- enum { is_complex = false };
-
- /** Complexity on operations. */
- enum {
- ops_plus = 1, /**< Complexity on plus/minus ops. */
- ops_muls = 1 /**< Complexity on multiplications. */
- };
-};
-
-
-/**
- * \class NumericTraits<double> NumericTraits.h "tvmet/NumericTraits.h"
- * \brief Traits specialized for double.
- */
-template<>
-struct NumericTraits<double> {
- typedef double value_type;
- typedef value_type real_type;
- typedef value_type float_type;
- typedef value_type argument_type;
-
- static inline
- real_type real(argument_type x) { return x; }
-
- static inline
- real_type imag(argument_type x) { TVMET_UNUSED(x); return 0; }
-
- static inline
- value_type conj(argument_type x) { return x; }
-
- static inline
- value_type sqrt(argument_type x) {
- return std::sqrt(x);
- }
-
- static inline
- value_type abs(argument_type x) {
- return std::abs(x);
- }
-
- enum { is_complex = false };
-
- /** Complexity on operations. */
- enum {
- ops_plus = 1, /**< Complexity on plus/minus ops. */
- ops_muls = 1 /**< Complexity on multiplications. */
- };
-};
-
-
-/*
- * numeric traits for complex types
- */
-#if defined(EIGEN_USE_COMPLEX)
-
-/**
- * \class NumericTraits< std::complex<int> > NumericTraits.h "tvmet/NumericTraits.h"
- * \brief Traits specialized for std::complex<int>.
- */
-template<>
-struct NumericTraits< std::complex<int> > {
- typedef std::complex<int> value_type;
- typedef int real_type;
- typedef std::complex<float> float_type;
- typedef const value_type& argument_type;
-
- static inline
- real_type real(argument_type z) { return std::real(z); }
-
- static inline
- real_type imag(argument_type z) { return std::imag(z); }
-
- static inline
- value_type conj(argument_type z) { return std::conj(z); }
-
- static inline
- real_type abs(argument_type z) {
- // the use of ceil() guarantees e.g. that abs(real(x)) <= abs(x),
- // and that abs(x)==0 if and only if x==0.
- return static_cast<value_type>(std::ceil(std::abs(static_cast<float_type>(x))));
- }
-
- static inline
- value_type sqrt(argument_type x) {
- return static_cast<value_type>(std::sqrt(static_cast<float_type>(x)));
- }
-
- enum { is_complex = true };
-
- /** Complexity on operations. */
- enum {
- ops_plus = 2, /**< Complexity on plus/minus ops. */
- ops_muls = 6 /**< Complexity on multiplications. */
- };
-};
-
-
-/**
- * \class NumericTraits< std::complex<float> > NumericTraits.h "tvmet/NumericTraits.h"
- * \brief Traits specialized for std::complex<float>.
- */
-template<>
-struct NumericTraits< std::complex<float> > {
- typedef std::complex<float> value_type;
- typedef float real_type;
- typedef value_type float_type;
- typedef const value_type& argument_type;
-
- static inline
- real_type real(argument_type z) { return std::real(z); }
-
- static inline
- real_type imag(argument_type z) { return std::imag(z); }
-
- static inline
- value_type conj(argument_type z) { return std::conj(z); }
-
- static inline
- value_type sqrt(argument_type x) {
- return std::sqrt(x);
- }
-
- static inline
- value_type abs(argument_type x) {
- return std::abs(x);
- }
-
- enum { is_complex = true };
-
- /** Complexity on operations. */
- enum {
- ops_plus = 2, /**< Complexity on plus/minus ops. */
- ops_muls = 6 /**< Complexity on multiplications. */
- };
-};
-
-
-/**
- * \class NumericTraits< std::complex<double> > NumericTraits.h "tvmet/NumericTraits.h"
- * \brief Traits specialized for std::complex<double>.
- */
-template<>
-struct NumericTraits< std::complex<double> > {
- typedef std::complex<double> value_type;
- typedef double real_type;
- typedef value_type float_type;
- typedef const value_type& argument_type;
-
- static inline
- real_type real(argument_type z) { return std::real(z); }
-
- static inline
- real_type imag(argument_type z) { return std::imag(z); }
-
- static inline
- value_type conj(argument_type z) { return std::conj(z); }
-
- static inline
- value_type sqrt(argument_type x) {
- return std::sqrt(x);
- }
-
- static inline
- value_type abs(argument_type x) {
- return std::abs(x);
- }
-
- enum { is_complex = true };
-
- /** Complexity on operations. */
- enum {
- ops_plus = 2, /**< Complexity on plus/minus ops. */
- ops_muls = 6 /**< Complexity on multiplications. */
- };
-};
-
-#endif // defined(EIGEN_USE_COMPLEX)
-
-} // namespace tvmet
-
-#endif // TVMET_NUMERIC_TRAITS_H
diff --git a/tvmet-1.7.1/include/tvmet/Traits.h b/tvmet-1.7.1/include/tvmet/Traits.h
new file mode 100644
index 000000000..10d016185
--- /dev/null
+++ b/tvmet-1.7.1/include/tvmet/Traits.h
@@ -0,0 +1,122 @@
+/* This file is part of Eigen, a C++ template library for linear algebra
+ * Copyright (C) 2007 Benoit Jacob <jacob@math.jussieu.fr>
+ *
+ * Based on Tvmet source code, http://tvmet.sourceforge.net,
+ * Copyright (C) 2001 - 2003 Olaf Petzold <opetzold@users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id: Traits.h,v 1.11 2004/11/04 18:10:35 opetzold Exp $
+ */
+
+#ifndef TVMET_NUMERIC_TRAITS_H
+#define TVMET_NUMERIC_TRAITS_H
+
+#if defined(EIGEN_USE_COMPLEX)
+# include <complex>
+#endif
+
+#include <cmath>
+
+#include <tvmet/TraitsBase.h>
+
+namespace tvmet {
+
+/**
+ * \class Traits Traits.h "tvmet/Traits.h"
+ * \brief Traits for standard types.
+ *
+ */
+template<typename T>
+struct Traits : public TraitsBase<T>
+{
+ typedef TraitsBase<T> Base;
+ typedef typename Base::value_type value_type;
+ typedef typename Base::real_type real_type;
+ typedef typename Base::float_type float_type;
+ typedef typename Base::argument_type argument_type;
+
+ using Base::isFloat;
+ using Base::isComplex;
+ using Base::epsilon;
+ using Base::abs;
+ using Base::real;
+ using Base::imag;
+ using Base::conj;
+ using Base::sqrt;
+
+ static value_type random()
+ {
+ value_type x;
+ pickRandom(x);
+ return x;
+ }
+ /**
+ * Short version: returns true if the absolute value of \a a is much smaller
+ * than that of \a b.
+ *
+ * Full story: returns(abs(a) <= abs(b) * epsilon());
+ */
+ static bool isNegligible(argument_type a, argument_type b)
+ {
+ if(isFloat())
+ return(abs(a) <= abs(b) * epsilon());
+ else
+ return(a==0);
+ }
+
+ /**
+ * Short version: returns true if \a a is approximately zero.
+ *
+ * Full story: returns isNegligible( a, static_cast<T>(1) );
+ */
+ static bool isZero(argument_type a)
+ {
+ return isNegligible(a, static_cast<value_type>(1));
+ }
+
+ /**
+ * Short version: returns true if a is very close to b, false otherwise.
+ *
+ * Full story: returns abs( a - b ) <= min( abs(a), abs(b) ) * epsilon<T>.
+ */
+ static bool isApprox(argument_type a, argument_type b)
+ {
+ if(isFloat())
+ return(abs( a - b ) <= std::min(abs(a), abs(b)) * epsilon());
+ else
+ return(a==b);
+ }
+
+ /**
+ * Short version: returns true if a is smaller or approximately equalt to b, false otherwise.
+ *
+ * Full story: returns a <= b || isApprox(a, b);
+ */
+ static bool isLessThan( argument_type a, argument_type b )
+ {
+ assert(!isComplex());
+ if(isFloat())
+ return(a <= b || isApprox(a, b));
+ else
+ return(a<=b);
+ }
+
+};
+
+
+} // namespace tvmet
+
+#endif // TVMET_NUMERIC_TRAITS_H
diff --git a/tvmet-1.7.1/include/tvmet/VectorFunctions.h b/tvmet-1.7.1/include/tvmet/VectorFunctions.h
index 65174a7a0..6d549a109 100644
--- a/tvmet-1.7.1/include/tvmet/VectorFunctions.h
+++ b/tvmet-1.7.1/include/tvmet/VectorFunctions.h
@@ -187,12 +187,12 @@ TVMET_DECLARE_MACRO(div)
template<class T, int Sz>
-typename NumericTraits<T>::sum_type
+typename Traits<T>::sum_type
sum(const Vector<T, Sz>& v) _tvmet_always_inline;
template<class T, int Sz>
-typename NumericTraits<T>::sum_type
+typename Traits<T>::sum_type
product(const Vector<T, Sz>& v) _tvmet_always_inline;
@@ -209,12 +209,12 @@ cross(const Vector<T1, 3>& lhs,
template<class T, int Sz>
-typename NumericTraits<T>::sum_type
+typename Traits<T>::sum_type
norm1(const Vector<T, Sz>& v) _tvmet_always_inline;
template<class T, int Sz>
-typename NumericTraits<T>::sum_type
+typename Traits<T>::sum_type
norm2(const Vector<T, Sz>& v) _tvmet_always_inline;
@@ -505,7 +505,7 @@ TVMET_IMPLEMENT_MACRO(div)
*/
template<class T, int Sz>
inline
-typename NumericTraits<T>::sum_type
+typename Traits<T>::sum_type
sum(const Vector<T, Sz>& v) {
return meta::Vector<Sz>::sum(v);
}
@@ -523,7 +523,7 @@ sum(const Vector<T, Sz>& v) {
*/
template<class T, int Sz>
inline
-typename NumericTraits<T>::sum_type
+typename Traits<T>::sum_type
product(const Vector<T, Sz>& v) {
return meta::Vector<Sz>::product(v);
}
@@ -580,7 +580,7 @@ cross(const Vector<T1, 3>& lhs, const Vector<T2, 3>& rhs) {
*/
template<class T, int Sz>
inline
-typename NumericTraits<T>::sum_type
+typename Traits<T>::sum_type
norm1(const Vector<T, Sz>& v) {
return sum(abs(v));
}
@@ -601,9 +601,9 @@ norm1(const Vector<T, Sz>& v) {
*/
template<class T, int Sz>
inline
-typename NumericTraits<T>::sum_type
+typename Traits<T>::sum_type
norm2(const Vector<T, Sz>& v) {
- return static_cast<T>( std::sqrt(static_cast<typename NumericTraits<T>::float_type>(dot(v, v))) );
+ return static_cast<T>( std::sqrt(static_cast<typename Traits<T>::float_type>(dot(v, v))) );
}
diff --git a/tvmet-1.7.1/include/tvmet/VectorImpl.h b/tvmet-1.7.1/include/tvmet/VectorImpl.h
index a1a28cfb7..3310ddfed 100644
--- a/tvmet-1.7.1/include/tvmet/VectorImpl.h
+++ b/tvmet-1.7.1/include/tvmet/VectorImpl.h
@@ -51,12 +51,12 @@ std::ostream& Vector<T, Sz>::print_xpr(std::ostream& os, int l) const
template<class T, int Sz>
std::ostream& Vector<T, Sz>::print_on(std::ostream& os) const
{
- enum {
- complex_type = NumericTraits<value_type>::is_complex
- };
-
- std::streamsize w = IoPrintHelper<Vector>::width(dispatch<complex_type>(), *this);
-
+ std::streamsize w;
+ if(Traits<value_type>::isComplex())
+ w = IoPrintHelper<Vector>::width(dispatch<true>(), *this);
+ else
+ w = IoPrintHelper<Vector>::width(dispatch<false>(), *this);
+
os << std::setw(0) << "[\n ";
for(int i = 0; i < (Size - 1); ++i) {
os << std::setw(w) << m_data[i] << ", ";
diff --git a/tvmet-1.7.1/include/tvmet/meta/Matrix.h b/tvmet-1.7.1/include/tvmet/meta/Matrix.h
index 0764c31da..b6b4014dc 100644
--- a/tvmet-1.7.1/include/tvmet/meta/Matrix.h
+++ b/tvmet-1.7.1/include/tvmet/meta/Matrix.h
@@ -24,7 +24,7 @@
#ifndef TVMET_META_MATRIX_H
#define TVMET_META_MATRIX_H
-#include <tvmet/NumericTraits.h>
+#include <tvmet/Traits.h>
#include <tvmet/xpr/Null.h>
namespace tvmet {
diff --git a/tvmet-1.7.1/include/tvmet/meta/Vector.h b/tvmet-1.7.1/include/tvmet/meta/Vector.h
index b9f2c9c63..02888c4cb 100644
--- a/tvmet-1.7.1/include/tvmet/meta/Vector.h
+++ b/tvmet-1.7.1/include/tvmet/meta/Vector.h
@@ -24,7 +24,7 @@
#ifndef TVMET_META_VECTOR_H
#define TVMET_META_VECTOR_H
-#include <tvmet/NumericTraits.h>
+#include <tvmet/Traits.h>
#include <tvmet/xpr/Null.h>
namespace tvmet {
@@ -72,7 +72,7 @@ public:
/** build the product of the vector. */
template<class E>
static inline
- typename NumericTraits<
+ typename Traits<
typename E::value_type
>::sum_type
product(const E& e) {
diff --git a/tvmet-1.7.1/include/tvmet/util/Random.h b/tvmet-1.7.1/include/tvmet/util/Random.h
deleted file mode 100644
index 5f62b4729..000000000
--- a/tvmet-1.7.1/include/tvmet/util/Random.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* This file is part of Eigen, a C++ template library for linear algebra
- * Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id: SelfTest.cc,v 1.1 2004/04/24 11:55:15 opetzold Exp $
- */
-
-#ifndef TVMET_UTIL_RANDOM_H
-#define TVMET_UTIL_RANDOM_H
-
-#ifdef __GNUC__
-# if __GNUC__>=4
-# define EIGEN_WITH_GCC_4_OR_LATER
-# endif
-#endif
-
-#include <cstdlib>
-
-#ifdef EIGEN_USE_COMPLEX
-#include <complex>
-#endif
-
-namespace tvmet {
-
-namespace util {
-
-/** Stores in x a random int between -RAND_MAX/2 and RAND_MAX/2 */
-inline void pickRandom( int & x )
-{
- x = rand() - RAND_MAX / 2;
-}
-
-
-/** Stores in x a random float between -1.0 and 1.0 */
-inline void pickRandom( float & x )
-{
- x = 2.0f * rand() / RAND_MAX - 1.0f;
-}
-
-/** Stores in x a random double between -1.0 and 1.0 */
-inline void pickRandom( double & x )
-{
- x = 2.0 * rand() / RAND_MAX - 1.0;
-}
-
-#ifdef EIGEN_USE_COMPLEX
-/** Stores in the real and imaginary parts of x
- * random values between -1.0 and 1.0 */
-template<typename T> void pickRandom( std::complex<T> & x )
-{
-#ifdef EIGEN_WITH_GCC_4_OR_LATER
- pickRandom( x.real() );
- pickRandom( x.imag() );
-#else // workaround by David Faure for MacOS 10.3 and GCC 3.3, commit 630812
- T r = x.real();
- T i = x.imag();
- pickRandom( r );
- pickRandom( i );
- x = std::complex<T>(r,i);
-#endif
-}
-#endif // EIGEN_USE_COMPLEX
-
-template<typename T> T someRandom()
-{
- T t;
- pickRandom(t);
- return t;
-}
-
-} // namespace util
-
-} // namespace tvmet
-
-#endif // TVMET_UTIL_RANDOM_H
diff --git a/tvmet-1.7.1/include/tvmet/xpr/MMProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MMProduct.h
index 7fe4f746a..0d165ea8c 100644
--- a/tvmet-1.7.1/include/tvmet/xpr/MMProduct.h
+++ b/tvmet-1.7.1/include/tvmet/xpr/MMProduct.h
@@ -63,8 +63,8 @@ public:
ops_rhs = E2::ops,
M = Rows1 * Cols1 * Cols2,
N = Rows1 * (Cols1 - 1) * Cols2,
- ops_plus = M * NumericTraits<value_type>::ops_plus,
- ops_muls = N * NumericTraits<value_type>::ops_muls,
+ ops_plus = M * Traits<value_type>::ops_plus,
+ ops_muls = N * Traits<value_type>::ops_muls,
ops = ops_plus + ops_muls,
use_meta = Rows1*Cols2 < TVMET_COMPLEXITY_MM_TRIGGER ? true : false
};
diff --git a/tvmet-1.7.1/include/tvmet/xpr/MMProductTransposed.h b/tvmet-1.7.1/include/tvmet/xpr/MMProductTransposed.h
index d8fb735b1..d869e3af8 100644
--- a/tvmet-1.7.1/include/tvmet/xpr/MMProductTransposed.h
+++ b/tvmet-1.7.1/include/tvmet/xpr/MMProductTransposed.h
@@ -64,8 +64,8 @@ public:
ops_rhs = E2::ops,
M = Rows1 * Cols1 * Cols2,
N = Rows1 * (Cols1-1) * Cols2,
- ops_plus = M * NumericTraits<value_type>::ops_plus,
- ops_muls = N * NumericTraits<value_type>::ops_muls,
+ ops_plus = M * Traits<value_type>::ops_plus,
+ ops_muls = N * Traits<value_type>::ops_muls,
ops = ops_plus + ops_muls,
use_meta = Cols2*Rows1 < TVMET_COMPLEXITY_MM_TRIGGER ? true : false
};
diff --git a/tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h
index 1cc7bd9cf..71c6dda63 100644
--- a/tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h
+++ b/tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h
@@ -65,8 +65,8 @@ public:
Rows2 = Cols1,
M = Rows1 * Cols1 * Rows1,
N = Rows1 * (Cols1 - 1) * Rows2,
- ops_plus = M * NumericTraits<value_type>::ops_plus,
- ops_muls = N * NumericTraits<value_type>::ops_muls,
+ ops_plus = M * Traits<value_type>::ops_plus,
+ ops_muls = N * Traits<value_type>::ops_muls,
ops = ops_plus + ops_muls,
use_meta = Rows1*Rows2 < TVMET_COMPLEXITY_MM_TRIGGER ? true : false
};
diff --git a/tvmet-1.7.1/include/tvmet/xpr/MVProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MVProduct.h
index 751431656..0b9202f15 100644
--- a/tvmet-1.7.1/include/tvmet/xpr/MVProduct.h
+++ b/tvmet-1.7.1/include/tvmet/xpr/MVProduct.h
@@ -61,8 +61,8 @@ public:
ops_rhs = E2::ops,
M = Rows * Cols,
N = Rows * (Cols - 1),
- ops_plus = M * NumericTraits<value_type>::ops_plus,
- ops_muls = N * NumericTraits<value_type>::ops_muls,
+ ops_plus = M * Traits<value_type>::ops_plus,
+ ops_muls = N * Traits<value_type>::ops_muls,
ops = ops_plus + ops_muls,
use_meta = Rows*Cols < TVMET_COMPLEXITY_MV_TRIGGER ? true : false
};
diff --git a/tvmet-1.7.1/include/tvmet/xpr/MatrixFunctions.h b/tvmet-1.7.1/include/tvmet/xpr/MatrixFunctions.h
index 288efb798..54f02c08d 100644
--- a/tvmet-1.7.1/include/tvmet/xpr/MatrixFunctions.h
+++ b/tvmet-1.7.1/include/tvmet/xpr/MatrixFunctions.h
@@ -255,7 +255,7 @@ trans(const XprMatrix<E, Rows, Cols>& rhs) _tvmet_always_inline;
#if 0 // XXX needs declaration of meta::Matrix<Sz, Sz, 0, 0>::trace
template<class E, int Sz>
-typename NumericTraits<typename E::value_type>::sum_type
+typename Traits<typename E::value_type>::sum_type
trace(const XprMatrix<E, Sz, Sz>& m)_tvmet_always_inline;
#endif
@@ -649,7 +649,7 @@ trans(const XprMatrix<E, Rows, Cols>& rhs) {
*/
template<class E, int Sz>
inline
-typename NumericTraits<typename E::value_type>::sum_type
+typename Traits<typename E::value_type>::sum_type
trace(const XprMatrix<E, Sz, Sz>& m) {
return meta::Matrix<Sz, Sz, 0, 0>::trace(m);
}
diff --git a/tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h
index f985ca7f7..6d657d086 100644
--- a/tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h
+++ b/tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h
@@ -65,8 +65,8 @@ public:
ops_rhs = E2::ops,
M = Rows1 * Cols1 * Cols2,
N = (Rows1-1) * Cols1 * Cols2,
- ops_plus = M * NumericTraits<value_type>::ops_plus,
- ops_muls = N * NumericTraits<value_type>::ops_muls,
+ ops_plus = M * Traits<value_type>::ops_plus,
+ ops_muls = N * Traits<value_type>::ops_muls,
ops = ops_plus + ops_muls,
use_meta = Cols1*Cols2 < TVMET_COMPLEXITY_MM_TRIGGER ? true : false
};
diff --git a/tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h
index 3967dbe42..a50bacc97 100644
--- a/tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h
+++ b/tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h
@@ -61,8 +61,8 @@ public:
ops_rhs = E2::ops,
M = Cols * Rows,
N = Cols * (Rows - 1),
- ops_plus = M * NumericTraits<value_type>::ops_plus,
- ops_muls = N * NumericTraits<value_type>::ops_muls,
+ ops_plus = M * Traits<value_type>::ops_plus,
+ ops_muls = N * Traits<value_type>::ops_muls,
ops = ops_plus + ops_muls,
use_meta = Rows*Cols < TVMET_COMPLEXITY_MV_TRIGGER ? true : false
};
diff --git a/tvmet-1.7.1/include/tvmet/xpr/VectorFunctions.h b/tvmet-1.7.1/include/tvmet/xpr/VectorFunctions.h
index 846aaf842..172ed7ab2 100644
--- a/tvmet-1.7.1/include/tvmet/xpr/VectorFunctions.h
+++ b/tvmet-1.7.1/include/tvmet/xpr/VectorFunctions.h
@@ -163,12 +163,12 @@ TVMET_DECLARE_MACRO(div)
template<class E, int Sz>
-typename NumericTraits<typename E::value_type>::sum_type
+typename Traits<typename E::value_type>::sum_type
sum(const XprVector<E, Sz>& v) _tvmet_always_inline;
template<class E, int Sz>
-typename NumericTraits<typename E::value_type>::sum_type
+typename Traits<typename E::value_type>::sum_type
product(const XprVector<E, Sz>& v) _tvmet_always_inline;
@@ -220,12 +220,12 @@ cross(const XprVector<E, 3>& lhs,
template<class E, int Sz>
-typename NumericTraits<typename E::value_type>::sum_type
+typename Traits<typename E::value_type>::sum_type
norm1(const XprVector<E, Sz>& v) _tvmet_always_inline;
template<class E, int Sz>
-typename NumericTraits<typename E::value_type>::sum_type
+typename Traits<typename E::value_type>::sum_type
norm2(const XprVector<E, Sz>& v) _tvmet_always_inline;
@@ -418,7 +418,7 @@ TVMET_IMPLEMENT_MACRO(div)
*/
template<class E, int Sz>
inline
-typename NumericTraits<typename E::value_type>::sum_type
+typename Traits<typename E::value_type>::sum_type
sum(const XprVector<E, Sz>& v) {
return meta::Vector<Sz>::sum(v);
}
@@ -436,7 +436,7 @@ sum(const XprVector<E, Sz>& v) {
*/
template<class E, int Sz>
inline
-typename NumericTraits<typename E::value_type>::sum_type
+typename Traits<typename E::value_type>::sum_type
product(const XprVector<E, Sz>& v) {
return meta::Vector<Sz>::product(v);
}
@@ -585,7 +585,7 @@ cross(const Vector<T1, 3>& lhs, const XprVector<E2, 3>& rhs) {
*/
template<class E, int Sz>
inline
-typename NumericTraits<typename E::value_type>::sum_type
+typename Traits<typename E::value_type>::sum_type
norm1(const XprVector<E, Sz>& v) {
return sum(abs(v));
}
@@ -606,7 +606,7 @@ norm1(const XprVector<E, Sz>& v) {
*/
template<class E, int Sz>
inline
-typename NumericTraits<typename E::value_type>::sum_type
+typename Traits<typename E::value_type>::sum_type
norm2(const XprVector<E, Sz>& v) {
typedef typename E::value_type value_type;
return static_cast<value_type>( std::sqrt(static_cast<value_type>(dot(v, v))) );