mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-31 19:00:35 +08:00
Fix enough stuff, and remove enough dead stuff, to make a simple test program compile
This commit is contained in:
parent
e3a45173b5
commit
6fe6a81839
@ -43,7 +43,7 @@ class IoPrintHelper {
|
||||
|
||||
private:
|
||||
static std::streamsize width(const C& e) {
|
||||
std::streamsize w = static_cast<std::streamsize>(std::log10(max(abs(e)))+1);
|
||||
std::streamsize w = static_cast<std::streamsize>(10); //FIXME arbitrary value
|
||||
return w > 0 ? w : 0;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,6 @@ std::ostream& Matrix<T, NRows, NCols>::print_on(std::ostream& os) const
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* member operators with scalars, per se element wise
|
||||
*/
|
||||
|
@ -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<E1, Rows, Cols>& lhs,
|
||||
const Vector<T2, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE;
|
||||
|
||||
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
* Matrix integer and compare operators
|
||||
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
|
||||
|
||||
/*
|
||||
* operator(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>)
|
||||
* operator(XprMatrix<E>, Matrix<T, Rows, Cols>)
|
||||
* operator(Matrix<T, Rows, Cols>, XprMatrix<E>)
|
||||
* Note: operations are per se element wise
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME, OP) \
|
||||
template<class T1, int Rows, int Cols, \
|
||||
class T2> \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<T1, T2>, \
|
||||
MatrixConstReference<T1, Rows, Cols>, \
|
||||
MatrixConstReference<T2, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const Matrix<T1, Rows, Cols>& lhs, \
|
||||
const Matrix<T2, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; \
|
||||
\
|
||||
template<class E, \
|
||||
class T, int Rows, int Cols> \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, T>, \
|
||||
XprMatrix<E, Rows, Cols>, \
|
||||
MatrixConstReference<T, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const XprMatrix<E, Rows, Cols>& lhs, \
|
||||
const Matrix<T, Rows, Cols>& rhs) TVMET_CXX_ALWAYS_INLINE; \
|
||||
\
|
||||
template<class T, int Rows, int Cols, \
|
||||
class E> \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, T>, \
|
||||
MatrixConstReference<T, Rows, Cols>, \
|
||||
XprMatrix<E, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const Matrix<T, Rows, Cols>& lhs, \
|
||||
const XprMatrix<E, Rows, Cols>& 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<T, Rows, Cols>, complex<T>)
|
||||
* operator(complex<T>, Matrix<T, Rows, Cols>)
|
||||
* Note: - per se element wise
|
||||
* - bit ops on complex<int> doesn't make sense, stay away
|
||||
* \todo type promotion
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME, OP) \
|
||||
template<class T, int Rows, int Cols> \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
|
||||
MatrixConstReference< std::complex<T>, Rows, Cols>, \
|
||||
XprLiteral<std::complex<T> > \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const Matrix< std::complex<T>, Rows, Cols>& lhs, \
|
||||
const std::complex<T>& rhs) TVMET_CXX_ALWAYS_INLINE; \
|
||||
\
|
||||
template<class T, int Rows, int Cols> \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
|
||||
XprLiteral< std::complex<T> >, \
|
||||
MatrixConstReference< std::complex<T>, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const std::complex<T>& lhs, \
|
||||
const Matrix< std::complex<T>, 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<T, Rows, Cols>, POD)
|
||||
* operator(POD, Matrix<T, Rows, Cols>)
|
||||
* Note: operations are per se element wise
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME, OP, TP) \
|
||||
template<class T, int Rows, int Cols> \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<T, TP >, \
|
||||
MatrixConstReference<T, Rows, Cols>, \
|
||||
XprLiteral<TP > \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const Matrix<T, Rows, Cols>& lhs, TP rhs) TVMET_CXX_ALWAYS_INLINE; \
|
||||
\
|
||||
template<class T, int Rows, int Cols> \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< TP, T>, \
|
||||
XprLiteral< TP >, \
|
||||
MatrixConstReference<T, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (TP lhs, const Matrix<T, Rows, Cols>& 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<T, Rows, Cols>& 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<E1, Rows, Cols>& lhs, const Vector<T2, Cols>& rhs) {
|
||||
}
|
||||
|
||||
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
* Matrix integer and compare operators
|
||||
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
|
||||
|
||||
/*
|
||||
* operator(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>)
|
||||
* operator(XprMatrix<E>, Matrix<T, Rows, Cols>)
|
||||
* operator(Matrix<T, Rows, Cols>, XprMatrix<E>)
|
||||
* Note: operations are per se element wise
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME, OP) \
|
||||
template<class T1, int Rows, int Cols, \
|
||||
class T2> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<T1, T2>, \
|
||||
MatrixConstReference<T1, Rows, Cols>, \
|
||||
MatrixConstReference<T2, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const Matrix<T1, Rows, Cols>& lhs, \
|
||||
const Matrix<T2, Rows, Cols>& rhs) { \
|
||||
typedef XprBinOp < \
|
||||
Fcnl_##NAME<T1, T2>, \
|
||||
MatrixConstReference<T1, Rows, Cols>, \
|
||||
MatrixConstReference<T2, Rows, Cols> \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>(expr_type(lhs.const_ref(), rhs.const_ref())); \
|
||||
} \
|
||||
\
|
||||
template<class E, \
|
||||
class T, int Rows, int Cols> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, T>, \
|
||||
XprMatrix<E, Rows, Cols>, \
|
||||
MatrixConstReference<T, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const XprMatrix<E, Rows, Cols>& lhs, const Matrix<T, Rows, Cols>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, T>, \
|
||||
XprMatrix<E, Rows, Cols>, \
|
||||
MatrixConstReference<T, Rows, Cols> \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>(expr_type(lhs, rhs.const_ref())); \
|
||||
} \
|
||||
\
|
||||
template<class T, int Rows, int Cols, \
|
||||
class E> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, T>, \
|
||||
MatrixConstReference<T, Rows, Cols>, \
|
||||
XprMatrix<E, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const Matrix<T, Rows, Cols>& lhs, const XprMatrix<E, Rows, Cols>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME<T, typename E::value_type>, \
|
||||
MatrixConstReference<T, Rows, Cols>, \
|
||||
XprMatrix<E, Rows, Cols> \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>(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<T, Rows, Cols>, complex<T>)
|
||||
* operator(complex<T>, Matrix<T, Rows, Cols>)
|
||||
* Note: - per se element wise
|
||||
* - bit ops on complex<int> doesn't make sense, stay away
|
||||
* \todo type promotion
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME, OP) \
|
||||
template<class T, int Rows, int Cols> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
|
||||
MatrixConstReference< std::complex<T>, Rows, Cols>, \
|
||||
XprLiteral<std::complex<T> > \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const Matrix< std::complex<T>, Rows, Cols>& lhs, \
|
||||
const std::complex<T>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
|
||||
MatrixConstReference< std::complex<T>, Rows, Cols>, \
|
||||
XprLiteral< std::complex<T> > \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>( \
|
||||
expr_type(lhs.const_ref(), XprLiteral< std::complex<T> >(rhs))); \
|
||||
} \
|
||||
\
|
||||
template<class T, int Rows, int Cols> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
|
||||
XprLiteral< std::complex<T> >, \
|
||||
MatrixConstReference< std::complex<T>, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const std::complex<T>& lhs, \
|
||||
const Matrix< std::complex<T>, Rows, Cols>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
|
||||
XprLiteral< std::complex<T> >, \
|
||||
MatrixConstReference<T, Rows, Cols> \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>( \
|
||||
expr_type(XprLiteral< std::complex<T> >(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<T, Rows, Cols>, POD)
|
||||
* operator(POD, Matrix<T, Rows, Cols>)
|
||||
* Note: operations are per se element wise
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME, OP, TP) \
|
||||
template<class T, int Rows, int Cols> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<T, TP >, \
|
||||
MatrixConstReference<T, Rows, Cols>, \
|
||||
XprLiteral<TP > \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const Matrix<T, Rows, Cols>& lhs, TP rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME<T, TP >, \
|
||||
MatrixConstReference<T, Rows, Cols>, \
|
||||
XprLiteral< TP > \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>( \
|
||||
expr_type(lhs.const_ref(), XprLiteral< TP >(rhs))); \
|
||||
} \
|
||||
\
|
||||
template<class T, int Rows, int Cols> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< TP, T>, \
|
||||
XprLiteral< TP >, \
|
||||
MatrixConstReference<T, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (TP lhs, const Matrix<T, Rows, Cols>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME< TP, T>, \
|
||||
XprLiteral< TP >, \
|
||||
MatrixConstReference<T, Rows, Cols> \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>( \
|
||||
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<T, Rows, Cols>& rhs) { \
|
||||
return XprMatrix<expr_type, Rows, Cols>(expr_type(rhs.const_ref())); \
|
||||
}
|
||||
|
||||
TVMET_IMPLEMENT_MACRO(not, !)
|
||||
TVMET_IMPLEMENT_MACRO(compl, ~)
|
||||
TVMET_IMPLEMENT_MACRO(neg, -)
|
||||
#undef TVMET_IMPLEMENT_MACRO
|
||||
|
||||
|
@ -26,71 +26,6 @@
|
||||
|
||||
namespace tvmet {
|
||||
|
||||
|
||||
/*********************************************************
|
||||
* PART I: DECLARATION
|
||||
*********************************************************/
|
||||
|
||||
/*
|
||||
* unary_function(Matrix<T, Rows, Cols>)
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME) \
|
||||
template<class T, int Rows, int Cols> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprUnOp< \
|
||||
Fcnl_##NAME<T>, \
|
||||
MatrixConstReference<T, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
NAME(const Matrix<T, Rows, Cols>& 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<std::complex<T>, Rows, Cols>)
|
||||
*/
|
||||
@ -109,86 +44,12 @@ NAME(const Matrix<std::complex<T>, 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<T, Rows, Cols>)
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME) \
|
||||
template<class T, int Rows, int Cols> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprUnOp< \
|
||||
Fcnl_##NAME<T>, \
|
||||
MatrixConstReference<T, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
NAME(const Matrix<T, Rows, Cols>& rhs) { \
|
||||
typedef XprUnOp< \
|
||||
Fcnl_##NAME<T>, \
|
||||
MatrixConstReference<T, Rows, Cols> \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>(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<std::complex<T>, Rows, Cols>)
|
||||
*/
|
||||
@ -213,8 +74,6 @@ NAME(const Matrix<std::complex<T>, 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
|
||||
|
@ -26,27 +26,6 @@
|
||||
|
||||
namespace tvmet {
|
||||
|
||||
|
||||
/**
|
||||
* \class Fcnl_not UnaryFunctionals.h "tvmet/UnaryFunctionals.h"
|
||||
* \brief unary functional for logical not.
|
||||
*/
|
||||
template <class T>
|
||||
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<T="
|
||||
<< typeid(T).name() << ">,"
|
||||
<< 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 <class T> \
|
||||
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 << "<T=" \
|
||||
<< typeid(value_type).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 <class T> \
|
||||
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 << "<T=" \
|
||||
<< typeid(value_type).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 <class T> \
|
||||
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 << "<T=" \
|
||||
<< typeid(value_type).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<long int> UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */
|
||||
/** \class Fcnl_abs<long long int> UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */
|
||||
/** \class Fcnl_abs<float> UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */
|
||||
/** \class Fcnl_abs<double> UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */
|
||||
/** \class Fcnl_abs<long double> UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME, POD) \
|
||||
template <class T> 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 << "<T=" \
|
||||
<< typeid(value_type).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<T> > UnaryFunctionals.h "tvmet/UnaryFunctionals.h"
|
||||
*/
|
||||
template <class T>
|
||||
struct Fcnl_abs< std::complex<T> > : public UnaryFunctional {
|
||||
typedef T value_type;
|
||||
|
||||
static inline
|
||||
value_type apply_on(const std::complex<T>& rhs) {
|
||||
return std::abs(rhs);
|
||||
}
|
||||
|
||||
static
|
||||
void print_xpr(std::ostream& os, int l=0) {
|
||||
os << IndentLevel(l) << "Fcnl_abs<T="
|
||||
<< typeid(std::complex<T>).name() << ">,"
|
||||
<< std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \class Fcnl_conj< std::complex<T> > UnaryFunctionals.h "tvmet/UnaryFunctionals.h"
|
||||
@ -296,8 +84,6 @@ struct Fcnl_conj< std::complex<T> > : public UnaryFunctional {
|
||||
|
||||
/** \class Fcnl_real< std::complex<T> > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */
|
||||
/** \class Fcnl_imag< std::complex<T> > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */
|
||||
/** \class Fcnl_arg< std::complex<T> > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */
|
||||
/** \class Fcnl_norm< std::complex<T> > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME) \
|
||||
template <class T> struct Fcnl_##NAME; \
|
||||
template <class T> \
|
||||
@ -319,42 +105,11 @@ struct Fcnl_##NAME< std::complex<T> > : 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 <class T> \
|
||||
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 << "<T=" \
|
||||
<< typeid(POD).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
|
||||
|
@ -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<T1, Sz>, Vector<T2, Sz>)
|
||||
* operator(XprVector<E, Sz>, Vector<T, Sz>)
|
||||
* operator(Vector<T, Sz>, XprVector<E, Sz>)
|
||||
* Note: operations are per se element wise
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME, OP) \
|
||||
template<class T1, class T2, int Sz> \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<T1, T2>, \
|
||||
VectorConstReference<T1, Sz>, \
|
||||
VectorConstReference<T2, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const Vector<T1, Sz>& lhs, \
|
||||
const Vector<T2, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE; \
|
||||
\
|
||||
template<class E, class T, int Sz> \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, T>, \
|
||||
XprVector<E, Sz>, \
|
||||
VectorConstReference<T, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const XprVector<E, Sz>& lhs, \
|
||||
const Vector<T, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE; \
|
||||
\
|
||||
template<class E, class T, int Sz> \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<T, typename E::value_type>, \
|
||||
VectorConstReference<T, Sz>, \
|
||||
XprVector<E, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const Vector<T, Sz>& lhs, \
|
||||
const XprVector<E, Sz>& 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<std::complex<T>, Sz>, std::complex<T>)
|
||||
* operator(std::complex<T>, Vector<std::complex<T>, Sz>)
|
||||
* Note: - per se element wise
|
||||
* - bit ops on complex<int> doesn't make sense, stay away
|
||||
* \todo type promotion
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME, OP) \
|
||||
template<class T, int Sz> \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
|
||||
VectorConstReference< std::complex<T>, Sz>, \
|
||||
XprLiteral< std::complex<T> > \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const Vector<std::complex<T>, Sz>& lhs, \
|
||||
const std::complex<T>& rhs) TVMET_CXX_ALWAYS_INLINE; \
|
||||
\
|
||||
template<class T, int Sz> \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
|
||||
XprLiteral< std::complex<T> >, \
|
||||
VectorConstReference< std::complex<T>, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const std::complex<T>& lhs, \
|
||||
const Vector< std::complex<T>, 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<T, Sz>, POD)
|
||||
* operator(POD, Vector<T, Sz>)
|
||||
* Note: operations are per se element_wise
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME, OP, TP) \
|
||||
template<class T, int Sz> \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< T, TP >, \
|
||||
VectorConstReference<T, Sz>, \
|
||||
XprLiteral< TP > \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const Vector<T, Sz>& lhs, TP rhs) TVMET_CXX_ALWAYS_INLINE; \
|
||||
\
|
||||
template<class T, int Sz> \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< TP, T>, \
|
||||
XprLiteral< TP >, \
|
||||
VectorConstReference<T, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (TP lhs, const Vector<T, Sz>& 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<T, Sz>& 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<T1, Sz>, Vector<T2, Sz>)
|
||||
* operator(XprVector<E, Sz>, Vector<T, Sz>)
|
||||
* operator(Vector<T, Sz>, XprVector<E, Sz>)
|
||||
* Note: operations are per se element wise
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME, OP) \
|
||||
template<class T1, class T2, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<T1, T2>, \
|
||||
VectorConstReference<T1, Sz>, \
|
||||
VectorConstReference<T2, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const Vector<T1, Sz>& lhs, const Vector<T2, Sz>& rhs) { \
|
||||
typedef XprBinOp < \
|
||||
Fcnl_##NAME<T1, T2>, \
|
||||
VectorConstReference<T1, Sz>, \
|
||||
VectorConstReference<T2, Sz> \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>( \
|
||||
expr_type(lhs.const_ref(), rhs.const_ref())); \
|
||||
} \
|
||||
\
|
||||
template<class E, class T, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, T>, \
|
||||
XprVector<E, Sz>, \
|
||||
VectorConstReference<T, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const XprVector<E, Sz>& lhs, const Vector<T, Sz>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, T>, \
|
||||
XprVector<E, Sz>, \
|
||||
VectorConstReference<T, Sz> \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>( \
|
||||
expr_type(lhs, rhs.const_ref())); \
|
||||
} \
|
||||
\
|
||||
template<class E, class T, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<T, typename E::value_type>, \
|
||||
VectorConstReference<T, Sz>, \
|
||||
XprVector<E, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const Vector<T, Sz>& lhs, const XprVector<E, Sz>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME<T, typename E::value_type>, \
|
||||
VectorConstReference<T, Sz>, \
|
||||
XprVector<E, Sz> \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>( \
|
||||
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<std::complex<T>, Sz>, std::complex<T>)
|
||||
* operator(std::complex<T>, Vector<std::complex<T>, Sz>)
|
||||
* Note: - per se element wise
|
||||
* - bit ops on complex<int> doesn't make sense, stay away
|
||||
* \todo type promotion
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME, OP) \
|
||||
template<class T, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
|
||||
VectorConstReference< std::complex<T>, Sz>, \
|
||||
XprLiteral< std::complex<T> > \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const Vector<std::complex<T>, Sz>& lhs, const std::complex<T>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
|
||||
VectorConstReference< std::complex<T>, Sz>, \
|
||||
XprLiteral< std::complex<T> > \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>( \
|
||||
expr_type(lhs.const_ref(), XprLiteral< std::complex<T> >(rhs))); \
|
||||
} \
|
||||
\
|
||||
template<class T, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
|
||||
XprLiteral< std::complex<T> >, \
|
||||
VectorConstReference< std::complex<T>, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const std::complex<T>& lhs, const Vector< std::complex<T>, Sz>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, std::complex<T> >, \
|
||||
XprLiteral< std::complex<T> >, \
|
||||
VectorConstReference< std::complex<T>, Sz> \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>( \
|
||||
expr_type(XprLiteral< std::complex<T> >(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<T, Sz>, POD)
|
||||
* operator(POD, Vector<T, Sz>)
|
||||
* Note: operations are per se element_wise
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME, OP, TP) \
|
||||
template<class T, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< T, TP >, \
|
||||
VectorConstReference<T, Sz>, \
|
||||
XprLiteral< TP > \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const Vector<T, Sz>& lhs, TP rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME<T, TP >, \
|
||||
VectorConstReference<T, Sz>, \
|
||||
XprLiteral< TP > \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>( \
|
||||
expr_type(lhs.const_ref(), XprLiteral< TP >(rhs))); \
|
||||
} \
|
||||
\
|
||||
template<class T, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME< TP, T>, \
|
||||
XprLiteral< TP >, \
|
||||
VectorConstReference<T, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (TP lhs, const Vector<T, Sz>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME< TP, T>, \
|
||||
XprLiteral< TP >, \
|
||||
VectorConstReference<T, Sz> \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>( \
|
||||
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<T, Sz>& rhs) { \
|
||||
return XprVector<expr_type, Sz>(expr_type(rhs.const_ref())); \
|
||||
}
|
||||
|
||||
TVMET_IMPLEMENT_MACRO(not, !)
|
||||
TVMET_IMPLEMENT_MACRO(compl, ~)
|
||||
TVMET_IMPLEMENT_MACRO(neg, -)
|
||||
|
||||
#undef TVMET_IMPLEMENT_MACRO
|
||||
|
@ -31,65 +31,6 @@ namespace tvmet {
|
||||
* PART I: DECLARATION
|
||||
*********************************************************/
|
||||
|
||||
/*
|
||||
* unary_function(Vector<T, Sz>)
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME) \
|
||||
template<class T, int Sz> \
|
||||
XprVector< \
|
||||
XprUnOp< \
|
||||
Fcnl_##NAME<T>, \
|
||||
VectorConstReference<T, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
NAME(const Vector<T, Sz>& 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<std::complex<T>, Sz>)
|
||||
*/
|
||||
@ -107,8 +48,6 @@ NAME(const Vector<std::complex<T>, 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<T, Sz>)
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME) \
|
||||
template<class T, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprUnOp< \
|
||||
Fcnl_##NAME<T>, \
|
||||
VectorConstReference<T, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
NAME(const Vector<T, Sz>& rhs) { \
|
||||
typedef XprUnOp< \
|
||||
Fcnl_##NAME<T>, \
|
||||
VectorConstReference<T, Sz> \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>(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<std::complex<T>, Sz>)
|
||||
*/
|
||||
@ -211,8 +84,6 @@ NAME(const Vector<std::complex<T>, 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
|
||||
|
@ -27,29 +27,6 @@
|
||||
#include <tvmet/config.h>
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Compiler specifics
|
||||
***********************************************************************/
|
||||
#if defined(__GNUC__)
|
||||
# include <tvmet/config/config-gcc.h>
|
||||
#endif
|
||||
|
||||
#if defined(__ICC)
|
||||
# include <tvmet/config/config-icc.h>
|
||||
#endif
|
||||
|
||||
#if defined(__KCC)
|
||||
# include <tvmet/config/config-kcc.h>
|
||||
#endif
|
||||
|
||||
#if defined(__PGI)
|
||||
# include <tvmet/config/config-pgi.h>
|
||||
#endif
|
||||
|
||||
// vc7.1: 1310 and vc7.0 1300
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1310)
|
||||
# include <tvmet/config/config-vc71.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* other compiler specific stuff
|
||||
|
@ -24,6 +24,8 @@
|
||||
#ifndef TVMET_XPR_MMPRODUCT_H
|
||||
#define TVMET_XPR_MMPRODUCT_H
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <tvmet/meta/Gemm.h>
|
||||
#include <tvmet/loop/Gemm.h>
|
||||
|
||||
@ -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<use_meta>(), m_lhs, m_rhs, i, j);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
#ifndef TVMET_XPR_MMPRODUCT_TRANSPOSED_H
|
||||
#define TVMET_XPR_MMPRODUCT_TRANSPOSED_H
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <tvmet/meta/Gemm.h>
|
||||
#include <tvmet/loop/Gemm.h>
|
||||
|
||||
@ -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<use_meta>(), m_lhs, m_rhs, j, i);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
#ifndef TVMET_XPR_MMTPRODUCT_H
|
||||
#define TVMET_XPR_MMTPRODUCT_H
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <tvmet/meta/Gemmt.h>
|
||||
#include <tvmet/loop/Gemmt.h>
|
||||
|
||||
@ -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<use_meta>(), m_lhs, m_rhs, i, j);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
#ifndef TVMET_XPR_MVPRODUCT_H
|
||||
#define TVMET_XPR_MVPRODUCT_H
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <tvmet/meta/Gemv.h>
|
||||
#include <tvmet/loop/Gemv.h>
|
||||
|
||||
@ -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<use_meta>(), m_lhs, m_rhs, j);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
#ifndef TVMET_XPR_MATRIX_H
|
||||
#define TVMET_XPR_MATRIX_H
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <tvmet/meta/Matrix.h>
|
||||
#include <tvmet/loop/Matrix.h>
|
||||
|
||||
@ -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 <tvmet/xpr/MatrixFunctions.h>
|
||||
#include <tvmet/xpr/MatrixBinaryFunctions.h>
|
||||
#include <tvmet/xpr/MatrixUnaryFunctions.h>
|
||||
#include <tvmet/xpr/MatrixOperators.h>
|
||||
#include <tvmet/xpr/Eval.h>
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
||||
* $Id: MatrixCol.h,v 1.15 2004/09/16 09:14:18 opetzold Exp $
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
||||
* $Id: MatrixDiag.h,v 1.13 2004/09/16 09:14:18 opetzold Exp $
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
@ -220,206 +220,6 @@ operator*(const XprMatrix<E1, Rows, Cols>& lhs,
|
||||
const XprVector<E2, Cols>& 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<class E1, int Rows, int Cols, \
|
||||
class E2> \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \
|
||||
XprMatrix<E1, Rows, Cols>, \
|
||||
XprMatrix<E2, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const XprMatrix<E1, Rows, Cols>& lhs, \
|
||||
const XprMatrix<E2, Rows, Cols>& 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<E, Rows, Cols>, std::complex<>)
|
||||
* operator(std::complex<>, XprMatrix<E, Rows, Cols>)
|
||||
* Note: - per se element wise
|
||||
* - bit ops on complex<int> doesn't make sense, stay away
|
||||
* \todo type promotion
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME, OP) \
|
||||
template<class E, int Rows, int Cols, class T> \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, std::complex<T> >, \
|
||||
XprMatrix<E, Rows, Cols>, \
|
||||
XprLiteral< std::complex<T> > \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const XprMatrix<E, Rows, Cols>& lhs, \
|
||||
const std::complex<T>& rhs) TVMET_CXX_ALWAYS_INLINE; \
|
||||
\
|
||||
template<class E, int Rows, int Cols, class T> \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<std::complex<T>, typename E::value_type>, \
|
||||
XprLiteral< std::complex<T> >, \
|
||||
XprMatrix<E, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const std::complex<T>& lhs, \
|
||||
const XprMatrix<E, 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(XprMatrix<E, Rows, Cols>, POD)
|
||||
* operator(POD, XprMatrix<E, Rows, Cols>)
|
||||
* Note: operations are per se element wise
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME, OP, TP) \
|
||||
template<class E, int Rows, int Cols> \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, TP >, \
|
||||
XprMatrix<E, Rows, Cols>, \
|
||||
XprLiteral< TP > \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const XprMatrix<E, Rows, Cols>& lhs, \
|
||||
TP rhs) TVMET_CXX_ALWAYS_INLINE; \
|
||||
\
|
||||
template<class E, int Rows, int Cols> \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<TP, typename E::value_type>, \
|
||||
XprLiteral< TP >, \
|
||||
XprMatrix<E, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (TP lhs, \
|
||||
const XprMatrix<E, Rows, Cols>& 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<E, Rows, Cols>& 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<E1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs)
|
||||
}
|
||||
|
||||
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
* Matrix integer and compare operators
|
||||
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
|
||||
|
||||
/*
|
||||
* operator(XprMatrix<>, XprMatrix<>)
|
||||
* Note: operations are per se element wise
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME, OP) \
|
||||
template<class E1, int Rows, int Cols, \
|
||||
class E2> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \
|
||||
XprMatrix<E1, Rows, Cols>, \
|
||||
XprMatrix<E2, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const XprMatrix<E1, Rows, Cols>& lhs, \
|
||||
const XprMatrix<E2, Rows, Cols>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \
|
||||
XprMatrix<E1, Rows, Cols>, \
|
||||
XprMatrix<E2, Rows, Cols> \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>(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<E, Rows, Cols>, std::complex<>)
|
||||
* operator(std::complex<>, XprMatrix<E, Rows, Cols>)
|
||||
* Note: - per se element wise
|
||||
* - bit ops on complex<int> doesn't make sense, stay away
|
||||
* \todo type promotion
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME, OP) \
|
||||
template<class E, int Rows, int Cols, class T> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, std::complex<T> >, \
|
||||
XprMatrix<E, Rows, Cols>, \
|
||||
XprLiteral< std::complex<T> > \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const XprMatrix<E, Rows, Cols>& lhs, \
|
||||
const std::complex<T>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, std::complex<T> >, \
|
||||
XprMatrix<E, Rows, Cols>, \
|
||||
XprLiteral< std::complex<T> > \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>( \
|
||||
expr_type(lhs, XprLiteral< std::complex<T> >(rhs))); \
|
||||
} \
|
||||
\
|
||||
template<class E, int Rows, int Cols, class T> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<std::complex<T>, typename E::value_type>, \
|
||||
XprLiteral< std::complex<T> >, \
|
||||
XprMatrix<E, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const std::complex<T>& lhs, \
|
||||
const XprMatrix<E, Rows, Cols>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, typename E::value_type>, \
|
||||
XprLiteral< std::complex<T> >, \
|
||||
XprMatrix<E, Rows, Cols> \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>( \
|
||||
expr_type(XprLiteral< std::complex<T> >(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<E, Rows, Cols>, POD)
|
||||
* operator(POD, XprMatrix<E, Rows, Cols>)
|
||||
* Note: operations are per se element wise
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME, OP, TP) \
|
||||
template<class E, int Rows, int Cols> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, TP >, \
|
||||
XprMatrix<E, Rows, Cols>, \
|
||||
XprLiteral< TP > \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (const XprMatrix<E, Rows, Cols>& lhs, TP rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, TP >, \
|
||||
XprMatrix<E, Rows, Cols>, \
|
||||
XprLiteral< TP > \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>( \
|
||||
expr_type(lhs, XprLiteral< TP >(rhs))); \
|
||||
} \
|
||||
\
|
||||
template<class E, int Rows, int Cols> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<TP, typename E::value_type>, \
|
||||
XprLiteral< TP >, \
|
||||
XprMatrix<E, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
operator OP (TP lhs, const XprMatrix<E, Rows, Cols>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME< TP, typename E::value_type>, \
|
||||
XprLiteral< TP >, \
|
||||
XprMatrix<E, Rows, Cols> \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>( \
|
||||
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<E, Rows, Cols>& m) { \
|
||||
return XprMatrix<expr_type, Rows, Cols>(expr_type(m)); \
|
||||
}
|
||||
|
||||
TVMET_IMPLEMENT_MACRO(not, !)
|
||||
TVMET_IMPLEMENT_MACRO(compl, ~)
|
||||
TVMET_IMPLEMENT_MACRO(neg, -)
|
||||
|
||||
#undef TVMET_IMPLEMENT_MACRO
|
||||
|
@ -21,6 +21,8 @@
|
||||
* $Id: MatrixRow.h,v 1.14 2004/09/16 09:14:18 opetzold Exp $
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
@ -1,172 +0,0 @@
|
||||
/*
|
||||
* Tiny Vector Matrix Library
|
||||
* Dense Vector Matrix Libary of Tiny size using Expression Templates
|
||||
*
|
||||
* Copyright (C) 2001 - 2003 Olaf Petzold <opetzold@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id: 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<E, Rows, Cols>)
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME) \
|
||||
template<class E, int Rows, int Cols> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprUnOp< \
|
||||
Fcnl_##NAME<typename E::value_type>, \
|
||||
XprMatrix<E, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
NAME(const XprMatrix<E, Rows, Cols>& 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<E, Rows, Cols>)
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME) \
|
||||
template<class E, int Rows, int Cols> \
|
||||
inline \
|
||||
XprMatrix< \
|
||||
XprUnOp< \
|
||||
Fcnl_##NAME<typename E::value_type>, \
|
||||
XprMatrix<E, Rows, Cols> \
|
||||
>, \
|
||||
Rows, Cols \
|
||||
> \
|
||||
NAME(const XprMatrix<E, Rows, Cols>& rhs) { \
|
||||
typedef XprUnOp< \
|
||||
Fcnl_##NAME<typename E::value_type>, \
|
||||
XprMatrix<E, Rows, Cols> \
|
||||
> expr_type; \
|
||||
return XprMatrix<expr_type, Rows, Cols>(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:
|
@ -24,6 +24,8 @@
|
||||
#ifndef TVMET_XPR_MTMPRODUCT_H
|
||||
#define TVMET_XPR_MTMPRODUCT_H
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <tvmet/meta/Gemtm.h>
|
||||
#include <tvmet/loop/Gemtm.h>
|
||||
|
||||
@ -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<use_meta>(), m_lhs, m_rhs, i, j);
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
#ifndef TVMET_XPR_MTVPRODUCT_H
|
||||
#define TVMET_XPR_MTVPRODUCT_H
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <tvmet/meta/Gemtv.h>
|
||||
#include <tvmet/loop/Gemtv.h>
|
||||
|
||||
@ -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<use_meta>(), m_lhs, m_rhs, j);
|
||||
}
|
||||
|
||||
|
@ -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 <tvmet/xpr/VectorFunctions.h>
|
||||
#include <tvmet/xpr/VectorBinaryFunctions.h>
|
||||
#include <tvmet/xpr/VectorUnaryFunctions.h>
|
||||
#include <tvmet/xpr/VectorOperators.h>
|
||||
#include <tvmet/xpr/Eval.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<class E1, class E2, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \
|
||||
XprVector<E1, Sz>, \
|
||||
XprVector<E2, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const XprVector<E1, Sz>& lhs, \
|
||||
const XprVector<E2, Sz>& 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<T, Sz>, POD)
|
||||
* operator(POD, Vector<T, Sz>)
|
||||
* Note: operations are per se element_wise
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME, OP, TP) \
|
||||
template<class E, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, TP >, \
|
||||
XprVector<E, Sz>, \
|
||||
XprLiteral< TP > \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const XprVector<E, Sz>& lhs, \
|
||||
TP rhs) TVMET_CXX_ALWAYS_INLINE; \
|
||||
\
|
||||
template<class E, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<TP, typename E::value_type>, \
|
||||
XprLiteral< TP >, \
|
||||
XprVector<E, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (TP lhs, \
|
||||
const XprVector<E, Sz>& 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<std::complex<T>, Sz>, std::complex<T>)
|
||||
* operator(std::complex<T>, Vector<std::complex<T>, Sz>)
|
||||
* Note: - per se element wise
|
||||
* - bit ops on complex<int> doesn't make sense, stay away
|
||||
* \todo type promotion
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME, OP) \
|
||||
template<class E, int Sz, class T> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, std::complex<T> >, \
|
||||
XprVector<E, Sz>, \
|
||||
XprLiteral< std::complex<T> > \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const XprVector<E, Sz>& lhs, \
|
||||
const std::complex<T>& rhs) TVMET_CXX_ALWAYS_INLINE; \
|
||||
\
|
||||
template<class E, int Sz, class T> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<std::complex<T>, typename E::value_type>, \
|
||||
XprLiteral< std::complex<T> >, \
|
||||
XprVector<E, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const std::complex<T>& lhs, \
|
||||
const XprVector<E, 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)
|
||||
|
||||
|
||||
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
* global unary operators
|
||||
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
@ -391,8 +192,6 @@ XprVector< \
|
||||
> \
|
||||
operator OP (const XprVector<E, Sz>& 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<class E1, class E2, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \
|
||||
XprVector<E1, Sz>, \
|
||||
XprVector<E2, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const XprVector<E1, Sz>& lhs, \
|
||||
const XprVector<E2, Sz>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \
|
||||
XprVector<E1, Sz>, \
|
||||
XprVector<E2, Sz> \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>(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<T, Sz>, POD)
|
||||
* operator(POD, Vector<T, Sz>)
|
||||
* Note: operations are per se element_wise
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME, OP, TP) \
|
||||
template<class E, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, TP >, \
|
||||
XprVector<E, Sz>, \
|
||||
XprLiteral< TP > \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const XprVector<E, Sz>& lhs, TP rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, TP >, \
|
||||
XprVector<E, Sz>, \
|
||||
XprLiteral< TP > \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>( \
|
||||
expr_type(lhs, XprLiteral< TP >(rhs))); \
|
||||
} \
|
||||
\
|
||||
template<class E, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<TP, typename E::value_type>, \
|
||||
XprLiteral< TP >, \
|
||||
XprVector<E, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (TP lhs, const XprVector<E, Sz>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME< TP, typename E::value_type>, \
|
||||
XprLiteral< TP >, \
|
||||
XprVector<E, Sz> \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>( \
|
||||
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<std::complex<T>, Sz>, std::complex<T>)
|
||||
* operator(std::complex<T>, Vector<std::complex<T>, Sz>)
|
||||
* Note: - per se element wise
|
||||
* - bit ops on complex<int> doesn't make sense, stay away
|
||||
* \todo type promotion
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME, OP) \
|
||||
template<class E, int Sz, class T> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, std::complex<T> >, \
|
||||
XprVector<E, Sz>, \
|
||||
XprLiteral< std::complex<T> > \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const XprVector<E, Sz>& lhs, \
|
||||
const std::complex<T>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME<typename E::value_type, std::complex<T> >, \
|
||||
XprVector<E, Sz>, \
|
||||
XprLiteral< std::complex<T> > \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>( \
|
||||
expr_type(lhs, XprLiteral< std::complex<T> >(rhs))); \
|
||||
} \
|
||||
\
|
||||
template<class E, int Sz, class T> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprBinOp< \
|
||||
Fcnl_##NAME<std::complex<T>, typename E::value_type>, \
|
||||
XprLiteral< std::complex<T> >, \
|
||||
XprVector<E, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
operator OP (const std::complex<T>& lhs, \
|
||||
const XprVector<E, Sz>& rhs) { \
|
||||
typedef XprBinOp< \
|
||||
Fcnl_##NAME< std::complex<T>, typename E::value_type>, \
|
||||
XprLiteral< std::complex<T> >, \
|
||||
XprVector<E, Sz> \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>( \
|
||||
expr_type(XprLiteral< std::complex<T> >(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<E, Sz>& rhs) { \
|
||||
return XprVector<expr_type, Sz>(expr_type(rhs)); \
|
||||
}
|
||||
|
||||
TVMET_IMPLEMENT_MACRO(not, !)
|
||||
TVMET_IMPLEMENT_MACRO(compl, ~)
|
||||
TVMET_IMPLEMENT_MACRO(neg, -)
|
||||
|
||||
#undef TVMET_IMPLEMENT_MACRO
|
||||
|
@ -1,172 +0,0 @@
|
||||
/*
|
||||
* Tiny Vector Matrix Library
|
||||
* Dense Vector Matrix Libary of Tiny size using Expression Templates
|
||||
*
|
||||
* Copyright (C) 2001 - 2003 Olaf Petzold <opetzold@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id: 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<E, Sz>)
|
||||
*/
|
||||
#define TVMET_DECLARE_MACRO(NAME) \
|
||||
template<class E, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprUnOp< \
|
||||
Fcnl_##NAME<typename E::value_type>, \
|
||||
XprVector<E, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
NAME(const XprVector<E, Sz>& 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<E, Sz>)
|
||||
*/
|
||||
#define TVMET_IMPLEMENT_MACRO(NAME) \
|
||||
template<class E, int Sz> \
|
||||
inline \
|
||||
XprVector< \
|
||||
XprUnOp< \
|
||||
Fcnl_##NAME<typename E::value_type>, \
|
||||
XprVector<E, Sz> \
|
||||
>, \
|
||||
Sz \
|
||||
> \
|
||||
NAME(const XprVector<E, Sz>& rhs) { \
|
||||
typedef XprUnOp< \
|
||||
Fcnl_##NAME<typename E::value_type>, \
|
||||
XprVector<E, Sz> \
|
||||
> expr_type; \
|
||||
return XprVector<expr_type, Sz>(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:
|
Loading…
x
Reference in New Issue
Block a user