From 6fe6a81839a7f881d810ccea5253e3d1928b53ca Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Tue, 5 Jun 2007 08:44:53 +0000 Subject: Fix enough stuff, and remove enough dead stuff, to make a simple test program compile --- tvmet-1.7.1/include/tvmet/Io.h | 2 +- tvmet-1.7.1/include/tvmet/MatrixImpl.h | 1 - tvmet-1.7.1/include/tvmet/MatrixOperators.h | 540 --------------------- tvmet-1.7.1/include/tvmet/MatrixUnaryFunctions.h | 141 ------ tvmet-1.7.1/include/tvmet/UnaryFunctionals.h | 247 +--------- tvmet-1.7.1/include/tvmet/VectorOperators.h | 530 -------------------- tvmet-1.7.1/include/tvmet/VectorUnaryFunctions.h | 129 ----- tvmet-1.7.1/include/tvmet/tvmet.h | 23 - tvmet-1.7.1/include/tvmet/xpr/MMProduct.h | 4 +- .../include/tvmet/xpr/MMProductTransposed.h | 4 +- tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h | 4 +- tvmet-1.7.1/include/tvmet/xpr/MVProduct.h | 4 +- tvmet-1.7.1/include/tvmet/xpr/Matrix.h | 5 +- tvmet-1.7.1/include/tvmet/xpr/MatrixCol.h | 6 +- tvmet-1.7.1/include/tvmet/xpr/MatrixDiag.h | 4 +- tvmet-1.7.1/include/tvmet/xpr/MatrixOperators.h | 447 ----------------- tvmet-1.7.1/include/tvmet/xpr/MatrixRow.h | 6 +- .../include/tvmet/xpr/MatrixUnaryFunctions.h | 172 ------- tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h | 4 +- tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h | 4 +- tvmet-1.7.1/include/tvmet/xpr/Vector.h | 3 +- tvmet-1.7.1/include/tvmet/xpr/VectorOperators.h | 439 ----------------- .../include/tvmet/xpr/VectorUnaryFunctions.h | 172 ------- 23 files changed, 35 insertions(+), 2856 deletions(-) delete mode 100644 tvmet-1.7.1/include/tvmet/xpr/MatrixUnaryFunctions.h delete mode 100644 tvmet-1.7.1/include/tvmet/xpr/VectorUnaryFunctions.h (limited to 'tvmet-1.7.1/include') diff --git a/tvmet-1.7.1/include/tvmet/Io.h b/tvmet-1.7.1/include/tvmet/Io.h index de7905c05..7aef92ddf 100644 --- a/tvmet-1.7.1/include/tvmet/Io.h +++ b/tvmet-1.7.1/include/tvmet/Io.h @@ -43,7 +43,7 @@ class IoPrintHelper { private: static std::streamsize width(const C& e) { - std::streamsize w = static_cast(std::log10(max(abs(e)))+1); + std::streamsize w = static_cast(10); //FIXME arbitrary value return w > 0 ? w : 0; } diff --git a/tvmet-1.7.1/include/tvmet/MatrixImpl.h b/tvmet-1.7.1/include/tvmet/MatrixImpl.h index 738daaec7..8704366fc 100644 --- a/tvmet-1.7.1/include/tvmet/MatrixImpl.h +++ b/tvmet-1.7.1/include/tvmet/MatrixImpl.h @@ -71,7 +71,6 @@ std::ostream& Matrix::print_on(std::ostream& os) const return os; } - /* * member operators with scalars, per se element wise */ diff --git a/tvmet-1.7.1/include/tvmet/MatrixOperators.h b/tvmet-1.7.1/include/tvmet/MatrixOperators.h index 372c5fe3d..b1000fedc 100644 --- a/tvmet-1.7.1/include/tvmet/MatrixOperators.h +++ b/tvmet-1.7.1/include/tvmet/MatrixOperators.h @@ -66,16 +66,6 @@ namespace element_wise { TVMET_DECLARE_MACRO(div_eq, /=) // not defined for vectors } -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_DECLARE_MACRO(mod_eq, %=) - TVMET_DECLARE_MACRO(xor_eq, ^=) - TVMET_DECLARE_MACRO(and_eq, &=) - TVMET_DECLARE_MACRO(or_eq, |=) - TVMET_DECLARE_MACRO(shl_eq, <<=) - TVMET_DECLARE_MACRO(shr_eq, >>=) -} - #undef TVMET_DECLARE_MACRO @@ -326,235 +316,6 @@ operator*(const XprMatrix& lhs, const Vector& rhs) TVMET_CXX_ALWAYS_INLINE; -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Matrix integer and compare operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(Matrix, Matrix) - * operator(XprMatrix, Matrix) - * operator(Matrix, XprMatrix) - * Note: operations are per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - MatrixConstReference, \ - MatrixConstReference \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix& lhs, \ - const Matrix& rhs) TVMET_CXX_ALWAYS_INLINE; \ - \ -template \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprMatrix, \ - MatrixConstReference \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix& lhs, \ - const Matrix& rhs) TVMET_CXX_ALWAYS_INLINE; \ - \ -template \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - MatrixConstReference, \ - XprMatrix \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix& lhs, \ - const XprMatrix& rhs) TVMET_CXX_ALWAYS_INLINE; - -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_DECLARE_MACRO(mod, %) - TVMET_DECLARE_MACRO(bitxor, ^) - TVMET_DECLARE_MACRO(bitand, &) - TVMET_DECLARE_MACRO(bitor, |) - TVMET_DECLARE_MACRO(shl, <<) - TVMET_DECLARE_MACRO(shr, >>) -} - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >) -TVMET_DECLARE_MACRO(less, <) -TVMET_DECLARE_MACRO(greater_eq, >=) -TVMET_DECLARE_MACRO(less_eq, <=) -TVMET_DECLARE_MACRO(eq, ==) -TVMET_DECLARE_MACRO(not_eq, !=) -TVMET_DECLARE_MACRO(and, &&) -TVMET_DECLARE_MACRO(or, ||) - -#undef TVMET_DECLARE_MACRO - - -#if defined(TVMET_HAVE_COMPLEX) -/* - * operator(Matrix, complex) - * operator(complex, Matrix) - * Note: - per se element wise - * - bit ops on complex doesn't make sense, stay away - * \todo type promotion - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< std::complex, std::complex >, \ - MatrixConstReference< std::complex, Rows, Cols>, \ - XprLiteral > \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix< std::complex, Rows, Cols>& lhs, \ - const std::complex& rhs) TVMET_CXX_ALWAYS_INLINE; \ - \ -template \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< std::complex, std::complex >, \ - XprLiteral< std::complex >, \ - MatrixConstReference< std::complex, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const std::complex& lhs, \ - const Matrix< std::complex, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >) -TVMET_DECLARE_MACRO(less, <) -TVMET_DECLARE_MACRO(greater_eq, >=) -TVMET_DECLARE_MACRO(less_eq, <=) -TVMET_DECLARE_MACRO(eq, ==) -TVMET_DECLARE_MACRO(not_eq, !=) -TVMET_DECLARE_MACRO(and, &&) -TVMET_DECLARE_MACRO(or, ||) - -#undef TVMET_DECLARE_MACRO - -#endif // defined(TVMET_HAVE_COMPLEX) - - -/* - * operator(Matrix, POD) - * operator(POD, Matrix) - * Note: operations are per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP, TP) \ -template \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - MatrixConstReference, \ - XprLiteral \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix& lhs, TP rhs) TVMET_CXX_ALWAYS_INLINE; \ - \ -template \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< TP, T>, \ - XprLiteral< TP >, \ - MatrixConstReference \ - >, \ - Rows, Cols \ -> \ -operator OP (TP lhs, const Matrix& rhs) TVMET_CXX_ALWAYS_INLINE; - -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_DECLARE_MACRO(mod, %, int) - TVMET_DECLARE_MACRO(bitxor, ^, int) - TVMET_DECLARE_MACRO(bitand, &, int) - TVMET_DECLARE_MACRO(bitor, |, int) - TVMET_DECLARE_MACRO(shl, <<, int) - TVMET_DECLARE_MACRO(shr, >>, int) -} - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, int) -TVMET_DECLARE_MACRO(less, <, int) -TVMET_DECLARE_MACRO(greater_eq, >=, int) -TVMET_DECLARE_MACRO(less_eq, <=, int) -TVMET_DECLARE_MACRO(eq, ==, int) -TVMET_DECLARE_MACRO(not_eq, !=, int) -TVMET_DECLARE_MACRO(and, &&, int) -TVMET_DECLARE_MACRO(or, ||, int) - -#if defined(TVMET_HAVE_LONG_LONG) -// integer operators only -namespace element_wise { - TVMET_DECLARE_MACRO(mod, %, long long int) - TVMET_DECLARE_MACRO(bitxor, ^, long long int) - TVMET_DECLARE_MACRO(bitand, &, long long int) - TVMET_DECLARE_MACRO(bitor, |, long long int) - TVMET_DECLARE_MACRO(shl, <<, long long int) - TVMET_DECLARE_MACRO(shr, >>, long long int) -} - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, long long int) -TVMET_DECLARE_MACRO(less, <, long long int) -TVMET_DECLARE_MACRO(greater_eq, >=, long long int) -TVMET_DECLARE_MACRO(less_eq, <=, long long int) -TVMET_DECLARE_MACRO(eq, ==, long long int) -TVMET_DECLARE_MACRO(not_eq, !=, long long int) -TVMET_DECLARE_MACRO(and, &&, long long int) -TVMET_DECLARE_MACRO(or, ||, long long int) -#endif // defined(TVMET_HAVE_LONG_LONG) - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, float) -TVMET_DECLARE_MACRO(less, <, float) -TVMET_DECLARE_MACRO(greater_eq, >=, float) -TVMET_DECLARE_MACRO(less_eq, <=, float) -TVMET_DECLARE_MACRO(eq, ==, float) -TVMET_DECLARE_MACRO(not_eq, !=, float) -TVMET_DECLARE_MACRO(and, &&, float) -TVMET_DECLARE_MACRO(or, ||, float) - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, double) -TVMET_DECLARE_MACRO(less, <, double) -TVMET_DECLARE_MACRO(greater_eq, >=, double) -TVMET_DECLARE_MACRO(less_eq, <=, double) -TVMET_DECLARE_MACRO(eq, ==, double) -TVMET_DECLARE_MACRO(not_eq, !=, double) -TVMET_DECLARE_MACRO(and, &&, double) -TVMET_DECLARE_MACRO(or, ||, double) - -#if defined(TVMET_HAVE_LONG_DOUBLE) -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, long double) -TVMET_DECLARE_MACRO(less, <, long double) -TVMET_DECLARE_MACRO(greater_eq, >=, long double) -TVMET_DECLARE_MACRO(less_eq, <=, long double) -TVMET_DECLARE_MACRO(eq, ==, long double) -TVMET_DECLARE_MACRO(not_eq, !=, long double) -TVMET_DECLARE_MACRO(and, &&, long double) -TVMET_DECLARE_MACRO(or, ||, long double) -#endif // defined(TVMET_HAVE_LONG_DOUBLE) - -#undef TVMET_DECLARE_MACRO - - - - /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * global unary operators *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ @@ -575,8 +336,6 @@ XprMatrix< \ > \ operator OP (const Matrix& rhs) TVMET_CXX_ALWAYS_INLINE; -TVMET_DECLARE_MACRO(not, !) -TVMET_DECLARE_MACRO(compl, ~) TVMET_DECLARE_MACRO(neg, -) #undef TVMET_DECLARE_MACRO @@ -631,16 +390,6 @@ namespace element_wise { TVMET_IMPLEMENT_MACRO(div_eq, /=) // not defined for vectors } -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod_eq, %=) - TVMET_IMPLEMENT_MACRO(xor_eq, ^=) - TVMET_IMPLEMENT_MACRO(and_eq, &=) - TVMET_IMPLEMENT_MACRO(or_eq, |=) - TVMET_IMPLEMENT_MACRO(shl_eq, <<=) - TVMET_IMPLEMENT_MACRO(shr_eq, >>=) -} - #undef TVMET_IMPLEMENT_MACRO @@ -957,293 +706,6 @@ operator*(const XprMatrix& lhs, const Vector& rhs) { } -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Matrix integer and compare operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(Matrix, Matrix) - * operator(XprMatrix, Matrix) - * operator(Matrix, XprMatrix) - * Note: operations are per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - MatrixConstReference, \ - MatrixConstReference \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix& lhs, \ - const Matrix& rhs) { \ - typedef XprBinOp < \ - Fcnl_##NAME, \ - MatrixConstReference, \ - MatrixConstReference \ - > expr_type; \ - return XprMatrix(expr_type(lhs.const_ref(), rhs.const_ref())); \ -} \ - \ -template \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprMatrix, \ - MatrixConstReference \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix& lhs, const Matrix& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME, \ - XprMatrix, \ - MatrixConstReference \ - > expr_type; \ - return XprMatrix(expr_type(lhs, rhs.const_ref())); \ -} \ - \ -template \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - MatrixConstReference, \ - XprMatrix \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix& lhs, const XprMatrix& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME, \ - MatrixConstReference, \ - XprMatrix \ - > expr_type; \ - return XprMatrix(expr_type(lhs.const_ref(), rhs)); \ -} - -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod, %) - TVMET_IMPLEMENT_MACRO(bitxor, ^) - TVMET_IMPLEMENT_MACRO(bitand, &) - TVMET_IMPLEMENT_MACRO(bitor, |) - TVMET_IMPLEMENT_MACRO(shl, <<) - TVMET_IMPLEMENT_MACRO(shr, >>) -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >) -TVMET_IMPLEMENT_MACRO(less, <) -TVMET_IMPLEMENT_MACRO(greater_eq, >=) -TVMET_IMPLEMENT_MACRO(less_eq, <=) -TVMET_IMPLEMENT_MACRO(eq, ==) -TVMET_IMPLEMENT_MACRO(not_eq, !=) -TVMET_IMPLEMENT_MACRO(and, &&) -TVMET_IMPLEMENT_MACRO(or, ||) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(TVMET_HAVE_COMPLEX) -/* - * operator(Matrix, complex) - * operator(complex, Matrix) - * Note: - per se element wise - * - bit ops on complex doesn't make sense, stay away - * \todo type promotion - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< std::complex, std::complex >, \ - MatrixConstReference< std::complex, Rows, Cols>, \ - XprLiteral > \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix< std::complex, Rows, Cols>& lhs, \ - const std::complex& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< std::complex, std::complex >, \ - MatrixConstReference< std::complex, Rows, Cols>, \ - XprLiteral< std::complex > \ - > expr_type; \ - return XprMatrix( \ - expr_type(lhs.const_ref(), XprLiteral< std::complex >(rhs))); \ -} \ - \ -template \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< std::complex, std::complex >, \ - XprLiteral< std::complex >, \ - MatrixConstReference< std::complex, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const std::complex& lhs, \ - const Matrix< std::complex, Rows, Cols>& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< std::complex, std::complex >, \ - XprLiteral< std::complex >, \ - MatrixConstReference \ - > expr_type; \ - return XprMatrix( \ - expr_type(XprLiteral< std::complex >(lhs), rhs.const_ref())); \ -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >) -TVMET_IMPLEMENT_MACRO(less, <) -TVMET_IMPLEMENT_MACRO(greater_eq, >=) -TVMET_IMPLEMENT_MACRO(less_eq, <=) -TVMET_IMPLEMENT_MACRO(eq, ==) -TVMET_IMPLEMENT_MACRO(not_eq, !=) -TVMET_IMPLEMENT_MACRO(and, &&) -TVMET_IMPLEMENT_MACRO(or, ||) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(TVMET_HAVE_COMPLEX) - - -/* - * operator(Matrix, POD) - * operator(POD, Matrix) - * Note: operations are per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP, TP) \ -template \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - MatrixConstReference, \ - XprLiteral \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix& lhs, TP rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME, \ - MatrixConstReference, \ - XprLiteral< TP > \ - > expr_type; \ - return XprMatrix( \ - expr_type(lhs.const_ref(), XprLiteral< TP >(rhs))); \ -} \ - \ -template \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< TP, T>, \ - XprLiteral< TP >, \ - MatrixConstReference \ - >, \ - Rows, Cols \ -> \ -operator OP (TP lhs, const Matrix& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< TP, T>, \ - XprLiteral< TP >, \ - MatrixConstReference \ - > expr_type; \ - return XprMatrix( \ - expr_type(XprLiteral< TP >(lhs), rhs.const_ref())); \ -} - -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod, %, int) - TVMET_IMPLEMENT_MACRO(bitxor, ^, int) - TVMET_IMPLEMENT_MACRO(bitand, &, int) - TVMET_IMPLEMENT_MACRO(bitor, |, int) - TVMET_IMPLEMENT_MACRO(shl, <<, int) - TVMET_IMPLEMENT_MACRO(shr, >>, int) -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, int) -TVMET_IMPLEMENT_MACRO(less, <, int) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, int) -TVMET_IMPLEMENT_MACRO(less_eq, <=, int) -TVMET_IMPLEMENT_MACRO(eq, ==, int) -TVMET_IMPLEMENT_MACRO(not_eq, !=, int) -TVMET_IMPLEMENT_MACRO(and, &&, int) -TVMET_IMPLEMENT_MACRO(or, ||, int) - -#if defined(TVMET_HAVE_LONG_LONG) -// integer operators only -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod, %, long long int) - TVMET_IMPLEMENT_MACRO(bitxor, ^, long long int) - TVMET_IMPLEMENT_MACRO(bitand, &, long long int) - TVMET_IMPLEMENT_MACRO(bitor, |, long long int) - TVMET_IMPLEMENT_MACRO(shl, <<, long long int) - TVMET_IMPLEMENT_MACRO(shr, >>, long long int) -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, long long int) -TVMET_IMPLEMENT_MACRO(less, <, long long int) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, long long int) -TVMET_IMPLEMENT_MACRO(less_eq, <=, long long int) -TVMET_IMPLEMENT_MACRO(eq, ==, long long int) -TVMET_IMPLEMENT_MACRO(not_eq, !=, long long int) -TVMET_IMPLEMENT_MACRO(and, &&, long long int) -TVMET_IMPLEMENT_MACRO(or, ||, long long int) -#endif // defined(TVMET_HAVE_LONG_LONG) - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, float) -TVMET_IMPLEMENT_MACRO(less, <, float) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, float) -TVMET_IMPLEMENT_MACRO(less_eq, <=, float) -TVMET_IMPLEMENT_MACRO(eq, ==, float) -TVMET_IMPLEMENT_MACRO(not_eq, !=, float) -TVMET_IMPLEMENT_MACRO(and, &&, float) -TVMET_IMPLEMENT_MACRO(or, ||, float) - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, double) -TVMET_IMPLEMENT_MACRO(less, <, double) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, double) -TVMET_IMPLEMENT_MACRO(less_eq, <=, double) -TVMET_IMPLEMENT_MACRO(eq, ==, double) -TVMET_IMPLEMENT_MACRO(not_eq, !=, double) -TVMET_IMPLEMENT_MACRO(and, &&, double) -TVMET_IMPLEMENT_MACRO(or, ||, double) - -#if defined(TVMET_HAVE_LONG_DOUBLE) -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, long double) -TVMET_IMPLEMENT_MACRO(less, <, long double) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, long double) -TVMET_IMPLEMENT_MACRO(less_eq, <=, long double) -TVMET_IMPLEMENT_MACRO(eq, ==, long double) -TVMET_IMPLEMENT_MACRO(not_eq, !=, long double) -TVMET_IMPLEMENT_MACRO(and, &&, long double) -TVMET_IMPLEMENT_MACRO(or, ||, long double) -#endif // defined(TVMET_HAVE_LONG_DOUBLE) - -#undef TVMET_IMPLEMENT_MACRO - - - - /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * global unary operators *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ @@ -1271,8 +733,6 @@ operator OP (const Matrix& rhs) { \ return XprMatrix(expr_type(rhs.const_ref())); \ } -TVMET_IMPLEMENT_MACRO(not, !) -TVMET_IMPLEMENT_MACRO(compl, ~) TVMET_IMPLEMENT_MACRO(neg, -) #undef TVMET_IMPLEMENT_MACRO diff --git a/tvmet-1.7.1/include/tvmet/MatrixUnaryFunctions.h b/tvmet-1.7.1/include/tvmet/MatrixUnaryFunctions.h index 2300977a4..39c3e92bc 100644 --- a/tvmet-1.7.1/include/tvmet/MatrixUnaryFunctions.h +++ b/tvmet-1.7.1/include/tvmet/MatrixUnaryFunctions.h @@ -26,71 +26,6 @@ namespace tvmet { - -/********************************************************* - * PART I: DECLARATION - *********************************************************/ - -/* - * unary_function(Matrix) - */ -#define TVMET_DECLARE_MACRO(NAME) \ -template \ -inline \ -XprMatrix< \ - XprUnOp< \ - Fcnl_##NAME, \ - MatrixConstReference \ - >, \ - Rows, Cols \ -> \ -NAME(const Matrix& rhs) TVMET_CXX_ALWAYS_INLINE; - -TVMET_DECLARE_MACRO(abs) -TVMET_DECLARE_MACRO(cbrt) -TVMET_DECLARE_MACRO(ceil) -TVMET_DECLARE_MACRO(floor) -TVMET_DECLARE_MACRO(rint) -TVMET_DECLARE_MACRO(sin) -TVMET_DECLARE_MACRO(cos) -TVMET_DECLARE_MACRO(tan) -TVMET_DECLARE_MACRO(sinh) -TVMET_DECLARE_MACRO(cosh) -TVMET_DECLARE_MACRO(tanh) -TVMET_DECLARE_MACRO(asin) -TVMET_DECLARE_MACRO(acos) -TVMET_DECLARE_MACRO(atan) -TVMET_DECLARE_MACRO(exp) -TVMET_DECLARE_MACRO(log) -TVMET_DECLARE_MACRO(log10) -TVMET_DECLARE_MACRO(sqrt) - -#if defined(TVMET_HAVE_IEEE_MATH) -TVMET_DECLARE_MACRO(asinh) -TVMET_DECLARE_MACRO(acosh) -TVMET_DECLARE_MACRO(atanh) -TVMET_DECLARE_MACRO(expm1) -TVMET_DECLARE_MACRO(log1p) -TVMET_DECLARE_MACRO(erf) -TVMET_DECLARE_MACRO(erfc) -TVMET_DECLARE_MACRO(j0) -TVMET_DECLARE_MACRO(j1) -TVMET_DECLARE_MACRO(y0) -TVMET_DECLARE_MACRO(y1) -TVMET_DECLARE_MACRO(lgamma) -/** \todo isnan etc. - default return is only an int! */ -#if !defined(TVMET_NO_IEEE_MATH_ISNAN) -TVMET_DECLARE_MACRO(isnan) -#endif -#if !defined(TVMET_NO_IEEE_MATH_ISINF) -TVMET_DECLARE_MACRO(isinf) -#endif -TVMET_DECLARE_MACRO(finite) -#endif // defined(TVMET_HAVE_IEEE_MATH) - -#undef TVMET_DECLARE_MACRO - - /* * unary_function(Matrix, Rows, Cols>) */ @@ -109,86 +44,12 @@ NAME(const Matrix, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; TVMET_DECLARE_MACRO(real) TVMET_DECLARE_MACRO(imag) -TVMET_DECLARE_MACRO(arg) -TVMET_DECLARE_MACRO(norm) TVMET_DECLARE_MACRO(conj) #undef TVMET_DECLARE_MACRO #endif // defined(TVMET_HAVE_COMPLEX) - -/********************************************************* - * PART II: IMPLEMENTATION - *********************************************************/ - - -/* - * unary_function(Matrix) - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template \ -inline \ -XprMatrix< \ - XprUnOp< \ - Fcnl_##NAME, \ - MatrixConstReference \ - >, \ - Rows, Cols \ -> \ -NAME(const Matrix& rhs) { \ - typedef XprUnOp< \ - Fcnl_##NAME, \ - MatrixConstReference \ - > expr_type; \ - return XprMatrix(expr_type(rhs.const_ref())); \ -} - -TVMET_IMPLEMENT_MACRO(abs) -TVMET_IMPLEMENT_MACRO(cbrt) -TVMET_IMPLEMENT_MACRO(ceil) -TVMET_IMPLEMENT_MACRO(floor) -TVMET_IMPLEMENT_MACRO(rint) -TVMET_IMPLEMENT_MACRO(sin) -TVMET_IMPLEMENT_MACRO(cos) -TVMET_IMPLEMENT_MACRO(tan) -TVMET_IMPLEMENT_MACRO(sinh) -TVMET_IMPLEMENT_MACRO(cosh) -TVMET_IMPLEMENT_MACRO(tanh) -TVMET_IMPLEMENT_MACRO(asin) -TVMET_IMPLEMENT_MACRO(acos) -TVMET_IMPLEMENT_MACRO(atan) -TVMET_IMPLEMENT_MACRO(exp) -TVMET_IMPLEMENT_MACRO(log) -TVMET_IMPLEMENT_MACRO(log10) -TVMET_IMPLEMENT_MACRO(sqrt) - -#if defined(TVMET_HAVE_IEEE_MATH) -TVMET_IMPLEMENT_MACRO(asinh) -TVMET_IMPLEMENT_MACRO(acosh) -TVMET_IMPLEMENT_MACRO(atanh) -TVMET_IMPLEMENT_MACRO(expm1) -TVMET_IMPLEMENT_MACRO(log1p) -TVMET_IMPLEMENT_MACRO(erf) -TVMET_IMPLEMENT_MACRO(erfc) -TVMET_IMPLEMENT_MACRO(j0) -TVMET_IMPLEMENT_MACRO(j1) -TVMET_IMPLEMENT_MACRO(y0) -TVMET_IMPLEMENT_MACRO(y1) -TVMET_IMPLEMENT_MACRO(lgamma) -/** \todo isnan etc. - default return is only an int! */ -#if !defined(TVMET_NO_IEEE_MATH_ISNAN) -TVMET_IMPLEMENT_MACRO(isnan) -#endif -#if !defined(TVMET_NO_IEEE_MATH_ISINF) -TVMET_IMPLEMENT_MACRO(isinf) -#endif -TVMET_IMPLEMENT_MACRO(finite) -#endif // defined(TVMET_HAVE_IEEE_MATH) - -#undef TVMET_IMPLEMENT_MACRO - - /* * unary_function(Matrix, Rows, Cols>) */ @@ -213,8 +74,6 @@ NAME(const Matrix, Rows, Cols>& rhs) { \ TVMET_IMPLEMENT_MACRO(real) TVMET_IMPLEMENT_MACRO(imag) -TVMET_IMPLEMENT_MACRO(arg) -TVMET_IMPLEMENT_MACRO(norm) TVMET_IMPLEMENT_MACRO(conj) #undef TVMET_IMPLEMENT_MACRO diff --git a/tvmet-1.7.1/include/tvmet/UnaryFunctionals.h b/tvmet-1.7.1/include/tvmet/UnaryFunctionals.h index fa3176496..4772cc34a 100644 --- a/tvmet-1.7.1/include/tvmet/UnaryFunctionals.h +++ b/tvmet-1.7.1/include/tvmet/UnaryFunctionals.h @@ -26,27 +26,6 @@ namespace tvmet { - -/** - * \class Fcnl_not UnaryFunctionals.h "tvmet/UnaryFunctionals.h" - * \brief unary functional for logical not. - */ -template -struct Fcnl_not : public UnaryFunctional { - static inline - bool apply_on(T rhs) { - return !rhs; - } - - static - void print_xpr(std::ostream& os, int l=0) { - os << IndentLevel(l) << "Fcnl_not," - << std::endl; - } -}; - - /** \class Fcnl_compl UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ /** \class Fcnl_neg UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ #define TVMET_IMPLEMENT_MACRO(NAME, OP) \ @@ -67,206 +46,15 @@ struct Fcnl_##NAME : public UnaryFunctional { \ } \ }; -TVMET_IMPLEMENT_MACRO(compl, ~) TVMET_IMPLEMENT_MACRO(neg, -) #undef TVMET_IMPLEMENT_MACRO - -/** \class Fcnl_abs UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_ceil UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_floor UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_sin UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_cos UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_tan UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_sinh UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_cosh UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_tanh UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_asin UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_acos UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_atan UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_exp UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_log UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_log10 UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_sqrt UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template \ -struct Fcnl_##NAME : public UnaryFunctional { \ - typedef T value_type; \ - \ - static inline \ - value_type apply_on(value_type rhs) { \ - return TVMET_STD_SCOPE(NAME)(rhs); \ - } \ - \ - static \ - void print_xpr(std::ostream& os, int l=0) { \ - os << IndentLevel(l) << "Fcnl_" << #NAME << "," \ - << std::endl; \ - } \ -}; - -TVMET_IMPLEMENT_MACRO(abs) // specialized later, see below -TVMET_IMPLEMENT_MACRO(ceil) -TVMET_IMPLEMENT_MACRO(floor) -TVMET_IMPLEMENT_MACRO(sin) -TVMET_IMPLEMENT_MACRO(cos) -TVMET_IMPLEMENT_MACRO(tan) -TVMET_IMPLEMENT_MACRO(sinh) -TVMET_IMPLEMENT_MACRO(cosh) -TVMET_IMPLEMENT_MACRO(tanh) -TVMET_IMPLEMENT_MACRO(asin) -TVMET_IMPLEMENT_MACRO(acos) -TVMET_IMPLEMENT_MACRO(atan) -TVMET_IMPLEMENT_MACRO(exp) -TVMET_IMPLEMENT_MACRO(log) -TVMET_IMPLEMENT_MACRO(log10) -TVMET_IMPLEMENT_MACRO(sqrt) - -#undef TVMET_IMPLEMENT_MACRO - - -/** \class Fcnl_cbrt UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_rint UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template \ -struct Fcnl_##NAME : public UnaryFunctional { \ - typedef T value_type; \ - \ - static inline \ - value_type apply_on(value_type rhs) { \ - return TVMET_GLOBAL_SCOPE(NAME)(rhs); \ - } \ - \ - static \ - void print_xpr(std::ostream& os, int l=0) { \ - os << IndentLevel(l) << "Fcnl_" << #NAME << "," \ - << std::endl; \ - } \ -}; - -TVMET_IMPLEMENT_MACRO(cbrt) -TVMET_IMPLEMENT_MACRO(rint) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(TVMET_HAVE_IEEE_MATH) - -/** \class Fcnl_asinh UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_acosh UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_atanh UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_expm1 UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_log1p UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_erf UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_erfc UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_j0 UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_j1 UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_y0 UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_y1 UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_lgamma UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template \ -struct Fcnl_##NAME : public UnaryFunctional { \ - typedef T value_type; \ - \ - static inline \ - value_type apply_on(value_type rhs) { \ - return TVMET_GLOBAL_SCOPE(NAME)(rhs); \ - } \ - \ - static \ - void print_xpr(std::ostream& os, int l=0) { \ - os << IndentLevel(l) << "Fcnl_" << #NAME << "," \ - << std::endl; \ - } \ -}; - -TVMET_IMPLEMENT_MACRO(asinh) -TVMET_IMPLEMENT_MACRO(acosh) -TVMET_IMPLEMENT_MACRO(atanh) -TVMET_IMPLEMENT_MACRO(expm1) -TVMET_IMPLEMENT_MACRO(log1p) -TVMET_IMPLEMENT_MACRO(erf) -TVMET_IMPLEMENT_MACRO(erfc) -TVMET_IMPLEMENT_MACRO(j0) -TVMET_IMPLEMENT_MACRO(j1) -TVMET_IMPLEMENT_MACRO(y0) -TVMET_IMPLEMENT_MACRO(y1) -TVMET_IMPLEMENT_MACRO(lgamma) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(TVMET_HAVE_IEEE_MATH) - - -/** \class Fcnl_abs UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_abs UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_abs UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_abs UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_abs UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -#define TVMET_IMPLEMENT_MACRO(NAME, POD) \ -template struct Fcnl_##NAME; \ -template <> \ -struct Fcnl_##NAME< POD > : public UnaryFunctional { \ - typedef POD value_type; \ - \ - static inline \ - value_type apply_on(value_type rhs) { \ - return TVMET_STD_SCOPE(NAME)(rhs); \ - } \ - \ - static \ - void print_xpr(std::ostream& os, int l=0) { \ - os << IndentLevel(l) << "Fcnl_" << #NAME << "," \ - << std::endl; \ - } \ -}; - -TVMET_IMPLEMENT_MACRO(labs, long int) - -#if defined(TVMET_HAVE_LONG_LONG) -TVMET_IMPLEMENT_MACRO(labs, long long int) -#endif - -TVMET_IMPLEMENT_MACRO(fabs, float) -TVMET_IMPLEMENT_MACRO(fabs, double) - -#if defined(TVMET_HAVE_LONG_DOUBLE) -TVMET_IMPLEMENT_MACRO(fabs, long double) -#endif - -#undef TVMET_IMPLEMENT_MACRO - - /* * complex support */ -#if defined(TVMET_HAVE_COMPLEX) -/** - * \class Fcnl_abs< std::complex > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" - */ -template -struct Fcnl_abs< std::complex > : public UnaryFunctional { - typedef T value_type; - - static inline - value_type apply_on(const std::complex& rhs) { - return std::abs(rhs); - } - - static - void print_xpr(std::ostream& os, int l=0) { - os << IndentLevel(l) << "Fcnl_abs).name() << ">," - << std::endl; - } -}; +#if defined(TVMET_HAVE_COMPLEX) /** * \class Fcnl_conj< std::complex > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" @@ -296,8 +84,6 @@ struct Fcnl_conj< std::complex > : public UnaryFunctional { /** \class Fcnl_real< std::complex > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ /** \class Fcnl_imag< std::complex > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_arg< std::complex > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_norm< std::complex > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ #define TVMET_IMPLEMENT_MACRO(NAME) \ template struct Fcnl_##NAME; \ template \ @@ -319,42 +105,11 @@ struct Fcnl_##NAME< std::complex > : public UnaryFunctional { \ TVMET_IMPLEMENT_MACRO(real) TVMET_IMPLEMENT_MACRO(imag) -TVMET_IMPLEMENT_MACRO(arg) -TVMET_IMPLEMENT_MACRO(norm) #undef TVMET_IMPLEMENT_MACRO #endif // defined(TVMET_HAVE_COMPLEX) - -/** \class Fcnl_isnan UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_isinf UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_finite UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -#define TVMET_IMPLEMENT_MACRO(NAME, POD) \ -template \ -struct Fcnl_##NAME : public UnaryFunctional { \ - typedef T value_type; \ - \ - static inline \ - POD apply_on(T rhs) { \ - return TVMET_GLOBAL_SCOPE(NAME)(rhs); \ - } \ - \ - static \ - void print_xpr(std::ostream& os, int l=0) { \ - os << IndentLevel(l) << "Fcnl_" << #NAME << "," \ - << std::endl; \ - } \ -}; - -TVMET_IMPLEMENT_MACRO(isnan, int) -TVMET_IMPLEMENT_MACRO(isinf, int) -TVMET_IMPLEMENT_MACRO(finite, int) - -#undef TVMET_IMPLEMENT_MACRO - - } // namespace tvmet #endif // TVMET_UNARY_FUNCTIONAL_H diff --git a/tvmet-1.7.1/include/tvmet/VectorOperators.h b/tvmet-1.7.1/include/tvmet/VectorOperators.h index 97b678117..04f421399 100644 --- a/tvmet-1.7.1/include/tvmet/VectorOperators.h +++ b/tvmet-1.7.1/include/tvmet/VectorOperators.h @@ -66,16 +66,6 @@ namespace element_wise { TVMET_DECLARE_MACRO(div_eq, /=) // not defined for vectors } -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_DECLARE_MACRO(mod_eq, %=) - TVMET_DECLARE_MACRO(xor_eq, ^=) - TVMET_DECLARE_MACRO(and_eq, &=) - TVMET_DECLARE_MACRO(or_eq, |=) - TVMET_DECLARE_MACRO(shl_eq, <<=) - TVMET_DECLARE_MACRO(shr_eq, >>=) -} - #undef TVMET_DECLARE_MACRO @@ -240,230 +230,6 @@ TVMET_DECLARE_MACRO(div, /) // per se element wise #endif // defined(TVMET_HAVE_COMPLEX) -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector integer and compare operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(Vector, Vector) - * operator(XprVector, Vector) - * operator(Vector, XprVector) - * Note: operations are per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, \ - VectorConstReference, \ - VectorConstReference \ - >, \ - Sz \ -> \ -operator OP (const Vector& lhs, \ - const Vector& rhs) TVMET_CXX_ALWAYS_INLINE; \ - \ -template \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprVector, \ - VectorConstReference \ - >, \ - Sz \ -> \ -operator OP (const XprVector& lhs, \ - const Vector& rhs) TVMET_CXX_ALWAYS_INLINE; \ - \ -template \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, \ - VectorConstReference, \ - XprVector \ - >, \ - Sz \ -> \ -operator OP (const Vector& lhs, \ - const XprVector& rhs) TVMET_CXX_ALWAYS_INLINE; - -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_DECLARE_MACRO(mod, %) - TVMET_DECLARE_MACRO(bitxor, ^) - TVMET_DECLARE_MACRO(bitand, &) - TVMET_DECLARE_MACRO(bitor, |) - TVMET_DECLARE_MACRO(shl, <<) - TVMET_DECLARE_MACRO(shr, >>) -} - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >) -TVMET_DECLARE_MACRO(less, <) -TVMET_DECLARE_MACRO(greater_eq, >=) -TVMET_DECLARE_MACRO(less_eq, <=) -TVMET_DECLARE_MACRO(eq, ==) -TVMET_DECLARE_MACRO(not_eq, !=) -TVMET_DECLARE_MACRO(and, &&) -TVMET_DECLARE_MACRO(or, ||) - -#undef TVMET_DECLARE_MACRO - - - -#if defined(TVMET_HAVE_COMPLEX) -/* - * operator(Vector, Sz>, std::complex) - * operator(std::complex, Vector, Sz>) - * Note: - per se element wise - * - bit ops on complex doesn't make sense, stay away - * \todo type promotion - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< std::complex, std::complex >, \ - VectorConstReference< std::complex, Sz>, \ - XprLiteral< std::complex > \ - >, \ - Sz \ -> \ -operator OP (const Vector, Sz>& lhs, \ - const std::complex& rhs) TVMET_CXX_ALWAYS_INLINE; \ - \ -template \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< std::complex, std::complex >, \ - XprLiteral< std::complex >, \ - VectorConstReference< std::complex, Sz> \ - >, \ - Sz \ -> \ -operator OP (const std::complex& lhs, \ - const Vector< std::complex, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE; - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >) -TVMET_DECLARE_MACRO(less, <) -TVMET_DECLARE_MACRO(greater_eq, >=) -TVMET_DECLARE_MACRO(less_eq, <=) -TVMET_DECLARE_MACRO(eq, ==) -TVMET_DECLARE_MACRO(not_eq, !=) -TVMET_DECLARE_MACRO(and, &&) -TVMET_DECLARE_MACRO(or, ||) - -#undef TVMET_DECLARE_MACRO - -#endif // defined(TVMET_HAVE_COMPLEX) - - -/* - * operator(Vector, POD) - * operator(POD, Vector) - * Note: operations are per se element_wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP, TP) \ -template \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< T, TP >, \ - VectorConstReference, \ - XprLiteral< TP > \ - >, \ - Sz \ -> \ -operator OP (const Vector& lhs, TP rhs) TVMET_CXX_ALWAYS_INLINE; \ - \ -template \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< TP, T>, \ - XprLiteral< TP >, \ - VectorConstReference \ - >, \ - Sz \ -> \ -operator OP (TP lhs, const Vector& rhs) TVMET_CXX_ALWAYS_INLINE; - -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_DECLARE_MACRO(mod, %, int) - TVMET_DECLARE_MACRO(bitxor, ^, int) - TVMET_DECLARE_MACRO(bitand, &, int) - TVMET_DECLARE_MACRO(bitor, |, int) - TVMET_DECLARE_MACRO(shl, <<, int) - TVMET_DECLARE_MACRO(shr, >>, int) -} - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, int) -TVMET_DECLARE_MACRO(less, <, int) -TVMET_DECLARE_MACRO(greater_eq, >=, int) -TVMET_DECLARE_MACRO(less_eq, <=, int) -TVMET_DECLARE_MACRO(eq, ==, int) -TVMET_DECLARE_MACRO(not_eq, !=, int) -TVMET_DECLARE_MACRO(and, &&, int) -TVMET_DECLARE_MACRO(or, ||, int) - -#if defined(TVMET_HAVE_LONG_LONG) -// integer operators only -namespace element_wise { - TVMET_DECLARE_MACRO(mod, %, long long int) - TVMET_DECLARE_MACRO(bitxor, ^, long long int) - TVMET_DECLARE_MACRO(bitand, &, long long int) - TVMET_DECLARE_MACRO(bitor, |, long long int) - TVMET_DECLARE_MACRO(shl, <<, long long int) - TVMET_DECLARE_MACRO(shr, >>, long long int) -} - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, long long int) -TVMET_DECLARE_MACRO(less, <, long long int) -TVMET_DECLARE_MACRO(greater_eq, >=, long long int) -TVMET_DECLARE_MACRO(less_eq, <=, long long int) -TVMET_DECLARE_MACRO(eq, ==, long long int) -TVMET_DECLARE_MACRO(not_eq, !=, long long int) -TVMET_DECLARE_MACRO(and, &&, long long int) -TVMET_DECLARE_MACRO(or, ||, long long int) -#endif // defined(TVMET_HAVE_LONG_LONG) - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, float) -TVMET_DECLARE_MACRO(less, <, float) -TVMET_DECLARE_MACRO(greater_eq, >=, float) -TVMET_DECLARE_MACRO(less_eq, <=, float) -TVMET_DECLARE_MACRO(eq, ==, float) -TVMET_DECLARE_MACRO(not_eq, !=, float) -TVMET_DECLARE_MACRO(and, &&, float) -TVMET_DECLARE_MACRO(or, ||, float) - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, double) -TVMET_DECLARE_MACRO(less, <, double) -TVMET_DECLARE_MACRO(greater_eq, >=, double) -TVMET_DECLARE_MACRO(less_eq, <=, double) -TVMET_DECLARE_MACRO(eq, ==, double) -TVMET_DECLARE_MACRO(not_eq, !=, double) -TVMET_DECLARE_MACRO(and, &&, double) -TVMET_DECLARE_MACRO(or, ||, double) - -#if defined(TVMET_HAVE_LONG_DOUBLE) -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, long double) -TVMET_DECLARE_MACRO(less, <, long double) -TVMET_DECLARE_MACRO(greater_eq, >=, long double) -TVMET_DECLARE_MACRO(less_eq, <=, long double) -TVMET_DECLARE_MACRO(eq, ==, long double) -TVMET_DECLARE_MACRO(not_eq, !=, long double) -TVMET_DECLARE_MACRO(and, &&, long double) -TVMET_DECLARE_MACRO(or, ||, long double) -#endif // defined(TVMET_HAVE_LONG_DOUBLE) - -#undef TVMET_DECLARE_MACRO - /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * global unary operators @@ -485,8 +251,6 @@ XprVector< \ > \ operator OP (const Vector& rhs) TVMET_CXX_ALWAYS_INLINE; -TVMET_DECLARE_MACRO(not, !) -TVMET_DECLARE_MACRO(compl, ~) TVMET_DECLARE_MACRO(neg, -) #undef TVMET_DECLARE_MACRO @@ -538,16 +302,6 @@ namespace element_wise { TVMET_IMPLEMENT_MACRO(div_eq, /=) // not defined for vectors } -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod_eq, %=) - TVMET_IMPLEMENT_MACRO(xor_eq, ^=) - TVMET_IMPLEMENT_MACRO(and_eq, &=) - TVMET_IMPLEMENT_MACRO(or_eq, |=) - TVMET_IMPLEMENT_MACRO(shl_eq, <<=) - TVMET_IMPLEMENT_MACRO(shr_eq, >>=) -} - #undef TVMET_IMPLEMENT_MACRO @@ -729,288 +483,6 @@ TVMET_IMPLEMENT_MACRO(div, /) // per se element wise #endif // defined(TVMET_HAVE_COMPLEX) -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector integer and compare operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(Vector, Vector) - * operator(XprVector, Vector) - * operator(Vector, XprVector) - * Note: operations are per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, \ - VectorConstReference, \ - VectorConstReference \ - >, \ - Sz \ -> \ -operator OP (const Vector& lhs, const Vector& rhs) { \ - typedef XprBinOp < \ - Fcnl_##NAME, \ - VectorConstReference, \ - VectorConstReference \ - > expr_type; \ - return XprVector( \ - expr_type(lhs.const_ref(), rhs.const_ref())); \ -} \ - \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprVector, \ - VectorConstReference \ - >, \ - Sz \ -> \ -operator OP (const XprVector& lhs, const Vector& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME, \ - XprVector, \ - VectorConstReference \ - > expr_type; \ - return XprVector( \ - expr_type(lhs, rhs.const_ref())); \ -} \ - \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, \ - VectorConstReference, \ - XprVector \ - >, \ - Sz \ -> \ -operator OP (const Vector& lhs, const XprVector& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME, \ - VectorConstReference, \ - XprVector \ - > expr_type; \ - return XprVector( \ - expr_type(lhs.const_ref(), rhs)); \ -} - -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod, %) - TVMET_IMPLEMENT_MACRO(bitxor, ^) - TVMET_IMPLEMENT_MACRO(bitand, &) - TVMET_IMPLEMENT_MACRO(bitor, |) - TVMET_IMPLEMENT_MACRO(shl, <<) - TVMET_IMPLEMENT_MACRO(shr, >>) -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >) -TVMET_IMPLEMENT_MACRO(less, <) -TVMET_IMPLEMENT_MACRO(greater_eq, >=) -TVMET_IMPLEMENT_MACRO(less_eq, <=) -TVMET_IMPLEMENT_MACRO(eq, ==) -TVMET_IMPLEMENT_MACRO(not_eq, !=) -TVMET_IMPLEMENT_MACRO(and, &&) -TVMET_IMPLEMENT_MACRO(or, ||) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(TVMET_HAVE_COMPLEX) -/* - * operator(Vector, Sz>, std::complex) - * operator(std::complex, Vector, Sz>) - * Note: - per se element wise - * - bit ops on complex doesn't make sense, stay away - * \todo type promotion - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< std::complex, std::complex >, \ - VectorConstReference< std::complex, Sz>, \ - XprLiteral< std::complex > \ - >, \ - Sz \ -> \ -operator OP (const Vector, Sz>& lhs, const std::complex& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< std::complex, std::complex >, \ - VectorConstReference< std::complex, Sz>, \ - XprLiteral< std::complex > \ - > expr_type; \ - return XprVector( \ - expr_type(lhs.const_ref(), XprLiteral< std::complex >(rhs))); \ -} \ - \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< std::complex, std::complex >, \ - XprLiteral< std::complex >, \ - VectorConstReference< std::complex, Sz> \ - >, \ - Sz \ -> \ -operator OP (const std::complex& lhs, const Vector< std::complex, Sz>& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< std::complex, std::complex >, \ - XprLiteral< std::complex >, \ - VectorConstReference< std::complex, Sz> \ - > expr_type; \ - return XprVector( \ - expr_type(XprLiteral< std::complex >(lhs), rhs.const_ref())); \ -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >) -TVMET_IMPLEMENT_MACRO(less, <) -TVMET_IMPLEMENT_MACRO(greater_eq, >=) -TVMET_IMPLEMENT_MACRO(less_eq, <=) -TVMET_IMPLEMENT_MACRO(eq, ==) -TVMET_IMPLEMENT_MACRO(not_eq, !=) -TVMET_IMPLEMENT_MACRO(and, &&) -TVMET_IMPLEMENT_MACRO(or, ||) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(TVMET_HAVE_COMPLEX) - - -/* - * operator(Vector, POD) - * operator(POD, Vector) - * Note: operations are per se element_wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP, TP) \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< T, TP >, \ - VectorConstReference, \ - XprLiteral< TP > \ - >, \ - Sz \ -> \ -operator OP (const Vector& lhs, TP rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME, \ - VectorConstReference, \ - XprLiteral< TP > \ - > expr_type; \ - return XprVector( \ - expr_type(lhs.const_ref(), XprLiteral< TP >(rhs))); \ -} \ - \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< TP, T>, \ - XprLiteral< TP >, \ - VectorConstReference \ - >, \ - Sz \ -> \ -operator OP (TP lhs, const Vector& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< TP, T>, \ - XprLiteral< TP >, \ - VectorConstReference \ - > expr_type; \ - return XprVector( \ - expr_type(XprLiteral< TP >(lhs), rhs.const_ref())); \ -} - -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod, %, int) - TVMET_IMPLEMENT_MACRO(bitxor, ^, int) - TVMET_IMPLEMENT_MACRO(bitand, &, int) - TVMET_IMPLEMENT_MACRO(bitor, |, int) - TVMET_IMPLEMENT_MACRO(shl, <<, int) - TVMET_IMPLEMENT_MACRO(shr, >>, int) -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, int) -TVMET_IMPLEMENT_MACRO(less, <, int) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, int) -TVMET_IMPLEMENT_MACRO(less_eq, <=, int) -TVMET_IMPLEMENT_MACRO(eq, ==, int) -TVMET_IMPLEMENT_MACRO(not_eq, !=, int) -TVMET_IMPLEMENT_MACRO(and, &&, int) -TVMET_IMPLEMENT_MACRO(or, ||, int) - -#if defined(TVMET_HAVE_LONG_LONG) -// integer operators only -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod, %, long long int) - TVMET_IMPLEMENT_MACRO(bitxor, ^, long long int) - TVMET_IMPLEMENT_MACRO(bitand, &, long long int) - TVMET_IMPLEMENT_MACRO(bitor, |, long long int) - TVMET_IMPLEMENT_MACRO(shl, <<, long long int) - TVMET_IMPLEMENT_MACRO(shr, >>, long long int) -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, long long int) -TVMET_IMPLEMENT_MACRO(less, <, long long int) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, long long int) -TVMET_IMPLEMENT_MACRO(less_eq, <=, long long int) -TVMET_IMPLEMENT_MACRO(eq, ==, long long int) -TVMET_IMPLEMENT_MACRO(not_eq, !=, long long int) -TVMET_IMPLEMENT_MACRO(and, &&, long long int) -TVMET_IMPLEMENT_MACRO(or, ||, long long int) -#endif // defined(TVMET_HAVE_LONG_LONG) - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, float) -TVMET_IMPLEMENT_MACRO(less, <, float) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, float) -TVMET_IMPLEMENT_MACRO(less_eq, <=, float) -TVMET_IMPLEMENT_MACRO(eq, ==, float) -TVMET_IMPLEMENT_MACRO(not_eq, !=, float) -TVMET_IMPLEMENT_MACRO(and, &&, float) -TVMET_IMPLEMENT_MACRO(or, ||, float) - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, double) -TVMET_IMPLEMENT_MACRO(less, <, double) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, double) -TVMET_IMPLEMENT_MACRO(less_eq, <=, double) -TVMET_IMPLEMENT_MACRO(eq, ==, double) -TVMET_IMPLEMENT_MACRO(not_eq, !=, double) -TVMET_IMPLEMENT_MACRO(and, &&, double) -TVMET_IMPLEMENT_MACRO(or, ||, double) - -#if defined(TVMET_HAVE_LONG_DOUBLE) -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, long double) -TVMET_IMPLEMENT_MACRO(less, <, long double) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, long double) -TVMET_IMPLEMENT_MACRO(less_eq, <=, long double) -TVMET_IMPLEMENT_MACRO(eq, ==, long double) -TVMET_IMPLEMENT_MACRO(not_eq, !=, long double) -TVMET_IMPLEMENT_MACRO(and, &&, long double) -TVMET_IMPLEMENT_MACRO(or, ||, long double) -#endif // defined(TVMET_HAVE_LONG_DOUBLE) - -#undef TVMET_IMPLEMENT_MACRO - - /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * global unary operators *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ @@ -1038,8 +510,6 @@ operator OP (const Vector& rhs) { \ return XprVector(expr_type(rhs.const_ref())); \ } -TVMET_IMPLEMENT_MACRO(not, !) -TVMET_IMPLEMENT_MACRO(compl, ~) TVMET_IMPLEMENT_MACRO(neg, -) #undef TVMET_IMPLEMENT_MACRO diff --git a/tvmet-1.7.1/include/tvmet/VectorUnaryFunctions.h b/tvmet-1.7.1/include/tvmet/VectorUnaryFunctions.h index 7c01cbf21..6cb7bdddf 100644 --- a/tvmet-1.7.1/include/tvmet/VectorUnaryFunctions.h +++ b/tvmet-1.7.1/include/tvmet/VectorUnaryFunctions.h @@ -31,65 +31,6 @@ namespace tvmet { * PART I: DECLARATION *********************************************************/ -/* - * unary_function(Vector) - */ -#define TVMET_DECLARE_MACRO(NAME) \ -template \ -XprVector< \ - XprUnOp< \ - Fcnl_##NAME, \ - VectorConstReference \ - >, \ - Sz \ -> \ -NAME(const Vector& rhs) TVMET_CXX_ALWAYS_INLINE; - -TVMET_DECLARE_MACRO(abs) -TVMET_DECLARE_MACRO(cbrt) -TVMET_DECLARE_MACRO(ceil) -TVMET_DECLARE_MACRO(floor) -TVMET_DECLARE_MACRO(rint) -TVMET_DECLARE_MACRO(sin) -TVMET_DECLARE_MACRO(cos) -TVMET_DECLARE_MACRO(tan) -TVMET_DECLARE_MACRO(sinh) -TVMET_DECLARE_MACRO(cosh) -TVMET_DECLARE_MACRO(tanh) -TVMET_DECLARE_MACRO(asin) -TVMET_DECLARE_MACRO(acos) -TVMET_DECLARE_MACRO(atan) -TVMET_DECLARE_MACRO(exp) -TVMET_DECLARE_MACRO(log) -TVMET_DECLARE_MACRO(log10) -TVMET_DECLARE_MACRO(sqrt) - -#if defined(TVMET_HAVE_IEEE_MATH) -TVMET_DECLARE_MACRO(asinh) -TVMET_DECLARE_MACRO(acosh) -TVMET_DECLARE_MACRO(atanh) -TVMET_DECLARE_MACRO(expm1) -TVMET_DECLARE_MACRO(log1p) -TVMET_DECLARE_MACRO(erf) -TVMET_DECLARE_MACRO(erfc) -TVMET_DECLARE_MACRO(j0) -TVMET_DECLARE_MACRO(j1) -TVMET_DECLARE_MACRO(y0) -TVMET_DECLARE_MACRO(y1) -TVMET_DECLARE_MACRO(lgamma) -/** \todo isnan etc. - default return is only an int! */ -#if !defined(TVMET_NO_IEEE_MATH_ISNAN) -TVMET_DECLARE_MACRO(isnan) -#endif -#if !defined(TVMET_NO_IEEE_MATH_ISINF) -TVMET_DECLARE_MACRO(isinf) -#endif -TVMET_DECLARE_MACRO(finite) -#endif // defined(TVMET_HAVE_IEEE_MATH) - -#undef TVMET_DECLARE_MACRO - - /* * unary_function(Vector, Sz>) */ @@ -107,8 +48,6 @@ NAME(const Vector, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE; TVMET_DECLARE_MACRO(real) TVMET_DECLARE_MACRO(imag) -TVMET_DECLARE_MACRO(arg) -TVMET_DECLARE_MACRO(norm) TVMET_DECLARE_MACRO(conj) #undef TVMET_DECLARE_MACRO @@ -121,72 +60,6 @@ TVMET_DECLARE_MACRO(conj) *********************************************************/ -/* - * unary_function(Vector) - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template \ -inline \ -XprVector< \ - XprUnOp< \ - Fcnl_##NAME, \ - VectorConstReference \ - >, \ - Sz \ -> \ -NAME(const Vector& rhs) { \ - typedef XprUnOp< \ - Fcnl_##NAME, \ - VectorConstReference \ - > expr_type; \ - return XprVector(expr_type(rhs.const_ref())); \ -} - -TVMET_IMPLEMENT_MACRO(abs) -TVMET_IMPLEMENT_MACRO(cbrt) -TVMET_IMPLEMENT_MACRO(ceil) -TVMET_IMPLEMENT_MACRO(floor) -TVMET_IMPLEMENT_MACRO(rint) -TVMET_IMPLEMENT_MACRO(sin) -TVMET_IMPLEMENT_MACRO(cos) -TVMET_IMPLEMENT_MACRO(tan) -TVMET_IMPLEMENT_MACRO(sinh) -TVMET_IMPLEMENT_MACRO(cosh) -TVMET_IMPLEMENT_MACRO(tanh) -TVMET_IMPLEMENT_MACRO(asin) -TVMET_IMPLEMENT_MACRO(acos) -TVMET_IMPLEMENT_MACRO(atan) -TVMET_IMPLEMENT_MACRO(exp) -TVMET_IMPLEMENT_MACRO(log) -TVMET_IMPLEMENT_MACRO(log10) -TVMET_IMPLEMENT_MACRO(sqrt) - -#if defined(TVMET_HAVE_IEEE_MATH) -TVMET_IMPLEMENT_MACRO(asinh) -TVMET_IMPLEMENT_MACRO(acosh) -TVMET_IMPLEMENT_MACRO(atanh) -TVMET_IMPLEMENT_MACRO(expm1) -TVMET_IMPLEMENT_MACRO(log1p) -TVMET_IMPLEMENT_MACRO(erf) -TVMET_IMPLEMENT_MACRO(erfc) -TVMET_IMPLEMENT_MACRO(j0) -TVMET_IMPLEMENT_MACRO(j1) -TVMET_IMPLEMENT_MACRO(y0) -TVMET_IMPLEMENT_MACRO(y1) -TVMET_IMPLEMENT_MACRO(lgamma) -/** \todo isnan etc. - default return is only an int! */ -#if !defined(TVMET_NO_IEEE_MATH_ISNAN) -TVMET_IMPLEMENT_MACRO(isnan) -#endif -#if !defined(TVMET_NO_IEEE_MATH_ISINF) -TVMET_IMPLEMENT_MACRO(isinf) -#endif -TVMET_IMPLEMENT_MACRO(finite) -#endif // defined(TVMET_HAVE_IEEE_MATH) - -#undef TVMET_IMPLEMENT_MACRO - - /* * unary_function(Vector, Sz>) */ @@ -211,8 +84,6 @@ NAME(const Vector, Sz>& rhs) { \ TVMET_IMPLEMENT_MACRO(real) TVMET_IMPLEMENT_MACRO(imag) -TVMET_IMPLEMENT_MACRO(arg) -TVMET_IMPLEMENT_MACRO(norm) TVMET_IMPLEMENT_MACRO(conj) #undef TVMET_IMPLEMENT_MACRO diff --git a/tvmet-1.7.1/include/tvmet/tvmet.h b/tvmet-1.7.1/include/tvmet/tvmet.h index abf7a7a0e..17b845eb4 100644 --- a/tvmet-1.7.1/include/tvmet/tvmet.h +++ b/tvmet-1.7.1/include/tvmet/tvmet.h @@ -27,29 +27,6 @@ #include -/*********************************************************************** - * Compiler specifics - ***********************************************************************/ -#if defined(__GNUC__) -# include -#endif - -#if defined(__ICC) -# include -#endif - -#if defined(__KCC) -# include -#endif - -#if defined(__PGI) -# include -#endif - -// vc7.1: 1310 and vc7.0 1300 -#if defined(_MSC_VER) && (_MSC_VER >= 1310) -# include -#endif /* * other compiler specific stuff diff --git a/tvmet-1.7.1/include/tvmet/xpr/MMProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MMProduct.h index 3b0df5f93..7fe4f746a 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/MMProduct.h +++ b/tvmet-1.7.1/include/tvmet/xpr/MMProduct.h @@ -24,6 +24,8 @@ #ifndef TVMET_XPR_MMPRODUCT_H #define TVMET_XPR_MMPRODUCT_H +#include + #include #include @@ -98,7 +100,7 @@ private: public: /** index operator for arrays/matrices */ value_type operator()(int i, int j) const { - TVMET_RT_CONDITION((i < Rows1) && (j < Cols2), "XprMMProduct Bounce Violation") + assert((i < Rows1) && (j < Cols2)); return do_gemm(dispatch(), m_lhs, m_rhs, i, j); } diff --git a/tvmet-1.7.1/include/tvmet/xpr/MMProductTransposed.h b/tvmet-1.7.1/include/tvmet/xpr/MMProductTransposed.h index df5d04971..d8fb735b1 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/MMProductTransposed.h +++ b/tvmet-1.7.1/include/tvmet/xpr/MMProductTransposed.h @@ -24,6 +24,8 @@ #ifndef TVMET_XPR_MMPRODUCT_TRANSPOSED_H #define TVMET_XPR_MMPRODUCT_TRANSPOSED_H +#include + #include #include @@ -98,7 +100,7 @@ private: public: /** index operator for arrays/matrices */ value_type operator()(int i, int j) const { - TVMET_RT_CONDITION((i < Cols2) && (j < Rows1), "XprMMProductTransposed Bounce Violation") + assert((i < Cols2) && (j < Rows1)); return do_gemm(dispatch(), m_lhs, m_rhs, j, i); } diff --git a/tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h index 528eff78c..1cc7bd9cf 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h +++ b/tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h @@ -24,6 +24,8 @@ #ifndef TVMET_XPR_MMTPRODUCT_H #define TVMET_XPR_MMTPRODUCT_H +#include + #include #include @@ -100,7 +102,7 @@ private: public: /** index operator for arrays/matrices */ value_type operator()(int i, int j) const { - TVMET_RT_CONDITION((i < Rows1) && (j < Rows2), "XprMMtProduct Bounce Violation") + assert((i < Rows1) && (j < Rows2)); return do_gemmt(dispatch(), m_lhs, m_rhs, i, j); } diff --git a/tvmet-1.7.1/include/tvmet/xpr/MVProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MVProduct.h index 878e65a89..751431656 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/MVProduct.h +++ b/tvmet-1.7.1/include/tvmet/xpr/MVProduct.h @@ -24,6 +24,8 @@ #ifndef TVMET_XPR_MVPRODUCT_H #define TVMET_XPR_MVPRODUCT_H +#include + #include #include @@ -96,7 +98,7 @@ public: /** index operator, returns the expression by index. This is the vector style since a matrix*vector gives a vector. */ value_type operator()(int j) const { - TVMET_RT_CONDITION(j < Rows , "XprMVProduct Bounce Violation") + assert(j < Rows); return do_gemv(dispatch(), m_lhs, m_rhs, j); } diff --git a/tvmet-1.7.1/include/tvmet/xpr/Matrix.h b/tvmet-1.7.1/include/tvmet/xpr/Matrix.h index c31189c3d..08b7bad85 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/Matrix.h +++ b/tvmet-1.7.1/include/tvmet/xpr/Matrix.h @@ -24,6 +24,8 @@ #ifndef TVMET_XPR_MATRIX_H #define TVMET_XPR_MATRIX_H +#include + #include #include @@ -87,7 +89,7 @@ public: /** access by index. */ value_type operator()(int i, int j) const { - TVMET_RT_CONDITION((i < Rows) && (j < Cols), "XprMatrix Bounce Violation") + assert((i < Rows) && (j < Cols)); return m_expr(i, j); } @@ -153,7 +155,6 @@ private: #include #include -#include #include #include diff --git a/tvmet-1.7.1/include/tvmet/xpr/MatrixCol.h b/tvmet-1.7.1/include/tvmet/xpr/MatrixCol.h index 01153a2de..47e2554b8 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/MatrixCol.h +++ b/tvmet-1.7.1/include/tvmet/xpr/MatrixCol.h @@ -21,6 +21,8 @@ * $Id: MatrixCol.h,v 1.15 2004/09/16 09:14:18 opetzold Exp $ */ +#include + #ifndef TVMET_XPR_MATRIX_COL_H #define TVMET_XPR_MATRIX_COL_H @@ -53,7 +55,7 @@ public: explicit XprMatrixCol(const E& e, int no) : m_expr(e), m_col(no) { - TVMET_RT_CONDITION(no < Cols, "XprMatrixCol Bounce Violation") + assert(no < Cols); } /** Copy Constructor. Not explicit! */ @@ -64,7 +66,7 @@ public: #endif value_type operator()(int i) const { - TVMET_RT_CONDITION(i < Rows, "XprMatrixCol Bounce Violation") + assert(i < Rows); return m_expr(i, m_col); } diff --git a/tvmet-1.7.1/include/tvmet/xpr/MatrixDiag.h b/tvmet-1.7.1/include/tvmet/xpr/MatrixDiag.h index 106478613..4a8a080ac 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/MatrixDiag.h +++ b/tvmet-1.7.1/include/tvmet/xpr/MatrixDiag.h @@ -21,6 +21,8 @@ * $Id: MatrixDiag.h,v 1.13 2004/09/16 09:14:18 opetzold Exp $ */ +#include + #ifndef TVMET_XPR_MATRIX_DIAG_H #define TVMET_XPR_MATRIX_DIAG_H @@ -63,7 +65,7 @@ public: /** index operator for arrays/matrizes */ value_type operator()(int i) const { - TVMET_RT_CONDITION(i < Sz, "XprMatrixDiag Bounce Violation") + assert(i < Sz); return m_expr(i, i); } diff --git a/tvmet-1.7.1/include/tvmet/xpr/MatrixOperators.h b/tvmet-1.7.1/include/tvmet/xpr/MatrixOperators.h index 5576860e9..8dbe2670d 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/MatrixOperators.h +++ b/tvmet-1.7.1/include/tvmet/xpr/MatrixOperators.h @@ -220,206 +220,6 @@ operator*(const XprMatrix& lhs, const XprVector& rhs) TVMET_CXX_ALWAYS_INLINE; -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Matrix integer and compare operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(XprMatrix<>, XprMatrix<>) - * Note: operations are per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprMatrix, \ - XprMatrix \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix& lhs, \ - const XprMatrix& rhs) TVMET_CXX_ALWAYS_INLINE; - -// integer operators only, e.g used on double you will get an error -namespace element_wise { - TVMET_DECLARE_MACRO(mod, %) - TVMET_DECLARE_MACRO(bitxor, ^) - TVMET_DECLARE_MACRO(bitand, &) - TVMET_DECLARE_MACRO(bitor, |) - TVMET_DECLARE_MACRO(shl, <<) - TVMET_DECLARE_MACRO(shr, >>) -} - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >) -TVMET_DECLARE_MACRO(less, <) -TVMET_DECLARE_MACRO(greater_eq, >=) -TVMET_DECLARE_MACRO(less_eq, <=) -TVMET_DECLARE_MACRO(eq, ==) -TVMET_DECLARE_MACRO(not_eq, !=) -TVMET_DECLARE_MACRO(and, &&) -TVMET_DECLARE_MACRO(or, ||) - -#undef TVMET_DECLARE_MACRO - - -#if defined(TVMET_HAVE_COMPLEX) -/* - * operator(XprMatrix, std::complex<>) - * operator(std::complex<>, XprMatrix) - * Note: - per se element wise - * - bit ops on complex doesn't make sense, stay away - * \todo type promotion - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME >, \ - XprMatrix, \ - XprLiteral< std::complex > \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix& lhs, \ - const std::complex& rhs) TVMET_CXX_ALWAYS_INLINE; \ - \ -template \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, typename E::value_type>, \ - XprLiteral< std::complex >, \ - XprMatrix \ - >, \ - Rows, Cols \ -> \ -operator OP (const std::complex& lhs, \ - const XprMatrix& rhs) TVMET_CXX_ALWAYS_INLINE; - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >) -TVMET_DECLARE_MACRO(less, <) -TVMET_DECLARE_MACRO(greater_eq, >=) -TVMET_DECLARE_MACRO(less_eq, <=) -TVMET_DECLARE_MACRO(eq, ==) -TVMET_DECLARE_MACRO(not_eq, !=) -TVMET_DECLARE_MACRO(and, &&) -TVMET_DECLARE_MACRO(or, ||) - -#undef TVMET_DECLARE_MACRO - -#endif // defined(TVMET_HAVE_COMPLEX) - - -/* - * operator(XprMatrix, POD) - * operator(POD, XprMatrix) - * Note: operations are per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP, TP) \ -template \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprMatrix, \ - XprLiteral< TP > \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix& lhs, \ - TP rhs) TVMET_CXX_ALWAYS_INLINE; \ - \ -template \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprLiteral< TP >, \ - XprMatrix \ - >, \ - Rows, Cols \ -> \ -operator OP (TP lhs, \ - const XprMatrix& rhs) TVMET_CXX_ALWAYS_INLINE; - -// integer operators only, e.g used on double you will get an error -namespace element_wise { - TVMET_DECLARE_MACRO(mod, %, int) - TVMET_DECLARE_MACRO(bitxor, ^, int) - TVMET_DECLARE_MACRO(bitand, &, int) - TVMET_DECLARE_MACRO(bitor, |, int) - TVMET_DECLARE_MACRO(shl, <<, int) - TVMET_DECLARE_MACRO(shr, >>, int) -} - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, int) -TVMET_DECLARE_MACRO(less, <, int) -TVMET_DECLARE_MACRO(greater_eq, >=, int) -TVMET_DECLARE_MACRO(less_eq, <=, int) -TVMET_DECLARE_MACRO(eq, ==, int) -TVMET_DECLARE_MACRO(not_eq, !=, int) -TVMET_DECLARE_MACRO(and, &&, int) -TVMET_DECLARE_MACRO(or, ||, int) - -#if defined(TVMET_HAVE_LONG_LONG) -// integer operators only -namespace element_wise { - TVMET_DECLARE_MACRO(mod, %, long long int) - TVMET_DECLARE_MACRO(bitxor, ^, long long int) - TVMET_DECLARE_MACRO(bitand, &, long long int) - TVMET_DECLARE_MACRO(bitor, |, long long int) - TVMET_DECLARE_MACRO(shl, <<, long long int) - TVMET_DECLARE_MACRO(shr, >>, long long int) -} - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, long long int) -TVMET_DECLARE_MACRO(less, <, long long int) -TVMET_DECLARE_MACRO(greater_eq, >=, long long int) -TVMET_DECLARE_MACRO(less_eq, <=, long long int) -TVMET_DECLARE_MACRO(eq, ==, long long int) -TVMET_DECLARE_MACRO(not_eq, !=, long long int) -TVMET_DECLARE_MACRO(and, &&, long long int) -TVMET_DECLARE_MACRO(or, ||, long long int) -#endif // defined(TVMET_HAVE_LONG_LONG) - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, float) -TVMET_DECLARE_MACRO(less, <, float) -TVMET_DECLARE_MACRO(greater_eq, >=, float) -TVMET_DECLARE_MACRO(less_eq, <=, float) -TVMET_DECLARE_MACRO(eq, ==, float) -TVMET_DECLARE_MACRO(not_eq, !=, float) -TVMET_DECLARE_MACRO(and, &&, float) -TVMET_DECLARE_MACRO(or, ||, float) - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, double) -TVMET_DECLARE_MACRO(less, <, double) -TVMET_DECLARE_MACRO(greater_eq, >=, double) -TVMET_DECLARE_MACRO(less_eq, <=, double) -TVMET_DECLARE_MACRO(eq, ==, double) -TVMET_DECLARE_MACRO(not_eq, !=, double) -TVMET_DECLARE_MACRO(and, &&, double) -TVMET_DECLARE_MACRO(or, ||, double) - -#if defined(TVMET_HAVE_LONG_DOUBLE) -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, long double) -TVMET_DECLARE_MACRO(less, <, long double) -TVMET_DECLARE_MACRO(greater_eq, >=, long double) -TVMET_DECLARE_MACRO(less_eq, <=, long double) -TVMET_DECLARE_MACRO(eq, ==, long double) -TVMET_DECLARE_MACRO(not_eq, !=, long double) -TVMET_DECLARE_MACRO(and, &&, long double) -TVMET_DECLARE_MACRO(or, ||, long double) -#endif // defined(TVMET_HAVE_LONG_DOUBLE) - -#undef TVMET_DECLARE_MACRO - /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * global unary operators @@ -441,8 +241,6 @@ XprMatrix< \ > \ operator OP (const XprMatrix& m) TVMET_CXX_ALWAYS_INLINE; -TVMET_DECLARE_MACRO(not, !) -TVMET_DECLARE_MACRO(compl, ~) TVMET_DECLARE_MACRO(neg, -) #undef TVMET_DECLARE_MACRO @@ -659,249 +457,6 @@ operator*(const XprMatrix& lhs, const XprVector& rhs) } -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Matrix integer and compare operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(XprMatrix<>, XprMatrix<>) - * Note: operations are per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprMatrix, \ - XprMatrix \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix& lhs, \ - const XprMatrix& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME, \ - XprMatrix, \ - XprMatrix \ - > expr_type; \ - return XprMatrix(expr_type(lhs, rhs)); \ -} - -// integer operators only, e.g used on double you will get an error -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod, %) - TVMET_IMPLEMENT_MACRO(bitxor, ^) - TVMET_IMPLEMENT_MACRO(bitand, &) - TVMET_IMPLEMENT_MACRO(bitor, |) - TVMET_IMPLEMENT_MACRO(shl, <<) - TVMET_IMPLEMENT_MACRO(shr, >>) -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >) -TVMET_IMPLEMENT_MACRO(less, <) -TVMET_IMPLEMENT_MACRO(greater_eq, >=) -TVMET_IMPLEMENT_MACRO(less_eq, <=) -TVMET_IMPLEMENT_MACRO(eq, ==) -TVMET_IMPLEMENT_MACRO(not_eq, !=) -TVMET_IMPLEMENT_MACRO(and, &&) -TVMET_IMPLEMENT_MACRO(or, ||) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(TVMET_HAVE_COMPLEX) -/* - * operator(XprMatrix, std::complex<>) - * operator(std::complex<>, XprMatrix) - * Note: - per se element wise - * - bit ops on complex doesn't make sense, stay away - * \todo type promotion - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME >, \ - XprMatrix, \ - XprLiteral< std::complex > \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix& lhs, \ - const std::complex& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME >, \ - XprMatrix, \ - XprLiteral< std::complex > \ - > expr_type; \ - return XprMatrix( \ - expr_type(lhs, XprLiteral< std::complex >(rhs))); \ -} \ - \ -template \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, typename E::value_type>, \ - XprLiteral< std::complex >, \ - XprMatrix \ - >, \ - Rows, Cols \ -> \ -operator OP (const std::complex& lhs, \ - const XprMatrix& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< std::complex, typename E::value_type>, \ - XprLiteral< std::complex >, \ - XprMatrix \ - > expr_type; \ - return XprMatrix( \ - expr_type(XprLiteral< std::complex >(lhs), rhs)); \ -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >) -TVMET_IMPLEMENT_MACRO(less, <) -TVMET_IMPLEMENT_MACRO(greater_eq, >=) -TVMET_IMPLEMENT_MACRO(less_eq, <=) -TVMET_IMPLEMENT_MACRO(eq, ==) -TVMET_IMPLEMENT_MACRO(not_eq, !=) -TVMET_IMPLEMENT_MACRO(and, &&) -TVMET_IMPLEMENT_MACRO(or, ||) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(TVMET_HAVE_COMPLEX) - - -/* - * operator(XprMatrix, POD) - * operator(POD, XprMatrix) - * Note: operations are per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP, TP) \ -template \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprMatrix, \ - XprLiteral< TP > \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix& lhs, TP rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME, \ - XprMatrix, \ - XprLiteral< TP > \ - > expr_type; \ - return XprMatrix( \ - expr_type(lhs, XprLiteral< TP >(rhs))); \ -} \ - \ -template \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprLiteral< TP >, \ - XprMatrix \ - >, \ - Rows, Cols \ -> \ -operator OP (TP lhs, const XprMatrix& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< TP, typename E::value_type>, \ - XprLiteral< TP >, \ - XprMatrix \ - > expr_type; \ - return XprMatrix( \ - expr_type(XprLiteral< TP >(lhs), rhs)); \ -} - - -// integer operators only, e.g used on double you will get an error -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod, %, int) - TVMET_IMPLEMENT_MACRO(bitxor, ^, int) - TVMET_IMPLEMENT_MACRO(bitand, &, int) - TVMET_IMPLEMENT_MACRO(bitor, |, int) - TVMET_IMPLEMENT_MACRO(shl, <<, int) - TVMET_IMPLEMENT_MACRO(shr, >>, int) -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, int) -TVMET_IMPLEMENT_MACRO(less, <, int) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, int) -TVMET_IMPLEMENT_MACRO(less_eq, <=, int) -TVMET_IMPLEMENT_MACRO(eq, ==, int) -TVMET_IMPLEMENT_MACRO(not_eq, !=, int) -TVMET_IMPLEMENT_MACRO(and, &&, int) -TVMET_IMPLEMENT_MACRO(or, ||, int) - -#if defined(TVMET_HAVE_LONG_LONG) -// integer operators only -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod, %, long long int) - TVMET_IMPLEMENT_MACRO(bitxor, ^, long long int) - TVMET_IMPLEMENT_MACRO(bitand, &, long long int) - TVMET_IMPLEMENT_MACRO(bitor, |, long long int) - TVMET_IMPLEMENT_MACRO(shl, <<, long long int) - TVMET_IMPLEMENT_MACRO(shr, >>, long long int) -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, long long int) -TVMET_IMPLEMENT_MACRO(less, <, long long int) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, long long int) -TVMET_IMPLEMENT_MACRO(less_eq, <=, long long int) -TVMET_IMPLEMENT_MACRO(eq, ==, long long int) -TVMET_IMPLEMENT_MACRO(not_eq, !=, long long int) -TVMET_IMPLEMENT_MACRO(and, &&, long long int) -TVMET_IMPLEMENT_MACRO(or, ||, long long int) -#endif // defined(TVMET_HAVE_LONG_LONG) - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, float) -TVMET_IMPLEMENT_MACRO(less, <, float) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, float) -TVMET_IMPLEMENT_MACRO(less_eq, <=, float) -TVMET_IMPLEMENT_MACRO(eq, ==, float) -TVMET_IMPLEMENT_MACRO(not_eq, !=, float) -TVMET_IMPLEMENT_MACRO(and, &&, float) -TVMET_IMPLEMENT_MACRO(or, ||, float) - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, double) -TVMET_IMPLEMENT_MACRO(less, <, double) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, double) -TVMET_IMPLEMENT_MACRO(less_eq, <=, double) -TVMET_IMPLEMENT_MACRO(eq, ==, double) -TVMET_IMPLEMENT_MACRO(not_eq, !=, double) -TVMET_IMPLEMENT_MACRO(and, &&, double) -TVMET_IMPLEMENT_MACRO(or, ||, double) - -#if defined(TVMET_HAVE_LONG_DOUBLE) -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, long double) -TVMET_IMPLEMENT_MACRO(less, <, long double) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, long double) -TVMET_IMPLEMENT_MACRO(less_eq, <=, long double) -TVMET_IMPLEMENT_MACRO(eq, ==, long double) -TVMET_IMPLEMENT_MACRO(not_eq, !=, long double) -TVMET_IMPLEMENT_MACRO(and, &&, long double) -TVMET_IMPLEMENT_MACRO(or, ||, long double) -#endif // defined(TVMET_HAVE_LONG_DOUBLE) - -#undef TVMET_IMPLEMENT_MACRO - /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * global unary operators @@ -930,8 +485,6 @@ operator OP (const XprMatrix& m) { \ return XprMatrix(expr_type(m)); \ } -TVMET_IMPLEMENT_MACRO(not, !) -TVMET_IMPLEMENT_MACRO(compl, ~) TVMET_IMPLEMENT_MACRO(neg, -) #undef TVMET_IMPLEMENT_MACRO diff --git a/tvmet-1.7.1/include/tvmet/xpr/MatrixRow.h b/tvmet-1.7.1/include/tvmet/xpr/MatrixRow.h index 8da0bbb0b..d8a796858 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/MatrixRow.h +++ b/tvmet-1.7.1/include/tvmet/xpr/MatrixRow.h @@ -21,6 +21,8 @@ * $Id: MatrixRow.h,v 1.14 2004/09/16 09:14:18 opetzold Exp $ */ +#include + #ifndef TVMET_XPR_MATRIX_ROW_H #define TVMET_XPR_MATRIX_ROW_H @@ -53,7 +55,7 @@ public: explicit XprMatrixRow(const E& e, int no) : m_expr(e), m_row(no) { - TVMET_RT_CONDITION(no < Rows, "XprMatrixRow Bounce Violation") + assert(no < Rows); } /** Copy Constructor. Not explicit! */ @@ -64,7 +66,7 @@ public: #endif value_type operator()(int j) const { - TVMET_RT_CONDITION(j < Cols, "XprMatrixRow Bounce Violation") + assert(j < Cols); return m_expr(m_row, j); } diff --git a/tvmet-1.7.1/include/tvmet/xpr/MatrixUnaryFunctions.h b/tvmet-1.7.1/include/tvmet/xpr/MatrixUnaryFunctions.h deleted file mode 100644 index 5a3a899ef..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MatrixUnaryFunctions.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Tiny Vector Matrix Library - * Dense Vector Matrix Libary of Tiny size using Expression Templates - * - * Copyright (C) 2001 - 2003 Olaf Petzold - * - * 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: MatrixUnaryFunctions.h,v 1.7 2004/06/10 16:36:55 opetzold Exp $ - */ - -#ifndef TVMET_XPR_MATRIX_UNARY_FUNCTIONS_H -#define TVMET_XPR_MATRIX_UNARY_FUNCTIONS_H - -namespace tvmet { - - -/********************************************************* - * PART I: DECLARATION - *********************************************************/ - - -/* - * unary_function(XprMatrix) - */ -#define TVMET_DECLARE_MACRO(NAME) \ -template \ -inline \ -XprMatrix< \ - XprUnOp< \ - Fcnl_##NAME, \ - XprMatrix \ - >, \ - Rows, Cols \ -> \ -NAME(const XprMatrix& rhs) TVMET_CXX_ALWAYS_INLINE; - -TVMET_DECLARE_MACRO(abs) -TVMET_DECLARE_MACRO(cbrt) -TVMET_DECLARE_MACRO(ceil) -TVMET_DECLARE_MACRO(floor) -TVMET_DECLARE_MACRO(rint) -TVMET_DECLARE_MACRO(sin) -TVMET_DECLARE_MACRO(cos) -TVMET_DECLARE_MACRO(tan) -TVMET_DECLARE_MACRO(sinh) -TVMET_DECLARE_MACRO(cosh) -TVMET_DECLARE_MACRO(tanh) -TVMET_DECLARE_MACRO(asin) -TVMET_DECLARE_MACRO(acos) -TVMET_DECLARE_MACRO(atan) -TVMET_DECLARE_MACRO(exp) -TVMET_DECLARE_MACRO(log) -TVMET_DECLARE_MACRO(log10) -TVMET_DECLARE_MACRO(sqrt) - -#if defined(TVMET_HAVE_IEEE_MATH) -TVMET_DECLARE_MACRO(asinh) -TVMET_DECLARE_MACRO(acosh) -TVMET_DECLARE_MACRO(atanh) -TVMET_DECLARE_MACRO(expm1) -TVMET_DECLARE_MACRO(log1p) -TVMET_DECLARE_MACRO(erf) -TVMET_DECLARE_MACRO(erfc) -TVMET_DECLARE_MACRO(j0) -TVMET_DECLARE_MACRO(j1) -TVMET_DECLARE_MACRO(y0) -TVMET_DECLARE_MACRO(y1) -TVMET_DECLARE_MACRO(lgamma) -/** \todo isnan etc. - default return is only an int! */ -#if !defined(TVMET_NO_IEEE_MATH_ISNAN) -TVMET_DECLARE_MACRO(isnan) -#endif -#if !defined(TVMET_NO_IEEE_MATH_ISINF) -TVMET_DECLARE_MACRO(isinf) -#endif -TVMET_DECLARE_MACRO(finite) -#endif // defined(TVMET_HAVE_IEEE_MATH) - -#undef TVMET_DECLARE_MACRO - - -/********************************************************* - * PART II: IMPLEMENTATION - *********************************************************/ - - -/* - * unary_function(XprMatrix) - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template \ -inline \ -XprMatrix< \ - XprUnOp< \ - Fcnl_##NAME, \ - XprMatrix \ - >, \ - Rows, Cols \ -> \ -NAME(const XprMatrix& rhs) { \ - typedef XprUnOp< \ - Fcnl_##NAME, \ - XprMatrix \ - > expr_type; \ - return XprMatrix(expr_type(rhs)); \ -} - -TVMET_IMPLEMENT_MACRO(abs) -TVMET_IMPLEMENT_MACRO(cbrt) -TVMET_IMPLEMENT_MACRO(ceil) -TVMET_IMPLEMENT_MACRO(floor) -TVMET_IMPLEMENT_MACRO(rint) -TVMET_IMPLEMENT_MACRO(sin) -TVMET_IMPLEMENT_MACRO(cos) -TVMET_IMPLEMENT_MACRO(tan) -TVMET_IMPLEMENT_MACRO(sinh) -TVMET_IMPLEMENT_MACRO(cosh) -TVMET_IMPLEMENT_MACRO(tanh) -TVMET_IMPLEMENT_MACRO(asin) -TVMET_IMPLEMENT_MACRO(acos) -TVMET_IMPLEMENT_MACRO(atan) -TVMET_IMPLEMENT_MACRO(exp) -TVMET_IMPLEMENT_MACRO(log) -TVMET_IMPLEMENT_MACRO(log10) -TVMET_IMPLEMENT_MACRO(sqrt) - -#if defined(TVMET_HAVE_IEEE_MATH) -TVMET_IMPLEMENT_MACRO(asinh) -TVMET_IMPLEMENT_MACRO(acosh) -TVMET_IMPLEMENT_MACRO(atanh) -TVMET_IMPLEMENT_MACRO(expm1) -TVMET_IMPLEMENT_MACRO(log1p) -TVMET_IMPLEMENT_MACRO(erf) -TVMET_IMPLEMENT_MACRO(erfc) -TVMET_IMPLEMENT_MACRO(j0) -TVMET_IMPLEMENT_MACRO(j1) -TVMET_IMPLEMENT_MACRO(y0) -TVMET_IMPLEMENT_MACRO(y1) -TVMET_IMPLEMENT_MACRO(lgamma) -/** \todo isnan etc. - default return is only an int! */ -#if !defined(TVMET_NO_IEEE_MATH_ISNAN) -TVMET_IMPLEMENT_MACRO(isnan) -#endif -#if !defined(TVMET_NO_IEEE_MATH_ISINF) -TVMET_IMPLEMENT_MACRO(isinf) -#endif -TVMET_IMPLEMENT_MACRO(finite) -#endif // defined(TVMET_HAVE_IEEE_MATH) - -#undef TVMET_IMPLEMENT_MACRO - - -} // namespace tvmet - -#endif // TVMET_XPR_MATRIX_UNARY_FUNCTIONS_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h index 733ec9817..f985ca7f7 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h +++ b/tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h @@ -24,6 +24,8 @@ #ifndef TVMET_XPR_MTMPRODUCT_H #define TVMET_XPR_MTMPRODUCT_H +#include + #include #include @@ -100,7 +102,7 @@ private: public: /** index operator for arrays/matrices */ value_type operator()(int i, int j) const { - TVMET_RT_CONDITION((i < Cols1) && (j < Cols2), "XprMtMProduct Bounce Violation") + assert((i < Cols1) && (j < Cols2)); return do_gemtm(dispatch(), m_lhs, m_rhs, i, j); } diff --git a/tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h index 2f592d8f3..3967dbe42 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h +++ b/tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h @@ -24,6 +24,8 @@ #ifndef TVMET_XPR_MTVPRODUCT_H #define TVMET_XPR_MTVPRODUCT_H +#include + #include #include @@ -95,7 +97,7 @@ public: /** index operator, returns the expression by index. This is the vector style since a matrix*vector gives a vector. */ value_type operator()(int j) const { - TVMET_RT_CONDITION(j < Cols , "XprMtVProduct Bounce Violation") + assert(j < Cols); return do_gemtv(dispatch(), m_lhs, m_rhs, j); } diff --git a/tvmet-1.7.1/include/tvmet/xpr/Vector.h b/tvmet-1.7.1/include/tvmet/xpr/Vector.h index 6416c648a..e2a798f85 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/Vector.h +++ b/tvmet-1.7.1/include/tvmet/xpr/Vector.h @@ -84,7 +84,7 @@ public: /** const index operator for vectors. */ value_type operator()(int i) const { - TVMET_RT_CONDITION(i < Size, "XprVector Bounce Violation") + assert(i < Size); return m_expr(i); } @@ -145,7 +145,6 @@ private: #include #include -#include #include #include diff --git a/tvmet-1.7.1/include/tvmet/xpr/VectorOperators.h b/tvmet-1.7.1/include/tvmet/xpr/VectorOperators.h index 673a1915c..ec4d2d89b 100644 --- a/tvmet-1.7.1/include/tvmet/xpr/VectorOperators.h +++ b/tvmet-1.7.1/include/tvmet/xpr/VectorOperators.h @@ -172,205 +172,6 @@ TVMET_DECLARE_MACRO(div, /) // per se element wise #endif // defined(TVMET_HAVE_COMPLEX) -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector integer and compare operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(XprVector, XprVector) - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprVector, \ - XprVector \ - >, \ - Sz \ -> \ -operator OP (const XprVector& lhs, \ - const XprVector& rhs) TVMET_CXX_ALWAYS_INLINE; - -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_DECLARE_MACRO(mod, %) - TVMET_DECLARE_MACRO(bitxor, ^) - TVMET_DECLARE_MACRO(bitand, &) - TVMET_DECLARE_MACRO(bitor, |) - TVMET_DECLARE_MACRO(shl, <<) - TVMET_DECLARE_MACRO(shr, >>) -} - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >) -TVMET_DECLARE_MACRO(less, <) -TVMET_DECLARE_MACRO(greater_eq, >=) -TVMET_DECLARE_MACRO(less_eq, <=) -TVMET_DECLARE_MACRO(eq, ==) -TVMET_DECLARE_MACRO(not_eq, !=) -TVMET_DECLARE_MACRO(and, &&) -TVMET_DECLARE_MACRO(or, ||) - -#undef TVMET_DECLARE_MACRO - - -/* - * operator(Vector, POD) - * operator(POD, Vector) - * Note: operations are per se element_wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP, TP) \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprVector, \ - XprLiteral< TP > \ - >, \ - Sz \ -> \ -operator OP (const XprVector& lhs, \ - TP rhs) TVMET_CXX_ALWAYS_INLINE; \ - \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprLiteral< TP >, \ - XprVector \ - >, \ - Sz \ -> \ -operator OP (TP lhs, \ - const XprVector& rhs) TVMET_CXX_ALWAYS_INLINE; - -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_DECLARE_MACRO(mod, %, int) - TVMET_DECLARE_MACRO(bitxor, ^, int) - TVMET_DECLARE_MACRO(bitand, &, int) - TVMET_DECLARE_MACRO(bitor, |, int) - TVMET_DECLARE_MACRO(shl, <<, int) - TVMET_DECLARE_MACRO(shr, >>, int) -} - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, int) -TVMET_DECLARE_MACRO(less, <, int) -TVMET_DECLARE_MACRO(greater_eq, >=, int) -TVMET_DECLARE_MACRO(less_eq, <=, int) -TVMET_DECLARE_MACRO(eq, ==, int) -TVMET_DECLARE_MACRO(not_eq, !=, int) -TVMET_DECLARE_MACRO(and, &&, int) -TVMET_DECLARE_MACRO(or, ||, int) - - -#if defined(TVMET_HAVE_LONG_LONG) -// integer operators only -namespace element_wise { - TVMET_DECLARE_MACRO(mod, %, long long int) - TVMET_DECLARE_MACRO(bitxor, ^, long long int) - TVMET_DECLARE_MACRO(bitand, &, long long int) - TVMET_DECLARE_MACRO(bitor, |, long long int) - TVMET_DECLARE_MACRO(shl, <<, long long int) - TVMET_DECLARE_MACRO(shr, >>, long long int) -} - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, long long int) -TVMET_DECLARE_MACRO(less, <, long long int) -TVMET_DECLARE_MACRO(greater_eq, >=, long long int) -TVMET_DECLARE_MACRO(less_eq, <=, long long int) -TVMET_DECLARE_MACRO(eq, ==, long long int) -TVMET_DECLARE_MACRO(not_eq, !=, long long int) -TVMET_DECLARE_MACRO(and, &&, long long int) -TVMET_DECLARE_MACRO(or, ||, long long int) -#endif // defined(TVMET_HAVE_LONG_LONG) - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, float) -TVMET_DECLARE_MACRO(less, <, float) -TVMET_DECLARE_MACRO(greater_eq, >=, float) -TVMET_DECLARE_MACRO(less_eq, <=, float) -TVMET_DECLARE_MACRO(eq, ==, float) -TVMET_DECLARE_MACRO(not_eq, !=, float) - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, double) -TVMET_DECLARE_MACRO(less, <, double) -TVMET_DECLARE_MACRO(greater_eq, >=, double) -TVMET_DECLARE_MACRO(less_eq, <=, double) -TVMET_DECLARE_MACRO(eq, ==, double) -TVMET_DECLARE_MACRO(not_eq, !=, double) - -#if defined(TVMET_HAVE_LONG_DOUBLE) -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >, long double) -TVMET_DECLARE_MACRO(less, <, long double) -TVMET_DECLARE_MACRO(greater_eq, >=, long double) -TVMET_DECLARE_MACRO(less_eq, <=, long double) -TVMET_DECLARE_MACRO(eq, ==, long double) -TVMET_DECLARE_MACRO(not_eq, !=, long double) -#endif // defined(TVMET_HAVE_LONG_DOUBLE) - -#undef TVMET_DECLARE_MACRO - - -#if defined(TVMET_HAVE_COMPLEX) -/* - * operator(Vector, Sz>, std::complex) - * operator(std::complex, Vector, Sz>) - * Note: - per se element wise - * - bit ops on complex doesn't make sense, stay away - * \todo type promotion - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME >, \ - XprVector, \ - XprLiteral< std::complex > \ - >, \ - Sz \ -> \ -operator OP (const XprVector& lhs, \ - const std::complex& rhs) TVMET_CXX_ALWAYS_INLINE; \ - \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, typename E::value_type>, \ - XprLiteral< std::complex >, \ - XprVector \ - >, \ - Sz \ -> \ -operator OP (const std::complex& lhs, \ - const XprVector& rhs) TVMET_CXX_ALWAYS_INLINE; - -// necessary operators for eval functions -TVMET_DECLARE_MACRO(greater, >) -TVMET_DECLARE_MACRO(less, <) -TVMET_DECLARE_MACRO(greater_eq, >=) -TVMET_DECLARE_MACRO(less_eq, <=) -TVMET_DECLARE_MACRO(eq, ==) -TVMET_DECLARE_MACRO(not_eq, !=) -TVMET_DECLARE_MACRO(and, &&) -TVMET_DECLARE_MACRO(or, ||) - -#undef TVMET_DECLARE_MACRO - -#endif // defined(TVMET_HAVE_COMPLEX) - - /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * global unary operators *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ @@ -391,8 +192,6 @@ XprVector< \ > \ operator OP (const XprVector& rhs) TVMET_CXX_ALWAYS_INLINE; -TVMET_DECLARE_MACRO(not, !) -TVMET_DECLARE_MACRO(compl, ~) TVMET_DECLARE_MACRO(neg, -) #undef TVMET_DECLARE_MACRO @@ -551,242 +350,6 @@ TVMET_IMPLEMENT_MACRO(div, /) // per se element wise #endif // defined(TVMET_HAVE_COMPLEX) -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector integer and compare operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(XprVector, XprVector) - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprVector, \ - XprVector \ - >, \ - Sz \ -> \ -operator OP (const XprVector& lhs, \ - const XprVector& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME, \ - XprVector, \ - XprVector \ - > expr_type; \ - return XprVector(expr_type(lhs, rhs)); \ -} - -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod, %) - TVMET_IMPLEMENT_MACRO(bitxor, ^) - TVMET_IMPLEMENT_MACRO(bitand, &) - TVMET_IMPLEMENT_MACRO(bitor, |) - TVMET_IMPLEMENT_MACRO(shl, <<) - TVMET_IMPLEMENT_MACRO(shr, >>) -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >) -TVMET_IMPLEMENT_MACRO(less, <) -TVMET_IMPLEMENT_MACRO(greater_eq, >=) -TVMET_IMPLEMENT_MACRO(less_eq, <=) -TVMET_IMPLEMENT_MACRO(eq, ==) -TVMET_IMPLEMENT_MACRO(not_eq, !=) -TVMET_IMPLEMENT_MACRO(and, &&) -TVMET_IMPLEMENT_MACRO(or, ||) - -#undef TVMET_IMPLEMENT_MACRO - - -/* - * operator(Vector, POD) - * operator(POD, Vector) - * Note: operations are per se element_wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP, TP) \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprVector, \ - XprLiteral< TP > \ - >, \ - Sz \ -> \ -operator OP (const XprVector& lhs, TP rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME, \ - XprVector, \ - XprLiteral< TP > \ - > expr_type; \ - return XprVector( \ - expr_type(lhs, XprLiteral< TP >(rhs))); \ -} \ - \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, \ - XprLiteral< TP >, \ - XprVector \ - >, \ - Sz \ -> \ -operator OP (TP lhs, const XprVector& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< TP, typename E::value_type>, \ - XprLiteral< TP >, \ - XprVector \ - > expr_type; \ - return XprVector( \ - expr_type(XprLiteral< TP >(lhs), rhs)); \ -} - -// integer operators only, e.g used on double you wil get an error -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod, %, int) - TVMET_IMPLEMENT_MACRO(bitxor, ^, int) - TVMET_IMPLEMENT_MACRO(bitand, &, int) - TVMET_IMPLEMENT_MACRO(bitor, |, int) - TVMET_IMPLEMENT_MACRO(shl, <<, int) - TVMET_IMPLEMENT_MACRO(shr, >>, int) -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, int) -TVMET_IMPLEMENT_MACRO(less, <, int) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, int) -TVMET_IMPLEMENT_MACRO(less_eq, <=, int) -TVMET_IMPLEMENT_MACRO(eq, ==, int) -TVMET_IMPLEMENT_MACRO(not_eq, !=, int) -TVMET_IMPLEMENT_MACRO(and, &&, int) -TVMET_IMPLEMENT_MACRO(or, ||, int) - - -#if defined(TVMET_HAVE_LONG_LONG) -// integer operators only -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mod, %, long long int) - TVMET_IMPLEMENT_MACRO(bitxor, ^, long long int) - TVMET_IMPLEMENT_MACRO(bitand, &, long long int) - TVMET_IMPLEMENT_MACRO(bitor, |, long long int) - TVMET_IMPLEMENT_MACRO(shl, <<, long long int) - TVMET_IMPLEMENT_MACRO(shr, >>, long long int) -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, long long int) -TVMET_IMPLEMENT_MACRO(less, <, long long int) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, long long int) -TVMET_IMPLEMENT_MACRO(less_eq, <=, long long int) -TVMET_IMPLEMENT_MACRO(eq, ==, long long int) -TVMET_IMPLEMENT_MACRO(not_eq, !=, long long int) -TVMET_IMPLEMENT_MACRO(and, &&, long long int) -TVMET_IMPLEMENT_MACRO(or, ||, long long int) -#endif // defined(TVMET_HAVE_LONG_LONG) - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, float) -TVMET_IMPLEMENT_MACRO(less, <, float) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, float) -TVMET_IMPLEMENT_MACRO(less_eq, <=, float) -TVMET_IMPLEMENT_MACRO(eq, ==, float) -TVMET_IMPLEMENT_MACRO(not_eq, !=, float) - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, double) -TVMET_IMPLEMENT_MACRO(less, <, double) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, double) -TVMET_IMPLEMENT_MACRO(less_eq, <=, double) -TVMET_IMPLEMENT_MACRO(eq, ==, double) -TVMET_IMPLEMENT_MACRO(not_eq, !=, double) - -#if defined(TVMET_HAVE_LONG_DOUBLE) -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >, long double) -TVMET_IMPLEMENT_MACRO(less, <, long double) -TVMET_IMPLEMENT_MACRO(greater_eq, >=, long double) -TVMET_IMPLEMENT_MACRO(less_eq, <=, long double) -TVMET_IMPLEMENT_MACRO(eq, ==, long double) -TVMET_IMPLEMENT_MACRO(not_eq, !=, long double) -#endif // defined(TVMET_HAVE_LONG_DOUBLE) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(TVMET_HAVE_COMPLEX) -/* - * operator(Vector, Sz>, std::complex) - * operator(std::complex, Vector, Sz>) - * Note: - per se element wise - * - bit ops on complex doesn't make sense, stay away - * \todo type promotion - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME >, \ - XprVector, \ - XprLiteral< std::complex > \ - >, \ - Sz \ -> \ -operator OP (const XprVector& lhs, \ - const std::complex& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME >, \ - XprVector, \ - XprLiteral< std::complex > \ - > expr_type; \ - return XprVector( \ - expr_type(lhs, XprLiteral< std::complex >(rhs))); \ -} \ - \ -template \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME, typename E::value_type>, \ - XprLiteral< std::complex >, \ - XprVector \ - >, \ - Sz \ -> \ -operator OP (const std::complex& lhs, \ - const XprVector& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< std::complex, typename E::value_type>, \ - XprLiteral< std::complex >, \ - XprVector \ - > expr_type; \ - return XprVector( \ - expr_type(XprLiteral< std::complex >(lhs), rhs)); \ -} - -// necessary operators for eval functions -TVMET_IMPLEMENT_MACRO(greater, >) -TVMET_IMPLEMENT_MACRO(less, <) -TVMET_IMPLEMENT_MACRO(greater_eq, >=) -TVMET_IMPLEMENT_MACRO(less_eq, <=) -TVMET_IMPLEMENT_MACRO(eq, ==) -TVMET_IMPLEMENT_MACRO(not_eq, !=) -TVMET_IMPLEMENT_MACRO(and, &&) -TVMET_IMPLEMENT_MACRO(or, ||) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(TVMET_HAVE_COMPLEX) - - /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * global unary operators *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ @@ -813,8 +376,6 @@ operator OP (const XprVector& rhs) { \ return XprVector(expr_type(rhs)); \ } -TVMET_IMPLEMENT_MACRO(not, !) -TVMET_IMPLEMENT_MACRO(compl, ~) TVMET_IMPLEMENT_MACRO(neg, -) #undef TVMET_IMPLEMENT_MACRO diff --git a/tvmet-1.7.1/include/tvmet/xpr/VectorUnaryFunctions.h b/tvmet-1.7.1/include/tvmet/xpr/VectorUnaryFunctions.h deleted file mode 100644 index 0f72eac16..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/VectorUnaryFunctions.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Tiny Vector Matrix Library - * Dense Vector Matrix Libary of Tiny size using Expression Templates - * - * Copyright (C) 2001 - 2003 Olaf Petzold - * - * 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: VectorUnaryFunctions.h,v 1.7 2004/06/10 16:36:55 opetzold Exp $ - */ - -#ifndef TVMET_XPR_VECTOR_UNARY_FUNCTIONS_H -#define TVMET_XPR_VECTOR_UNARY_FUNCTIONS_H - -namespace tvmet { - - -/********************************************************* - * PART I: DECLARATION - *********************************************************/ - -/* - * unary_function(XprVector) - */ -#define TVMET_DECLARE_MACRO(NAME) \ -template \ -inline \ -XprVector< \ - XprUnOp< \ - Fcnl_##NAME, \ - XprVector \ - >, \ - Sz \ -> \ -NAME(const XprVector& rhs) TVMET_CXX_ALWAYS_INLINE; - -TVMET_DECLARE_MACRO(abs) -TVMET_DECLARE_MACRO(cbrt) -TVMET_DECLARE_MACRO(ceil) -TVMET_DECLARE_MACRO(floor) -TVMET_DECLARE_MACRO(rint) -TVMET_DECLARE_MACRO(sin) -TVMET_DECLARE_MACRO(cos) -TVMET_DECLARE_MACRO(tan) -TVMET_DECLARE_MACRO(sinh) -TVMET_DECLARE_MACRO(cosh) -TVMET_DECLARE_MACRO(tanh) -TVMET_DECLARE_MACRO(asin) -TVMET_DECLARE_MACRO(acos) -TVMET_DECLARE_MACRO(atan) -TVMET_DECLARE_MACRO(exp) -TVMET_DECLARE_MACRO(log) -TVMET_DECLARE_MACRO(log10) -TVMET_DECLARE_MACRO(sqrt) - -#if defined(TVMET_HAVE_IEEE_MATH) -TVMET_DECLARE_MACRO(asinh) -TVMET_DECLARE_MACRO(acosh) -TVMET_DECLARE_MACRO(atanh) -TVMET_DECLARE_MACRO(expm1) -TVMET_DECLARE_MACRO(log1p) -TVMET_DECLARE_MACRO(erf) -TVMET_DECLARE_MACRO(erfc) -TVMET_DECLARE_MACRO(j0) -TVMET_DECLARE_MACRO(j1) -TVMET_DECLARE_MACRO(y0) -TVMET_DECLARE_MACRO(y1) -TVMET_DECLARE_MACRO(lgamma) -/** \todo isnan etc. - default return is only an int! */ -#if !defined(TVMET_NO_IEEE_MATH_ISNAN) -TVMET_DECLARE_MACRO(isnan) -#endif -#if !defined(TVMET_NO_IEEE_MATH_ISINF) -TVMET_DECLARE_MACRO(isinf) -#endif -TVMET_DECLARE_MACRO(finite) -#endif // defined(TVMET_HAVE_IEEE_MATH) - -#undef TVMET_DECLARE_MACRO - - -/********************************************************* - * PART II: IMPLEMENTATION - *********************************************************/ - - -/* - * unary_function(XprVector) - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template \ -inline \ -XprVector< \ - XprUnOp< \ - Fcnl_##NAME, \ - XprVector \ - >, \ - Sz \ -> \ -NAME(const XprVector& rhs) { \ - typedef XprUnOp< \ - Fcnl_##NAME, \ - XprVector \ - > expr_type; \ - return XprVector(expr_type(rhs)); \ -} - -TVMET_IMPLEMENT_MACRO(abs) -TVMET_IMPLEMENT_MACRO(cbrt) -TVMET_IMPLEMENT_MACRO(ceil) -TVMET_IMPLEMENT_MACRO(floor) -TVMET_IMPLEMENT_MACRO(rint) -TVMET_IMPLEMENT_MACRO(sin) -TVMET_IMPLEMENT_MACRO(cos) -TVMET_IMPLEMENT_MACRO(tan) -TVMET_IMPLEMENT_MACRO(sinh) -TVMET_IMPLEMENT_MACRO(cosh) -TVMET_IMPLEMENT_MACRO(tanh) -TVMET_IMPLEMENT_MACRO(asin) -TVMET_IMPLEMENT_MACRO(acos) -TVMET_IMPLEMENT_MACRO(atan) -TVMET_IMPLEMENT_MACRO(exp) -TVMET_IMPLEMENT_MACRO(log) -TVMET_IMPLEMENT_MACRO(log10) -TVMET_IMPLEMENT_MACRO(sqrt) - -#if defined(TVMET_HAVE_IEEE_MATH) -TVMET_IMPLEMENT_MACRO(asinh) -TVMET_IMPLEMENT_MACRO(acosh) -TVMET_IMPLEMENT_MACRO(atanh) -TVMET_IMPLEMENT_MACRO(expm1) -TVMET_IMPLEMENT_MACRO(log1p) -TVMET_IMPLEMENT_MACRO(erf) -TVMET_IMPLEMENT_MACRO(erfc) -TVMET_IMPLEMENT_MACRO(j0) -TVMET_IMPLEMENT_MACRO(j1) -TVMET_IMPLEMENT_MACRO(y0) -TVMET_IMPLEMENT_MACRO(y1) -TVMET_IMPLEMENT_MACRO(lgamma) -/** \todo isnan etc. - default return is only an int! */ -#if !defined(TVMET_NO_IEEE_MATH_ISNAN) -TVMET_IMPLEMENT_MACRO(isnan) -#endif -#if !defined(TVMET_NO_IEEE_MATH_ISINF) -TVMET_IMPLEMENT_MACRO(isinf) -#endif -TVMET_IMPLEMENT_MACRO(finite) -#endif // defined(TVMET_HAVE_IEEE_MATH) - -#undef TVMET_IMPLEMENT_MACRO - - - -} // namespace tvmet - -#endif // TVMET_XPR_VECTOR_FUNCTIONS_H - -// Local Variables: -// mode:C++ -// End: -- cgit v1.2.3