diff options
Diffstat (limited to 'tvmet-1.7.1/include/tvmet')
67 files changed, 0 insertions, 12839 deletions
diff --git a/tvmet-1.7.1/include/tvmet/AliasProxy.h b/tvmet-1.7.1/include/tvmet/AliasProxy.h deleted file mode 100644 index ff6fa5c4b..000000000 --- a/tvmet-1.7.1/include/tvmet/AliasProxy.h +++ /dev/null @@ -1,127 +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: AliasProxy.h,v 1.4 2004/06/10 16:36:55 opetzold Exp $ - */ - -#ifndef TVMET_ALIAS_PROXY_H -#define TVMET_ALIAS_PROXY_H - -namespace tvmet { - - -/** forwards */ -template<class E> class AliasProxy; - - -/** - * \brief Simplify syntax for alias Matrices and Vectors, - * where aliasing left hand values appear in the - * expression. - * \par Example: - * \code - * typedef tvmet::Matrix<double, 10, 10> matrix_type; - * matrix_type m; - * ... - * alias(m) += trans(m); - * \endcode - * \sa AliasProxy - * \sa Some Notes \ref alias - */ -template<class E> -AliasProxy<E> alias(E& expr) { return AliasProxy<E>(expr); } - - -/** - * \class AliasProxy AliasProxy.h "tvmet/AliasProxy.h" - * \brief Assign proxy for alias Matrices and Vectors. - * - * A short lived object to provide simplified alias syntax. - * Only the friend function alias is allowed to create - * such a object. The proxy calls the appropriate member - * alias_xyz() which have to use temporaries to avoid - * overlapping memory regions. - * \sa alias - * \sa Some Notes \ref alias - * \note Thanks to ublas-dev group, where the principle idea - * comes from. - */ -template<class E> -class AliasProxy -{ - AliasProxy(const AliasProxy&); - AliasProxy& operator=(const AliasProxy&); - - friend AliasProxy<E> alias<>(E& expr); - -public: - AliasProxy(E& expr) : m_expr(expr) { } - - - template<class E2> - E& operator=(const E2& expr) { - return m_expr.alias_assign(expr); - } - - template<class E2> - E& operator+=(const E2& expr) { - return m_expr.alias_add_eq(expr); - } - - template<class E2> - E& operator-=(const E2& expr) { - return m_expr.alias_sub_eq(expr); - } - - template<class E2> - E& operator*=(const E2& expr) { - return m_expr.alias_mul_eq(expr); - } - - template<class E2> - E& operator/=(const E2& expr) { - return m_expr.alias_div_eq(expr); - } - -private: - E& m_expr; -}; - - -#if 0 -namespace element_wise { -// \todo to write -template<class E, class E2> -E& operator/=(AliasProxy<E>& proxy, const E2& rhs) { - return proxy.div_upd(rhs); -} - -} -#endif - - -} // namespace tvmet - - -#endif /* TVMET_ALIAS_PROXY_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/BinaryFunctionals.h b/tvmet-1.7.1/include/tvmet/BinaryFunctionals.h deleted file mode 100644 index b09cf9045..000000000 --- a/tvmet-1.7.1/include/tvmet/BinaryFunctionals.h +++ /dev/null @@ -1,178 +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: BinaryFunctionals.h,v 1.19 2004/10/04 11:40:46 opetzold Exp $ - */ - -#ifndef TVMET_BINARY_FUNCTIONAL_H -#define TVMET_BINARY_FUNCTIONAL_H - -namespace tvmet { - -/** - * \class Fcnl_assign BinaryFunctionals.h "tvmet/BinaryFunctionals.h" - * \brief Binary operator for assign operations. - * - * Unfortunally we have sometimes to cast on assign operations e.g., - * on assign on different POD. So we avoid warnings. - */ -template <class T1, class T2> -struct Fcnl_assign : public BinaryFunctional { - static inline - void apply_on(T1& _tvmet_restrict lhs, T2 rhs) { - lhs = static_cast<T1>(rhs); - } - - static - void print_xpr(std::ostream& os, int l=0) { - os << IndentLevel(l) << "fcnl_assign<T1=" - << typeid(T1).name() << ", T2=" << typeid(T2).name() << ">," - << std::endl; - } -}; - - -/** \class Fcnl_add_eq BinaryFunctionals.h "tvmet/BinaryFunctionals.h" */ -/** \class Fcnl_sub_eq BinaryFunctionals.h "tvmet/BinaryFunctionals.h" */ -/** \class Fcnl_mul_eq BinaryFunctionals.h "tvmet/BinaryFunctionals.h" */ -/** \class Fcnl_div_eq BinaryFunctionals.h "tvmet/BinaryFunctionals.h" */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template <class T1, class T2> \ -struct Fcnl_##NAME : public BinaryFunctional { \ - typedef void value_type; \ - \ - static inline \ - void apply_on(T1& _tvmet_restrict lhs, T2 rhs) { \ - lhs OP rhs; \ - } \ - \ - static \ - void print_xpr(std::ostream& os, int l=0) { \ - os << IndentLevel(l) \ - << "Fcnl_" << #NAME << "<T1=" \ - << typeid(T1).name() << ", T2=" << typeid(T2).name() << ">," \ - << std::endl; \ - } \ -}; - -TVMET_IMPLEMENT_MACRO(add_eq, +=) -TVMET_IMPLEMENT_MACRO(sub_eq, -=) -TVMET_IMPLEMENT_MACRO(mul_eq, *=) -TVMET_IMPLEMENT_MACRO(div_eq, /=) - -#undef TVMET_IMPLEMENT_MACRO - - -/** \class Fcnl_add BinaryFunctionals.h "tvmet/BinaryFunctionals.h" */ -/** \class Fcnl_sub BinaryFunctionals.h "tvmet/BinaryFunctionals.h" */ -/** \class Fcnl_mul BinaryFunctionals.h "tvmet/BinaryFunctionals.h" */ -/** \class Fcnl_div BinaryFunctionals.h "tvmet/BinaryFunctionals.h" */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template <class T1, class T2> \ -struct Fcnl_##NAME : public BinaryFunctional { \ - typedef typename PromoteTraits<T1, T2>::value_type value_type; \ - \ - static inline \ - value_type apply_on(T1 lhs, T2 rhs) { \ - return lhs OP rhs; \ - } \ - \ - static \ - void print_xpr(std::ostream& os, int l=0) { \ - os << IndentLevel(l) \ - << "Fcnl_" << #NAME << "<T1=" \ - << typeid(T1).name() << ", T2=" << typeid(T2).name() << ">," \ - << std::endl; \ - } \ -}; - -TVMET_IMPLEMENT_MACRO(add, +) -TVMET_IMPLEMENT_MACRO(sub, -) -TVMET_IMPLEMENT_MACRO(mul, *) -TVMET_IMPLEMENT_MACRO(div, /) - -#undef TVMET_IMPLEMENT_MACRO - -#if defined(EIGEN_USE_COMPLEX) -/** - * \class Fcnl_polar BinaryFunctionals.h "tvmet/BinaryFunctionals.h" - * \brief %Functional for polar. - */ -template <class T1, class T2> struct Fcnl_polar : public BinaryFunctional { }; - - -/** - * \class Fcnl_polar<T,T> BinaryFunctionals.h "tvmet/BinaryFunctionals.h" - * \brief %Functional for polar. - * \note This functional is partialy specialized due to the declaration - * of %polar in namespace std <tt>complex<T> polar(T, T)</tt>. - * This means especially that type promotion isn't avaible here. - */ -template <class T> -struct Fcnl_polar<T,T> : public BinaryFunctional { - typedef std::complex<T> value_type; - - static inline - value_type apply_on(T lhs, T rhs) { - return std::polar(lhs, rhs); - } - - static - void print_xpr(std::ostream& os, int l=0) { - os << IndentLevel(l) << "Fcnl_polar<T1=" - << typeid(T).name() << ", T2=" << typeid(T).name() << ">," - << std::endl; - } -}; -#endif // defined(EIGEN_USE_COMPLEX) - - -/** - * \class Fcnl_swap BinaryFunctionals.h "tvmet/BinaryFunctionals.h" - * \brief Binary operator for swapping values using temporaries. - * \todo check for std::swap implementation; todo before LUdecomp - */ -template <class T1, class T2> -struct Fcnl_swap : public BinaryFunctional { - static inline - void apply_on(T1& _tvmet_restrict lhs, T2& _tvmet_restrict rhs) { - typedef typename PromoteTraits<T1, T2>::value_type temp_type; - - temp_type temp(lhs); - lhs = static_cast<T1>(rhs); - rhs = static_cast<T2>(temp); - } - - static - void print_xpr(std::ostream& os, int l=0) { - os << IndentLevel(l) << "Fcnl_swap<T1=" - << typeid(T1).name() << ", T2" << typeid(T2).name() << ">," - << std::endl; - } -}; - - -} // namespace tvmet - -#endif // TVMET_BINARY_FUNCTIONAL_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/CMakeLists.txt b/tvmet-1.7.1/include/tvmet/CMakeLists.txt deleted file mode 100644 index fb75aac19..000000000 --- a/tvmet-1.7.1/include/tvmet/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -INCLUDE (CheckIncludeFiles) -INCLUDE (CheckRestrictKeyword) -INCLUDE (CheckAlwaysInline) - -FILE(GLOB tvmet_header_SRCS "*.h") - -CHECK_INCLUDE_FILES (sys/time.h TVMET_HAVE_SYS_TIME_H) -CHECK_INCLUDE_FILES (unistd.h TVMET_HAVE_UNISTD_H) -CHECK_RESTRICT_KEYWORD (TVMET_RESTRICT_KEYWORD) -CHECK_ALWAYS_INLINE (TVMET_ALWAYS_INLINE) - -# the following are directories where stuff will be installed to -SET(INCLUDE_INSTALL_DIR - "${CMAKE_INSTALL_PREFIX}/include/tvmet" - CACHE PATH - "The subdirectory to the header prefix" - FORCE) - -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake - ${INCLUDE_INSTALL_DIR}/config.h) - -INSTALL(FILES - ${tvmet_header_SRCS} - DESTINATION ${INCLUDE_INSTALL_DIR} - ) - -ADD_SUBDIRECTORY(loop) -ADD_SUBDIRECTORY(meta) -ADD_SUBDIRECTORY(xpr) -ADD_SUBDIRECTORY(util)
\ No newline at end of file diff --git a/tvmet-1.7.1/include/tvmet/CommaInitializer.h b/tvmet-1.7.1/include/tvmet/CommaInitializer.h deleted file mode 100644 index 6ec605c3b..000000000 --- a/tvmet-1.7.1/include/tvmet/CommaInitializer.h +++ /dev/null @@ -1,130 +0,0 @@ -/* This file is part of Eigen, a C++ template library for linear algebra - * Copyright (C) 2007 Benoit Jacob <jacob@math.jussieu.fr> - * - * Based on Tvmet source code, http://tvmet.sourceforge.net, - * Copyright (C) 2001 - 2003 Olaf Petzold <opetzold@users.sourceforge.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id: CommaInitializer.h,v 1.14 2005/03/02 12:14:22 opetzold Exp $ - */ - -#ifndef TVMET_COMMA_INITIALIZER_H -#define TVMET_COMMA_INITIALIZER_H - -#include <tvmet/CompileTimeError.h> - -namespace tvmet { - -/** - * \class CommaInitializer CommaInitializer.h "tvmet/CommaInitializer.h" - * \brief Initialize classes using a comma separated lists. - * - * The comma operator is called when it appears next to an object of - * the type the comma is defined for. However, "operator," is not called - * for function argument lists, only for objects that are out in the open, - * separated by commas (Thinking C++ - * <a href=http://www.ida.liu.se/~TDDA14/online/v1ticpp/Chapter12.html> - * Ch.12: Operator comma</a>). - * - * This implementation uses the same technique as described in Todd Veldhuizen - * Techniques for Scientific C++ - * <a href=http://extreme.indiana.edu/~tveldhui/papers/techniques/techniques01.html#l43> - * chapter 1.11 Comma overloading</a>. - * - * The initializer list is avaible after instanciation of the object, - * therefore use it like: - * \code - * vector3d t; - * t = 1.0, 2.0, 3.0; - * \endcode - * It's evaluated to (((t = 1.0), 2.0), 3.0) - * - * For matrizes the initilization is done row wise. - * - * If the comma separted list of values longer then the size of the vector - * or matrix a compile time error will occour. Otherwise the pending values - * will be written random into the memory. - * - */ -template<typename Obj, int LEN> -class CommaInitializer -{ - typedef typename Obj::value_type value_type; - - /** - * \class Initializer - * \brief Helper fo recursive overloaded comma operator. - */ - template<int N> class Initializer - { - Initializer(); - Initializer& operator=(const Initializer&); - - public: - Initializer(Obj& obj, int index) : m_obj(obj), m_index(index) {} - - /** Overloads the comma operator for recursive assign values from comma - separated list. */ - Initializer<N+1> operator,(value_type rhs) - { - TVMET_CT_CONDITION(N < LEN, CommaInitializerList_is_too_long) - m_obj.commaWrite(m_index, rhs); - return Initializer<N+1>(m_obj, m_index+1); - } - - private: - Obj& m_obj; - int m_index; - }; - -public: - CommaInitializer(const CommaInitializer& rhs) - : m_object(rhs.m_object), - m_data(rhs.m_data) - {} - - /** Constructor used by Vector or Matrix operator(value_type rhs) */ - CommaInitializer(Obj& obj, value_type x) - : m_object(obj), - m_data(x) - {} - - /** Destructor, does nothing. */ - ~CommaInitializer() {} - - /** Overloaded comma operator, called only once for the first occoured comma. This - means the first value is assigned by %operator=() and the 2nd value after the - comma. Therefore we call the %Initializer::operator,() for the list starting - after the 2nd. */ - Initializer<2> operator,(value_type rhs) - { - m_object.commaWrite(0, m_data); - m_object.commaWrite(1, rhs); - return Initializer<2>(m_object, 2); - } - -private: - Obj& m_object; - value_type m_data; -}; - -} // namespace tvmet - -#endif // TVMET_COMMA_INITIALIZER_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/CompileTimeError.h b/tvmet-1.7.1/include/tvmet/CompileTimeError.h deleted file mode 100644 index 9be1bb12a..000000000 --- a/tvmet-1.7.1/include/tvmet/CompileTimeError.h +++ /dev/null @@ -1,59 +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: CompileTimeError.h,v 1.7 2003/11/30 08:26:25 opetzold Exp $ - */ - -#ifndef TVMET_COMPILE_TIME_ERROR_H -#define TVMET_COMPILE_TIME_ERROR_H - -namespace tvmet { - -/** - * \class CompileTimeError CompileTimeError.h "tvmet/CompileTimeError.h" - * \brief Compile Time Assertation classes. - */ -template<bool> struct CompileTimeError; - -/** - * \class CompileTimeError<true> CompileTimeError.h "tvmet/CompileTimeError.h" - * \brief Specialized Compile Time Assertation for successfully condition. - * This results in a compiler pass. - */ -template<> struct CompileTimeError<true> { }; - - -/** - * \def TVMET_CT_CONDITION(XPR, MSG) - * \brief Simplify the Compile Time Assertation by using an expression - * Xpr and an error message MSG. - */ -#define TVMET_CT_CONDITION(XPR, MSG) { \ - CompileTimeError<(XPR)> tvmet_ERROR_##MSG; \ - (void)tvmet_ERROR_##MSG; \ -} - -} // namespace tvmet - -#endif // TVMET_COMPILE_TIME_ERROR_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/Extremum.h b/tvmet-1.7.1/include/tvmet/Extremum.h deleted file mode 100644 index f0b5f05ea..000000000 --- a/tvmet-1.7.1/include/tvmet/Extremum.h +++ /dev/null @@ -1,107 +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: Extremum.h,v 1.6 2003/11/30 08:26:25 opetzold Exp $ - */ - -#ifndef TVMET_EXTREMUM_H -#define TVMET_EXTREMUM_H - -namespace tvmet { - - -/** - * \class matrix_tag Extremum.h "tvmet/Extremum.h" - * \brief For use with Extremum to simplify max handling. - * This allows the min/max functions to return an Extremum object. - */ -struct matrix_tag { }; - - -/** - * \class vector_tag Extremum.h "tvmet/Extremum.h" - * \brief For use with Extremum to simplify max handling. - * This allows the min/max functions to return an Extremum object. - */ -struct vector_tag { }; - - -/** - * \class Extremum Extremum.h "tvmet/Extremum.h" - * \brief Generell class for storing extremums determined by min/max. - */ -template<class T1, class T2, class Tag> -class Extremum { }; - - -/** - * \class Extremum<T1, T2, vector_tag> Extremum.h "tvmet/Extremum.h" - * \brief Partial specialzed for vectors to store extremums by value and index. - */ -template<class T1, class T2> -class Extremum<T1, T2, vector_tag> -{ -public: - typedef T1 value_type; - typedef T2 index_type; - -public: - Extremum(value_type value, index_type index) - : m_value(value), m_index(index) { } - value_type value() const { return m_value; } - index_type index() const { return m_index; } - -private: - value_type m_value; - index_type m_index; -}; - - -/** - * \class Extremum<T1, T2, matrix_tag> Extremum.h "tvmet/Extremum.h" - * \brief Partial specialzed for matrix to store extremums by value, row and column. - */ -template<class T1, class T2> -class Extremum<T1, T2, matrix_tag> -{ -public: - typedef T1 value_type; - typedef T2 index_type; - -public: - Extremum(value_type value, index_type row, index_type col) - : m_value(value), m_row(row), m_col(col) { } - value_type value() const { return m_value; } - index_type row() const { return m_row; } - index_type col() const { return m_col; } - -private: - value_type m_value; - index_type m_row, m_col; -}; - - -} // namespace tvmet - -#endif // TVMET_EXTREMUM_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/Functional.h b/tvmet-1.7.1/include/tvmet/Functional.h deleted file mode 100644 index 3aa7579d2..000000000 --- a/tvmet-1.7.1/include/tvmet/Functional.h +++ /dev/null @@ -1,87 +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: Functional.h,v 1.7 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_FUNCTIONAL_H -#define TVMET_FUNCTIONAL_H - -#include <tvmet/TypePromotion.h> - -namespace tvmet { - - -/** - * \class Functional Functional.h "tvmet/Functional.h" - * \brief Base class for all binary und unary functionals. - * - * All functional operators and functions have a static apply - * member function for evaluating the expressions inside. - */ -struct Functional { }; - - -/** - * \class BinaryFunctional Functional.h "tvmet/Functional.h" - * \brief Base class for all binary functions. - * \note Used for collecting classes for doxygen. - */ -struct BinaryFunctional : public Functional { }; - - -/** - * \class UnaryFunctional Functional.h "tvmet/Functional.h" - * \brief Base class for all unary functions. - * \note Used for collecting classes for doxygen. - */ -struct UnaryFunctional : public Functional { }; - - -/* - * some macro magic need below - */ - -/** - * \def TVMET_STD_SCOPE(x) - * \brief Simple macro to allow using macros for namespace std functions. - */ -#define TVMET_STD_SCOPE(x) std::x - - -/** - * \def TVMET_GLOBAL_SCOPE(x) - * \brief Simple macro to allow using macros for global namespace functions. - */ -#define TVMET_GLOBAL_SCOPE(x) ::x - - -} // namespace tvmet - - -#include <tvmet/BinaryFunctionals.h> -#include <tvmet/UnaryFunctionals.h> - - -#endif // TVMET_FUNCTIONAL_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/Matrix.h b/tvmet-1.7.1/include/tvmet/Matrix.h deleted file mode 100644 index 070bc0c14..000000000 --- a/tvmet-1.7.1/include/tvmet/Matrix.h +++ /dev/null @@ -1,306 +0,0 @@ -/* This file is part of Eigen, a C++ template library for linear algebra - * Copyright (C) 2007 Benoit Jacob <jacob@math.jussieu.fr> - * - * Based on Tvmet source code, http://tvmet.sourceforge.net, - * Copyright (C) 2001 - 2003 Olaf Petzold <opetzold@users.sourceforge.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * lesser General Public License for more details. - * - * You should have received a copy of the GNU lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id: Matrix.h,v 1.54 2005/03/02 12:12:51 opetzold Exp $ - */ - -#ifndef TVMET_MATRIX_H -#define TVMET_MATRIX_H - -#include <iterator> // reverse_iterator -#include <cassert> - -#include <tvmet/tvmet.h> -#include <tvmet/TypePromotion.h> -#include <tvmet/CommaInitializer.h> - -#include <tvmet/xpr/Matrix.h> -#include <tvmet/xpr/MatrixRow.h> -#include <tvmet/xpr/MatrixCol.h> -#include <tvmet/xpr/MatrixDiag.h> - -namespace tvmet { - -/* forwards */ -template<class T, int Rows, int Cols> class Matrix; - -/** - * \class MatrixConstRef Matrix.h "tvmet/Matrix.h" - * \brief value iterator for ET - */ -template<class T, int Rows, int Cols> -class MatrixConstRef - : public TvmetBase < MatrixConstRef<T, Rows, Cols> > -{ - -public: - /** Complexity counter. */ - enum { - ops = Rows * Cols - }; - typedef T value_type; - -private: - MatrixConstRef(); - MatrixConstRef& operator=(const MatrixConstRef&); - -public: - /** Constructor. */ - explicit MatrixConstRef(const Matrix<T, Rows, Cols>& rhs) - : m_array(rhs.array()) - { } - - /** Constructor by a given memory pointer. */ - explicit MatrixConstRef(const T* data) - : m_array(data) - { } - - /** access by index. */ - T operator()(int i, int j) const { - assert(i >= 0 && j >= 0 && i < Rows && j < Cols); - return m_array[i + j * Rows]; - } - - /** debugging Xpr parse tree */ - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l) - << "MatrixConstRef[O=" << ops << "]<" - << "T=" << typeid(T).name() << ">," - << std::endl; - } - -private: - const T* _tvmet_restrict m_array; -}; - - -/** - * \class Matrix Matrix.h "tvmet/Matrix.h" - * \brief A tiny matrix class. - * - * The array syntax A[j][j] isn't supported here. The reason is that - * operator[] always takes exactly one parameter, but operator() can - * take any number of parameters (in the case of a rectangular matrix, - * two paramters are needed). Therefore the cleanest way to do it is - * with operator() rather than with operator[]. \see C++ FAQ Lite 13.8 - */ -template<class T, int Rows, int Cols> -class Matrix -{ -public: - - typedef T value_type; - - /** Complexity counter. */ - enum { - ops_assign = Rows * Cols, - ops = ops_assign, - use_meta = ops < TVMET_COMPLEXITY_M_ASSIGN_TRIGGER ? true : false - }; - - /** The number of rows of the matrix. */ - static int rows() { return Rows; } - - /** The number of columns of the matrix. */ - static int cols() { return Cols; } - -public: - /** Default Destructor. Does nothing. */ - ~Matrix() {} - - /** Default Constructor. Does nothing. The matrix entries are not initialized. */ - explicit Matrix() {} - - /** Copy Constructor, not explicit! */ - Matrix(const Matrix& rhs) - { - *this = XprMatrix<ConstRef, Rows, Cols>(rhs.constRef()); - } - - explicit Matrix(const value_type* array) - { - for(int i = 0; i < Rows * Cols; i++) m_array[i] = array[i]; - } - - /** Construct a matrix by expression. */ - template<class E> - explicit Matrix(const XprMatrix<E, Rows, Cols>& e) - { - *this = e; - } - - /** assign a T on array, this can be used for a single value - or a comma separeted list of values. */ - CommaInitializer<Matrix, Rows * Cols> operator=(T rhs) { - return CommaInitializer<Matrix, Rows * Cols>(*this, rhs); - } - -public: // access operators - T* _tvmet_restrict array() { return m_array; } - const T* _tvmet_restrict array() const { return m_array; } - -public: // index access operators - T& _tvmet_restrict operator()(int i, int j) { - // Note: g++-2.95.3 does have problems on typedef reference - assert(i >= 0 && j >= 0 && i < Rows && j < Cols); - return m_array[i + j * Rows]; - } - - const T& operator()(int i, int j) const { - assert(i >= 0 && j >= 0 && i < Rows && j < Cols); - return m_array[i + j * Rows]; - } - -public: // ET interface - typedef MatrixConstRef<T, Rows, Cols> ConstRef; - - /** Return a const Reference of the internal data */ - ConstRef constRef() const { return ConstRef(*this); } - - /** Return the matrix as const expression. */ - XprMatrix<ConstRef, Rows, Cols> expr() const { - return XprMatrix<ConstRef, Rows, Cols>(this->constRef()); - } - -private: - /** Wrapper for meta assign. */ - template<class Dest, class Src, class Assign> - static inline - void do_assign(dispatch<true>, Dest& dest, const Src& src, const Assign& assign_fn) { - meta::Matrix<Rows, Cols, 0, 0>::assign(dest, src, assign_fn); - } - - /** Wrapper for loop assign. */ - template<class Dest, class Src, class Assign> - static inline - void do_assign(dispatch<false>, Dest& dest, const Src& src, const Assign& assign_fn) { - loop::Matrix<Rows, Cols>::assign(dest, src, assign_fn); - } - - /** assign *this to a matrix of a different type T2 using - the functional assign_fn. */ - template<class T2, class Assign> - void assign_to(Matrix<T2, Rows, Cols>& dest, const Assign& assign_fn) const { - do_assign(dispatch<use_meta>(), dest, *this, assign_fn); - } - -public: // assign operations - /** assign a given matrix of a different type T2 element wise - to this matrix. The operator=(const Matrix&) is compiler - generated. */ - template<class T2> - Matrix& operator=(const Matrix<T2, Rows, Cols>& rhs) { - rhs.assign_to(*this, Fcnl_assign<T, T2>()); - return *this; - } - - /** assign a given XprMatrix element wise to this matrix. */ - template <class E> - Matrix& operator=(const XprMatrix<E, Rows, Cols>& rhs) { - rhs.assign_to(*this, Fcnl_assign<T, typename E::value_type>()); - return *this; - } - -private: - template<class Obj, int LEN> friend class CommaInitializer; - - void commaWrite(int index, T rhs) - { - m_array[(index / Cols) + (index % Cols) * Rows] = rhs; - } - -public: // math operators with scalars - Matrix& operator+=(T) _tvmet_always_inline; - Matrix& operator-=(T) _tvmet_always_inline; - Matrix& operator*=(T) _tvmet_always_inline; - Matrix& operator/=(T) _tvmet_always_inline; - - template <class T2> Matrix& M_add_eq(const Matrix<T2, Rows, Cols>&) _tvmet_always_inline; - template <class T2> Matrix& M_sub_eq(const Matrix<T2, Rows, Cols>&) _tvmet_always_inline; - template <class T2> Matrix& M_mul_eq(const Matrix<T2, Rows, Cols>&) _tvmet_always_inline; - template <class T2> Matrix& M_div_eq(const Matrix<T2, Rows, Cols>&) _tvmet_always_inline; - -public: // math operators with expressions - template <class E> Matrix& M_add_eq(const XprMatrix<E, Rows, Cols>&) _tvmet_always_inline; - template <class E> Matrix& M_sub_eq(const XprMatrix<E, Rows, Cols>&) _tvmet_always_inline; - template <class E> Matrix& M_mul_eq(const XprMatrix<E, Rows, Cols>&) _tvmet_always_inline; - template <class E> Matrix& M_div_eq(const XprMatrix<E, Rows, Cols>&) _tvmet_always_inline; - -public: // aliased math operators with expressions - template <class T2> Matrix& alias_assign(const Matrix<T2, Rows, Cols>&) _tvmet_always_inline; - template <class T2> Matrix& alias_add_eq(const Matrix<T2, Rows, Cols>&) _tvmet_always_inline; - template <class T2> Matrix& alias_sub_eq(const Matrix<T2, Rows, Cols>&) _tvmet_always_inline; - template <class T2> Matrix& alias_mul_eq(const Matrix<T2, Rows, Cols>&) _tvmet_always_inline; - template <class T2> Matrix& alias_div_eq(const Matrix<T2, Rows, Cols>&) _tvmet_always_inline; - - template <class E> Matrix& alias_assign(const XprMatrix<E, Rows, Cols>&) _tvmet_always_inline; - template <class E> Matrix& alias_add_eq(const XprMatrix<E, Rows, Cols>&) _tvmet_always_inline; - template <class E> Matrix& alias_sub_eq(const XprMatrix<E, Rows, Cols>&) _tvmet_always_inline; - template <class E> Matrix& alias_mul_eq(const XprMatrix<E, Rows, Cols>&) _tvmet_always_inline; - template <class E> Matrix& alias_div_eq(const XprMatrix<E, Rows, Cols>&) _tvmet_always_inline; - -public: // io - /** Structure for info printing as Matrix<T, Rows, Cols>. */ - struct Info : public TvmetBase<Info> { - std::ostream& print_xpr(std::ostream& os) const { - os << "Matrix<T=" << typeid(T).name() - << ", R=" << Rows << ", C=" << Cols << ">"; - return os; - } - }; - - /** Get an info object of this matrix. */ - static Info info() { return Info(); } - - /** Member function for expression level printing. */ - std::ostream& print_xpr(std::ostream& os, int l=0) const; - - /** Member function for printing internal data. */ - std::ostream& print_on(std::ostream& os) const; - -private: - /** The data of matrix self. */ - T m_array[Rows * Cols]; -}; - -typedef Matrix<int, 2, 2> Matrix2i; -typedef Matrix<int, 3, 3> Matrix3i; -typedef Matrix<int, 4, 4> Matrix4i; -typedef Matrix<float, 2, 2> Matrix2f; -typedef Matrix<float, 3, 3> Matrix3f; -typedef Matrix<float, 4, 4> Matrix4f; -typedef Matrix<double, 2, 2> Matrix2d; -typedef Matrix<double, 3, 3> Matrix3d; -typedef Matrix<double, 4, 4> Matrix4d; - -} // namespace tvmet - -#include <tvmet/MatrixImpl.h> -#include <tvmet/MatrixFunctions.h> -#include <tvmet/MatrixUnaryFunctions.h> -#include <tvmet/MatrixOperators.h> -#include <tvmet/MatrixEval.h> -#include <tvmet/AliasProxy.h> - -#endif // TVMET_MATRIX_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/MatrixEval.h b/tvmet-1.7.1/include/tvmet/MatrixEval.h deleted file mode 100644 index fa382a8ba..000000000 --- a/tvmet-1.7.1/include/tvmet/MatrixEval.h +++ /dev/null @@ -1,322 +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: MatrixEval.h,v 1.14 2004/06/10 16:36:55 opetzold Exp $ - */ - -#ifndef TVMET_MATRIX_EVAL_H -#define TVMET_MATRIX_EVAL_H - -namespace tvmet { - -/** - * \fn eval(const XprMatrix<E1, Rows, Cols>& e1, const Matrix<T2, Rows, Cols>& m2, const Matrix<T3, Rows, Cols>& m3) - * \brief Evals the matrix expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E1, class T2, class T3, int Rows, int Cols> -inline -XprMatrix< - XprEval< - XprMatrix<E1, Rows, Cols>, - MatrixConstRef<T2, Rows, Cols>, - MatrixConstRef<T3, Rows, Cols> - >, - Rows, Cols -> -eval(const XprMatrix<E1, Rows, Cols>& e1, - const Matrix<T2, Rows, Cols>& m2, - const Matrix<T3, Rows, Cols>& m3) { - typedef XprEval< - XprMatrix<E1, Rows, Cols>, - MatrixConstRef<T2, Rows, Cols>, - MatrixConstRef<T3, Rows, Cols> - > expr_type; - return XprMatrix<expr_type, Rows, Cols>( - expr_type(e1, m2.constRef(), m3.constRef())); -} - - -/** - * \fn eval(const XprMatrix<E1, Rows, Cols>& e1, const Matrix<T2, Rows, Cols>& m2, const XprMatrix<E3, Rows, Cols>& e3) - * \brief Evals the matrix expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E1, class T2, class E3, int Rows, int Cols> -inline -XprMatrix< - XprEval< - XprMatrix<E1, Rows, Cols>, - MatrixConstRef<T2, Rows, Cols>, - XprMatrix<E3, Rows, Cols> - >, - Rows, Cols -> -eval(const XprMatrix<E1, Rows, Cols>& e1, - const Matrix<T2, Rows, Cols>& m2, - const XprMatrix<E3, Rows, Cols>& e3) { - typedef XprEval< - XprMatrix<E1, Rows, Cols>, - MatrixConstRef<T2, Rows, Cols>, - XprMatrix<E3, Rows, Cols> - > expr_type; - return XprMatrix<expr_type, Rows, Cols>( - expr_type(e1, m2.constRef(), e3)); -} - - -/** - * \fn eval(const XprMatrix<E1, Rows, Cols>& e1, const XprMatrix<E2, Rows, Cols>& e2, const Matrix<T3, Rows, Cols>& m3) - * \brief Evals the matrix expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E1, class E2, class T3, int Rows, int Cols> -inline -XprMatrix< - XprEval< - XprMatrix<E1, Rows, Cols>, - XprMatrix<E2, Rows, Cols>, - MatrixConstRef<T3, Rows, Cols> - >, - Rows, Cols -> -eval(const XprMatrix<E1, Rows, Cols>& e1, - const XprMatrix<E2, Rows, Cols>& e2, - const Matrix<T3, Rows, Cols>& m3) { - typedef XprEval< - XprMatrix<E1, Rows, Cols>, - XprMatrix<E2, Rows, Cols>, - MatrixConstRef<T3, Rows, Cols> - > expr_type; - return XprMatrix<expr_type, Rows, Cols>( - expr_type(e1, e2, m3.constRef())); -} - - -/** - * \fn eval(const XprMatrix<E1, Rows, Cols>& e1, const XprMatrix<E2, Rows, Cols>& e2, const XprMatrix<E3, Rows, Cols>& e3) - * \brief Evals the matrix expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E1, class E2, class E3, int Rows, int Cols> -inline -XprMatrix< - XprEval< - XprMatrix<E1, Rows, Cols>, - XprMatrix<E2, Rows, Cols>, - XprMatrix<E3, Rows, Cols> - >, - Rows, Cols -> -eval(const XprMatrix<E1, Rows, Cols>& e1, - const XprMatrix<E2, Rows, Cols>& e2, - const XprMatrix<E3, Rows, Cols>& e3) { - typedef XprEval< - XprMatrix<E1, Rows, Cols>, - XprMatrix<E2, Rows, Cols>, - XprMatrix<E3, Rows, Cols> - > expr_type; - return XprMatrix<expr_type, Rows, Cols>(expr_type(e1, e2, e3)); -} - - -/* - * trinary evaluation functions with matrizes, xpr of and POD - * - * XprMatrix<E, Rows, Cols> ? POD1 : POD2 - * XprMatrix<E1, Rows, Cols> ? POD : XprMatrix<E3, Rows, Cols> - * XprMatrix<E1, Rows, Cols> ? XprMatrix<E2, Rows, Cols> : POD - */ -#define TVMET_IMPLEMENT_MACRO(POD) \ -template<class E, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprEval< \ - XprMatrix<E, Rows, Cols>, \ - XprLiteral< POD >, \ - XprLiteral< POD > \ - >, \ - Rows, Cols \ -> \ -eval(const XprMatrix<E, Rows, Cols>& e, POD x2, POD x3) { \ - typedef XprEval< \ - XprMatrix<E, Rows, Cols>, \ - XprLiteral< POD >, \ - XprLiteral< POD > \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>( \ - expr_type(e, XprLiteral< POD >(x2), XprLiteral< POD >(x3))); \ -} \ - \ -template<class E1, class E3, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprEval< \ - XprMatrix<E1, Rows, Cols>, \ - XprLiteral< POD >, \ - XprMatrix<E3, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -eval(const XprMatrix<E1, Rows, Cols>& e1, POD x2, const XprMatrix<E3, Rows, Cols>& e3) { \ - typedef XprEval< \ - XprMatrix<E1, Rows, Cols>, \ - XprLiteral< POD >, \ - XprMatrix<E3, Rows, Cols> \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>( \ - expr_type(e1, XprLiteral< POD >(x2), e3)); \ -} \ - \ -template<class E1, class E2, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprEval< \ - XprMatrix<E1, Rows, Cols>, \ - XprMatrix<E2, Rows, Cols>, \ - XprLiteral< POD > \ - >, \ - Rows, Cols \ -> \ -eval(const XprMatrix<E1, Rows, Cols>& e1, const XprMatrix<E2, Rows, Cols>& e2, POD x3) { \ - typedef XprEval< \ - XprMatrix<E1, Rows, Cols>, \ - XprMatrix<E2, Rows, Cols>, \ - XprLiteral< POD > \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>( \ - expr_type(e1, e2, XprLiteral< POD >(x3))); \ -} - -TVMET_IMPLEMENT_MACRO(int) -TVMET_IMPLEMENT_MACRO(float) -TVMET_IMPLEMENT_MACRO(double) - -#undef TVMET_IMPLEMENT_MACRO - - -/* - * trinary evaluation functions with matrizes, xpr of and complex<> types - * - * XprMatrix<E, Rows, Cols> e, std::complex<T> z2, std::complex<T> z3 - * XprMatrix<E1, Rows, Cols> e1, std::complex<T> z2, XprMatrix<E3, Rows, Cols> e3 - * XprMatrix<E1, Rows, Cols> e1, XprMatrix<E2, Rows, Cols> e2, std::complex<T> z3 - */ -#if defined(EIGEN_USE_COMPLEX) - -/** - * \fn eval(const XprMatrix<E, Rows, Cols>& e, const std::complex<T>& x2, const std::complex<T>& x3) - * \brief Evals the matrix expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E, int Rows, int Cols, class T> -inline -XprMatrix< - XprEval< - XprMatrix<E, Rows, Cols>, - XprLiteral< std::complex<T> >, - XprLiteral< std::complex<T> > - >, - Rows, Cols -> -eval(const XprMatrix<E, Rows, Cols>& e, const std::complex<T>& x2, const std::complex<T>& x3) { - typedef XprEval< - XprMatrix<E, Rows, Cols>, - XprLiteral< std::complex<T> >, - XprLiteral< std::complex<T> > - > expr_type; - return XprMatrix<expr_type, Rows, Cols>( - expr_type(e, XprLiteral< std::complex<T> >(x2), XprLiteral< std::complex<T> >(x3))); -} - - -/** - * \fn eval(const XprMatrix<E1, Rows, Cols>& e1, const std::complex<T>& x2, const XprMatrix<E3, Rows, Cols>& e3) - * \brief Evals the matrix expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E1, class E3, int Rows, int Cols, class T> -inline -XprMatrix< - XprEval< - XprMatrix<E1, Rows, Cols>, - XprLiteral< std::complex<T> >, - XprMatrix<E3, Rows, Cols> - >, - Rows, Cols -> -eval(const XprMatrix<E1, Rows, Cols>& e1, const std::complex<T>& x2, const XprMatrix<E3, Rows, Cols>& e3) { - typedef XprEval< - XprMatrix<E1, Rows, Cols>, - XprLiteral< std::complex<T> >, - XprMatrix<E3, Rows, Cols> - > expr_type; - return XprMatrix<expr_type, Rows, Cols>( - expr_type(e1, XprLiteral< std::complex<T> >(x2), e3)); -} - - -/** - * \fn eval(const XprMatrix<E1, Rows, Cols>& e1, const XprMatrix<E2, Rows, Cols>& e2, const std::complex<T>& x3) - * \brief Evals the matrix expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E1, class E2, int Rows, int Cols, class T> -inline -XprMatrix< - XprEval< - XprMatrix<E1, Rows, Cols>, - XprMatrix<E2, Rows, Cols>, - XprLiteral< std::complex<T> > - >, - Rows, Cols -> -eval(const XprMatrix<E1, Rows, Cols>& e1, const XprMatrix<E2, Rows, Cols>& e2, const std::complex<T>& x3) { - typedef XprEval< - XprMatrix<E1, Rows, Cols>, - XprMatrix<E2, Rows, Cols>, - XprLiteral< std::complex<T> > - > expr_type; - return XprMatrix<expr_type, Rows, Cols>( - expr_type(e1, e2, XprLiteral< std::complex<T> >(x3))); -} -#endif // defined(EIGEN_USE_COMPLEX) - -} // namespace tvmet - -#endif // TVMET_MATRIX_EVAL_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/MatrixFunctions.h b/tvmet-1.7.1/include/tvmet/MatrixFunctions.h deleted file mode 100644 index 293c3d4ac..000000000 --- a/tvmet-1.7.1/include/tvmet/MatrixFunctions.h +++ /dev/null @@ -1,1169 +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: MatrixFunctions.h,v 1.59 2004/11/04 16:21:17 opetzold Exp $ - */ - -#ifndef TVMET_MATRIX_FUNCTIONS_H -#define TVMET_MATRIX_FUNCTIONS_H - -#include <tvmet/Extremum.h> - -namespace tvmet { - -/* forwards */ -template<class T, int Sz> class Vector; -template<class T, int Sz> class VectorConstRef; - - -/********************************************************* - * PART I: DECLARATION - *********************************************************/ - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector arithmetic functions add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * function(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>) - * function(XprMatrix<E, Rows, Cols>, Matrix<T, Rows, Cols>) - * function(Matrix<T, Rows, Cols>, XprMatrix<E, Rows, Cols>) - */ -#define TVMET_DECLARE_MACRO(NAME) \ -template<class T1, class T2, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<T1, T2>, \ - MatrixConstRef<T1, Rows, Cols>, \ - MatrixConstRef<T2, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (const Matrix<T1, Rows, Cols>& lhs, \ - const Matrix<T2, Rows, Cols>& rhs) _tvmet_always_inline; \ - \ -template<class E, class T, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - XprMatrix<E, Rows, Cols>, \ - MatrixConstRef<T, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (const XprMatrix<E, Rows, Cols>& lhs, \ - const Matrix<T, Rows, Cols>& rhs) _tvmet_always_inline; \ - \ -template<class T, class E, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - MatrixConstRef<T, Rows, Cols>, \ - XprMatrix<E, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (const Matrix<T, Rows, Cols>& lhs, \ - const XprMatrix<E, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add) // per se element wise -TVMET_DECLARE_MACRO(sub) // per se element wise -namespace element_wise { - TVMET_DECLARE_MACRO(mul) // not defined for matrizes - TVMET_DECLARE_MACRO(div) // not defined for matrizes -} - -#undef TVMET_DECLARE_MACRO - - -/* - * function(Matrix<T, Rows, Cols>, POD) - * function(POD, Matrix<T, Rows, Cols>) - * Note: - operations +,-,*,/ are per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, POD) \ -template<class T, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<T, POD >, \ - MatrixConstRef<T, Rows, Cols>, \ - XprLiteral<POD > \ - >, \ - Rows, Cols \ -> \ -NAME (const Matrix<T, Rows, Cols>& lhs, \ - POD rhs) _tvmet_always_inline; \ - \ -template<class T, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< POD, T>, \ - XprLiteral< POD >, \ - MatrixConstRef<T, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (POD lhs, \ - const Matrix<T, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, int) -TVMET_DECLARE_MACRO(sub, int) -TVMET_DECLARE_MACRO(mul, int) -TVMET_DECLARE_MACRO(div, int) - -TVMET_DECLARE_MACRO(add, float) -TVMET_DECLARE_MACRO(sub, float) -TVMET_DECLARE_MACRO(mul, float) -TVMET_DECLARE_MACRO(div, float) - -TVMET_DECLARE_MACRO(add, double) -TVMET_DECLARE_MACRO(sub, double) -TVMET_DECLARE_MACRO(mul, double) -TVMET_DECLARE_MACRO(div, double) - -#undef TVMET_DECLARE_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * function(Matrix<T, Rows, Cols>, complex<T>) - * function(complex<T>, Matrix<T, Rows, Cols>) - * Note: - operations +,-,*,/ are per se element wise - * \todo type promotion - */ -#define TVMET_DECLARE_MACRO(NAME) \ -template<class T, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - MatrixConstRef< std::complex<T>, Rows, Cols>, \ - XprLiteral<std::complex<T> > \ - >, \ - Rows, Cols \ -> \ -NAME (const Matrix< std::complex<T>, Rows, Cols>& lhs, \ - const std::complex<T>& rhs) _tvmet_always_inline; \ - \ -template<class T, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - XprLiteral< std::complex<T> >, \ - MatrixConstRef< std::complex<T>, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (const std::complex<T>& lhs, \ - const Matrix< std::complex<T>, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add) -TVMET_DECLARE_MACRO(sub) -TVMET_DECLARE_MACRO(mul) -TVMET_DECLARE_MACRO(div) - -#undef TVMET_DECLARE_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix specific prod( ... ) functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -template<class T1, int Rows1, int Cols1, - class T2, int Cols2> -XprMatrix< - XprMMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - MatrixConstRef<T2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) - >, - Rows1, Cols2 // return Dim -> -prod(const Matrix<T1, Rows1, Cols1>& lhs, - const Matrix<T2, Cols1, Cols2>& rhs) _tvmet_always_inline; - - -template<class E1, int Rows1, int Cols1, - class T2, int Cols2> -XprMatrix< - XprMMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - MatrixConstRef<T2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) - >, - Rows1, Cols2 // return Dim -> -prod(const XprMatrix<E1, Rows1, Cols1>& lhs, - const Matrix<T2, Cols1, Cols2>& rhs) _tvmet_always_inline; - - -template<class T1, int Rows1, int Cols1, - class E2, int Cols2> -XprMatrix< - XprMMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - XprMatrix<E2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) - >, - Rows1, Cols2 // return Dim -> -prod(const Matrix<T1, Rows1, Cols1>& lhs, - const XprMatrix<E2, Cols1, Cols2>& rhs) _tvmet_always_inline; - - -template<class T1, int Rows1, int Cols1, - class T2, int Cols2> -XprMatrix< - XprMMProductTransposed< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - MatrixConstRef<T2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) - >, - Cols2, Rows1 // return Dim -> -trans_prod(const Matrix<T1, Rows1, Cols1>& lhs, - const Matrix<T2, Cols1, Cols2>& rhs) _tvmet_always_inline; - - -template<class T1, int Rows1, int Cols1, - class T2, int Cols2> // Rows2 = Rows1 -XprMatrix< - XprMtMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - MatrixConstRef<T2, Rows1, Cols2>, Cols2 // M2(Rows1, Cols2) - >, - Cols1, Cols2 // return Dim -> -MtM_prod(const Matrix<T1, Rows1, Cols1>& lhs, - const Matrix<T2, Rows1, Cols2>& rhs) _tvmet_always_inline; - - -template<class T1, int Rows1, int Cols1, - class T2, int Rows2> -XprMatrix< - XprMMtProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - MatrixConstRef<T2, Rows2, Cols1>, Cols1 // M2(Rows2, Cols1) - >, - Rows1, Rows2 // return Dim -> -MMt_prod(const Matrix<T1, Rows1, Cols1>& lhs, - const Matrix<T2, Rows2, Cols1>& rhs) _tvmet_always_inline; - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix-vector specific prod( ... ) functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -template<class T1, class T2, int Rows, int Cols> -XprVector< - XprMVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, // M(Rows, Cols) - VectorConstRef<T2, Cols> // V - >, - Rows -> -prod(const Matrix<T1, Rows, Cols>& lhs, - const Vector<T2, Cols>& rhs) _tvmet_always_inline; - - -template<class T1, class E2, int Rows, int Cols> -XprVector< - XprMVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, - XprVector<E2, Cols> - >, - Rows -> -prod(const Matrix<T1, Rows, Cols>& lhs, - const XprVector<E2, Cols>& rhs) _tvmet_always_inline; - - -template<class E1, class T2, int Rows, int Cols> -XprVector< - XprMVProduct< - XprMatrix<E1, Rows, Cols>, Rows, Cols, // M(Rows, Cols) - VectorConstRef<T2, Cols> // V - >, - Rows -> -prod(const XprMatrix<E1, Rows, Cols>& lhs, - const Vector<T2, Cols>& rhs) _tvmet_always_inline; - - -template<class T1, class T2, int Rows, int Cols> -XprVector< - XprMtVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, // M(Rows, Cols) - VectorConstRef<T2, Rows> // V - >, - Cols -> -Mtx_prod(const Matrix<T1, Rows, Cols>& lhs, - const Vector<T2, Rows>& rhs) _tvmet_always_inline; - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix specific functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -template<class T, int Rows, int Cols> -XprMatrix< - XprMatrixTranspose< - MatrixConstRef<T, Rows, Cols> - >, - Cols, Rows -> -trans(const Matrix<T, Rows, Cols>& rhs) _tvmet_always_inline; - - -template<class T, int Sz> -typename Traits<T>::sum_type -trace(const Matrix<T, Sz, Sz>& m) _tvmet_always_inline; - - -template<class T, int Rows, int Cols> -XprVector< - XprMatrixRow< - MatrixConstRef<T, Rows, Cols>, - Rows, Cols - >, - Cols -> -row(const Matrix<T, Rows, Cols>& m, - int no) _tvmet_always_inline; - - -template<class T, int Rows, int Cols> -XprVector< - XprMatrixCol< - MatrixConstRef<T, Rows, Cols>, - Rows, Cols - >, - Rows -> -col(const Matrix<T, Rows, Cols>& m, - int no) _tvmet_always_inline; - - -template<class T, int Sz> -XprVector< - XprMatrixDiag< - MatrixConstRef<T, Sz, Sz>, - Sz - >, - Sz -> -diag(const Matrix<T, Sz, Sz>& m) _tvmet_always_inline; - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * min/max unary functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -template<class E, int Rows, int Cols> -Extremum<typename E::value_type, int, matrix_tag> -maximum(const XprMatrix<E, Rows, Cols>& e); // NOT _tvmet_always_inline; - - -template<class T, int Rows, int Cols> -Extremum<T, int, matrix_tag> -maximum(const Matrix<T, Rows, Cols>& m) _tvmet_always_inline; - - -template<class E, int Rows, int Cols> -Extremum<typename E::value_type, int, matrix_tag> -minimum(const XprMatrix<E, Rows, Cols>& e); // NOT _tvmet_always_inline; - - -template<class T, int Rows, int Cols> -Extremum<T, int, matrix_tag> -minimum(const Matrix<T, Rows, Cols>& m) _tvmet_always_inline; - - -template<class E, int Rows, int Cols> -typename E::value_type -max(const XprMatrix<E, Rows, Cols>& e); // NOT _tvmet_always_inline; - - -template<class T, int Rows, int Cols> -T max(const Matrix<T, Rows, Cols>& m) _tvmet_always_inline; - - -template<class E, int Rows, int Cols> -typename E::value_type -min(const XprMatrix<E, Rows, Cols>& e); // NOT _tvmet_always_inline; - - -template<class T, int Rows, int Cols> -T min(const Matrix<T, Rows, Cols>& m) _tvmet_always_inline; - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * other unary functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -template<class T, int Rows, int Cols> -XprMatrix< - XprIdentity<T, Rows, Cols>, - Rows, Cols -> -identity() _tvmet_always_inline; - - -template<class M> -XprMatrix< - XprIdentity< - typename M::value_type, - M::Rows, M::Cols>, - M::Rows, M::Cols -> -identity() _tvmet_always_inline; - - -template<class T, int Rows, int Cols> -XprMatrix< - MatrixConstRef<T, Rows, Cols>, - Rows, Cols -> -cmatrix_ref(const T* mem) _tvmet_always_inline; - - -/********************************************************* - * PART II: IMPLEMENTATION - *********************************************************/ - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector arithmetic functions add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * function(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>) - * function(XprMatrix<E, Rows, Cols>, Matrix<T, Rows, Cols>) - * function(Matrix<T, Rows, Cols>, XprMatrix<E, Rows, Cols>) - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T1, class T2, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<T1, T2>, \ - MatrixConstRef<T1, Rows, Cols>, \ - MatrixConstRef<T2, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (const Matrix<T1, Rows, Cols>& lhs, const Matrix<T2, Rows, Cols>& rhs) { \ - typedef XprBinOp < \ - Fcnl_##NAME<T1, T2>, \ - MatrixConstRef<T1, Rows, Cols>, \ - MatrixConstRef<T2, Rows, Cols> \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>( \ - expr_type(lhs.constRef(), rhs.constRef())); \ -} \ - \ -template<class E, class T, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - XprMatrix<E, Rows, Cols>, \ - MatrixConstRef<T, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (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>, \ - MatrixConstRef<T, Rows, Cols> \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>( \ - expr_type(lhs, rhs.constRef())); \ -} \ - \ -template<class T, class E, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - MatrixConstRef<T, Rows, Cols>, \ - XprMatrix<E, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (const Matrix<T, Rows, Cols>& lhs, const XprMatrix<E, Rows, Cols>& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME<T, typename E::value_type>, \ - MatrixConstRef<T, Rows, Cols>, \ - XprMatrix<E, Rows, Cols> \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>( \ - expr_type(lhs.constRef(), rhs)); \ -} - -TVMET_IMPLEMENT_MACRO(add) // per se element wise -TVMET_IMPLEMENT_MACRO(sub) // per se element wise -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mul) // not defined for matrizes - TVMET_IMPLEMENT_MACRO(div) // not defined for matrizes -} - -#undef TVMET_IMPLEMENT_MACRO - - -/* - * function(Matrix<T, Rows, Cols>, POD) - * function(POD, Matrix<T, Rows, Cols>) - * Note: - operations +,-,*,/ are per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, POD) \ -template<class T, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<T, POD >, \ - MatrixConstRef<T, Rows, Cols>, \ - XprLiteral<POD > \ - >, \ - Rows, Cols \ -> \ -NAME (const Matrix<T, Rows, Cols>& lhs, POD rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME<T, POD >, \ - MatrixConstRef<T, Rows, Cols>, \ - XprLiteral< POD > \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>( \ - expr_type(lhs.constRef(), XprLiteral< POD >(rhs))); \ -} \ - \ -template<class T, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< POD, T>, \ - XprLiteral< POD >, \ - MatrixConstRef<T, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (POD lhs, const Matrix<T, Rows, Cols>& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< POD, T>, \ - XprLiteral< POD >, \ - MatrixConstRef<T, Rows, Cols> \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>( \ - expr_type(XprLiteral< POD >(lhs), rhs.constRef())); \ -} - -TVMET_IMPLEMENT_MACRO(add, int) -TVMET_IMPLEMENT_MACRO(sub, int) -TVMET_IMPLEMENT_MACRO(mul, int) -TVMET_IMPLEMENT_MACRO(div, int) - -TVMET_IMPLEMENT_MACRO(add, float) -TVMET_IMPLEMENT_MACRO(sub, float) -TVMET_IMPLEMENT_MACRO(mul, float) -TVMET_IMPLEMENT_MACRO(div, float) - -TVMET_IMPLEMENT_MACRO(add, double) -TVMET_IMPLEMENT_MACRO(sub, double) -TVMET_IMPLEMENT_MACRO(mul, double) -TVMET_IMPLEMENT_MACRO(div, double) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * function(Matrix<T, Rows, Cols>, complex<T>) - * function(complex<T>, Matrix<T, Rows, Cols>) - * Note: - operations +,-,*,/ are per se element wise - * \todo type promotion - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - MatrixConstRef< std::complex<T>, Rows, Cols>, \ - XprLiteral<std::complex<T> > \ - >, \ - Rows, Cols \ -> \ -NAME (const Matrix< std::complex<T>, Rows, Cols>& lhs, \ - const std::complex<T>& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - MatrixConstRef< std::complex<T>, Rows, Cols>, \ - XprLiteral< std::complex<T> > \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>( \ - expr_type(lhs.constRef(), 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> >, \ - MatrixConstRef< std::complex<T>, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (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> >, \ - MatrixConstRef<T, Rows, Cols> \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>( \ - expr_type(XprLiteral< std::complex<T> >(lhs), rhs.constRef())); \ -} - -TVMET_IMPLEMENT_MACRO(add) -TVMET_IMPLEMENT_MACRO(sub) -TVMET_IMPLEMENT_MACRO(mul) -TVMET_IMPLEMENT_MACRO(div) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix specific prod( ... ) functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn prod(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) - * \brief Function for the matrix-matrix-product. - * \ingroup _binary_function - * \note The rows2 has to be equal to cols1. - */ -template<class T1, int Rows1, int Cols1, - class T2, int Cols2> -inline -XprMatrix< - XprMMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - MatrixConstRef<T2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) - >, - Rows1, Cols2 // return Dim -> -prod(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) { - typedef XprMMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, - MatrixConstRef<T2, Cols1, Cols2>, Cols2 - > expr_type; - return XprMatrix<expr_type, Rows1, Cols2>( - expr_type(lhs.constRef(), rhs.constRef())); -} - - -/** - * \fn prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) - * \brief Evaluate the product of XprMatrix and Matrix. - * \ingroup _binary_function - */ -template<class E1, int Rows1, int Cols1, - class T2, int Cols2> -inline -XprMatrix< - XprMMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - MatrixConstRef<T2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) - >, - Rows1, Cols2 // return Dim -> -prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) { - typedef XprMMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, - MatrixConstRef<T2, Cols1, Cols2>, Cols2 - > expr_type; - return XprMatrix<expr_type, Rows1, Cols2>( - expr_type(lhs, rhs.constRef())); -} - - -/** - * \fn prod(const Matrix<T1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) - * \brief Evaluate the product of Matrix and XprMatrix. - * \ingroup _binary_function - */ -template<class T1, int Rows1, int Cols1, - class E2, int Cols2> -inline -XprMatrix< - XprMMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - XprMatrix<E2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) - >, - Rows1, Cols2 // return Dim -> -prod(const Matrix<T1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) { - typedef XprMMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, - XprMatrix<E2, Cols1, Cols2>, Cols2 - > expr_type; - return XprMatrix<expr_type, Rows1, Cols2>( - expr_type(lhs.constRef(), rhs)); -} - - -/** - * \fn trans_prod(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) - * \brief Function for the trans(matrix-matrix-product) - * \ingroup _binary_function - * Perform on given Matrix M1 and M2: - * \f[ - * (M_1\,M_2)^T - * \f] - */ -template<class T1, int Rows1, int Cols1, - class T2, int Cols2> -inline -XprMatrix< - XprMMProductTransposed< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - MatrixConstRef<T2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) - >, - Cols2, Rows1 // return Dim -> -trans_prod(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) { - typedef XprMMProductTransposed< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, - MatrixConstRef<T2, Cols1, Cols2>, Cols2 - > expr_type; - return XprMatrix<expr_type, Cols2, Rows1>( - expr_type(lhs.constRef(), rhs.constRef())); -} - - -/** - * \fn MtM_prod(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Rows1, Cols2>& rhs) - * \brief Function for the trans(matrix)-matrix-product. - * \ingroup _binary_function - * using formula - * \f[ - * M_1^{T}\,M_2 - * \f] - * \note The number of cols of matrix 2 have to be equal to number of rows of - * matrix 1, since matrix 1 is trans - the result is a (Cols1 x Cols2) - * matrix. - */ -template<class T1, int Rows1, int Cols1, - class T2, int Cols2> // Rows2 = Rows1 -inline -XprMatrix< - XprMtMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - MatrixConstRef<T2, Rows1, Cols2>, Cols2 // M2(Rows1, Cols2) - >, - Cols1, Cols2 // return Dim -> -MtM_prod(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Rows1, Cols2>& rhs) { - typedef XprMtMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, - MatrixConstRef<T2, Rows1, Cols2>, Cols2 - > expr_type; - return XprMatrix<expr_type, Cols1, Cols2>( - expr_type(lhs.constRef(), rhs.constRef())); -} - - -/** - * \fn MMt_prod(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Rows2, Cols1>& rhs) - * \brief Function for the matrix-trans(matrix)-product. - * \ingroup _binary_function - * \note The Cols2 has to be equal to Cols1. - */ -template<class T1, int Rows1, int Cols1, - class T2, int Rows2> -inline -XprMatrix< - XprMMtProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - MatrixConstRef<T2, Rows2, Cols1>, Cols1 // M2(Rows2, Cols1) - >, - Rows1, Rows2 // return Dim -> -MMt_prod(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Rows2, Cols1>& rhs) { - typedef XprMMtProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, - MatrixConstRef<T2, Rows2, Cols1>, Cols1 - > expr_type; - return XprMatrix<expr_type, Rows1, Rows2>( - expr_type(lhs.constRef(), rhs.constRef())); -} - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix-vector specific prod( ... ) functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn prod(const Matrix<T1, Rows, Cols>& lhs, const Vector<T2, Cols>& rhs) - * \brief Function for the matrix-vector-product - * \ingroup _binary_function - */ -template<class T1, class T2, int Rows, int Cols> -inline -XprVector< - XprMVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, // M(Rows, Cols) - VectorConstRef<T2, Cols> // V - >, - Rows -> -prod(const Matrix<T1, Rows, Cols>& lhs, const Vector<T2, Cols>& rhs) { - typedef XprMVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, - VectorConstRef<T2, Cols> - > expr_type; - return XprVector<expr_type, Rows>( - expr_type(lhs.constRef(), rhs.constRef())); -} - - -/** - * \fn prod(const Matrix<T1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs) - * \brief Function for the matrix-vector-product - * \ingroup _binary_function - */ -template<class T1, class E2, int Rows, int Cols> -inline -XprVector< - XprMVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, - XprVector<E2, Cols> - >, - Rows -> -prod(const Matrix<T1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs) { - typedef XprMVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, - XprVector<E2, Cols> - > expr_type; - return XprVector<expr_type, Rows>( - expr_type(lhs.constRef(), rhs)); -} - - -/* - * \fn prod(const XprMatrix<E, Rows, Cols>& lhs, const Vector<T, Cols>& rhs) - * \brief Compute the product of an XprMatrix with a Vector. - * \ingroup _binary_function - */ -template<class E1, class T2, int Rows, int Cols> -inline -XprVector< - XprMVProduct< - XprMatrix<E1, Rows, Cols>, Rows, Cols, // M(Rows, Cols) - VectorConstRef<T2, Cols> // V - >, - Rows -> -prod(const XprMatrix<E1, Rows, Cols>& lhs, const Vector<T2, Cols>& rhs) { - typedef XprMVProduct< - XprMatrix<E1, Rows, Cols>, Rows, Cols, - VectorConstRef<T2, Cols> - > expr_type; - return XprVector<expr_type, Rows>( - expr_type(lhs, rhs.constRef())); -} - - -/** - * \fn Mtx_prod(const Matrix<T1, Rows, Cols>& matrix, const Vector<T2, Rows>& vector) - * \brief Function for the trans(matrix)-vector-product - * \ingroup _binary_function - * Perform on given Matrix M and vector x: - * \f[ - * M^T\, x - * \f] - */ -template<class T1, class T2, int Rows, int Cols> -inline -XprVector< - XprMtVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, // M(Rows, Cols) - VectorConstRef<T2, Rows> // V - >, - Cols -> -Mtx_prod(const Matrix<T1, Rows, Cols>& lhs, const Vector<T2, Rows>& rhs) { - typedef XprMtVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, - VectorConstRef<T2, Rows> - > expr_type; - return XprVector<expr_type, Cols>( - expr_type(lhs.constRef(), rhs.constRef())); -} - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix specific functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn trans(const Matrix<T, Rows, Cols>& rhs) - * \brief Transpose the matrix - * \ingroup _unary_function - */ -template<class T, int Rows, int Cols> -inline -XprMatrix< - XprMatrixTranspose< - MatrixConstRef<T, Rows, Cols> - >, - Cols, Rows -> -trans(const Matrix<T, Rows, Cols>& rhs) { - typedef XprMatrixTranspose< - MatrixConstRef<T, Rows, Cols> - > expr_type; - return XprMatrix<expr_type, Cols, Rows>( - expr_type(rhs.constRef())); -} - - -/* - * \fn trace(const Matrix<T, Sz, Sz>& m) - * \brief Compute the trace of a square matrix. - * \ingroup _unary_function - * - * Simply compute the trace of the given matrix as: - * \f[ - * \sum_{k = 0}^{Sz-1} m(k, k) - * \f] - */ -template<class T, int Sz> -inline -typename Traits<T>::sum_type -trace(const Matrix<T, Sz, Sz>& m) { - return meta::Matrix<Sz, Sz, 0, 0>::trace(m); -} - - -/** - * \fn row(const Matrix<T, Rows, Cols>& m, int no) - * \brief Returns a row vector of the given matrix. - * \ingroup _binary_function - */ -template<class T, int Rows, int Cols> -inline -XprVector< - XprMatrixRow< - MatrixConstRef<T, Rows, Cols>, - Rows, Cols - >, - Cols -> -row(const Matrix<T, Rows, Cols>& m, int no) { - typedef XprMatrixRow< - MatrixConstRef<T, Rows, Cols>, - Rows, Cols - > expr_type; - return XprVector<expr_type, Cols>(expr_type(m.constRef(), no)); -} - - -/** - * \fn col(const Matrix<T, Rows, Cols>& m, int no) - * \brief Returns a column vector of the given matrix. - * \ingroup _binary_function - */ -template<class T, int Rows, int Cols> -inline -XprVector< - XprMatrixCol< - MatrixConstRef<T, Rows, Cols>, - Rows, Cols - >, - Rows -> -col(const Matrix<T, Rows, Cols>& m, int no) { - typedef XprMatrixCol< - MatrixConstRef<T, Rows, Cols>, - Rows, Cols - > expr_type; - return XprVector<expr_type, Rows>(expr_type(m.constRef(), no)); -} - - -/** - * \fn diag(const Matrix<T, Sz, Sz>& m) - * \brief Returns the diagonal vector of the given square matrix. - * \ingroup _unary_function - */ -template<class T, int Sz> -inline -XprVector< - XprMatrixDiag< - MatrixConstRef<T, Sz, Sz>, - Sz - >, - Sz -> -diag(const Matrix<T, Sz, Sz>& m) { - typedef XprMatrixDiag< - MatrixConstRef<T, Sz, Sz>, - Sz - > expr_type; - return XprVector<expr_type, Sz>(expr_type(m.constRef())); -} - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * other unary functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - -/** - * \fn XprMatrix<XprIdentity<typename M::value_type, M::Rows, M::Cols>, M::Rows, M::Cols>identity() - * \brief Fill a matrix to an identity matrix. - * \ingroup _unary_function - * - * \note The matrix doesn't need to be square. Only the elements - * where the current number of rows are equal to columns - * will be set to 1, else to 0. - * - * \par Usage: - * \code - * typedef Matrix<double,3,3> matrix_type; - * ... - * matrix_type E( identity<double, 3, 3>() ); - * \endcode - * - * Note, we have to specify the type, number of rows and columns - * since ADL can't work here. - * - * - * - * \since release 1.6.0 - */ -template<class T, int Rows, int Cols> -inline -XprMatrix< - XprIdentity<T, Rows, Cols>, - Rows, Cols -> -identity() { - typedef XprIdentity<T, Rows, Cols> expr_type; - - return XprMatrix<expr_type, Rows, Cols>(expr_type()); -} - -/** - * \fn XprMatrix<XprIdentity<typename M::value_type, M::Rows, M::Cols>, M::Rows, M::Cols>identity() - * \brief Fill a matrix to an identity matrix (convenience wrapper - * for matrix typedefs). - * \ingroup _unary_function - * - * \note The matrix doesn't need to be square. Only the elements - * where the current number of rows are equal to columns - * will be set to 1, else to 0. - * - * \par Usage: - * \code - * typedef Matrix<double,3,3> matrix_type; - * ... - * matrix_type E( identity<matrix_type>() ); - * \endcode - * - * Note, we have to specify the matrix type, since ADL can't work here. - * - * \since release 1.6.0 - */ -template<class M> -inline -XprMatrix< - XprIdentity< - typename M::value_type, - M::Rows, M::Cols>, - M::Rows, M::Cols -> -identity() { - return identity<typename M::value_type, M::Rows, M::Cols>(); -} - - -/** - * \fn cmatrix_ref(const T* mem) - * \brief Creates an expression wrapper for a C like matrices. - * \ingroup _unary_function - * - * This is like creating a matrix of external data, as described - * at \ref construct. With this function you wrap an expression - * around a C style matrix and you can operate directly with it - * as usual. - * - * \par Example: - * \code - * static float lhs[3][3] = { - * {-1, 0, 1}, { 1, 0, 1}, {-1, 0, -1} - * }; - * static float rhs[3][3] = { - * { 0, 1, 1}, { 0, 1, -1}, { 0, -1, 1} - * }; - * ... - * - * typedef Matrix<float, 3, 3> matrix_type; - * - * matrix_type M( cmatrix_ref<float, 3, 3>(&lhs[0][0]) - * * cmatrix_ref<float, 3, 3>(&rhs[0][0]) ); - * \endcode - * - * \since release 1.6.0 - */ -template<class T, int Rows, int Cols> -inline -XprMatrix< - MatrixConstRef<T, Rows, Cols>, - Rows, Cols -> -cmatrix_ref(const T* mem) { - typedef MatrixConstRef<T, Rows, Cols> expr_type; - - return XprMatrix<expr_type, Rows, Cols>(expr_type(mem)); -}; - - -} // namespace tvmet - -#endif // TVMET_MATRIX_FUNCTIONS_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/MatrixImpl.h b/tvmet-1.7.1/include/tvmet/MatrixImpl.h deleted file mode 100644 index 10b9a85f5..000000000 --- a/tvmet-1.7.1/include/tvmet/MatrixImpl.h +++ /dev/null @@ -1,173 +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: MatrixImpl.h,v 1.27 2004/06/10 16:36:55 opetzold Exp $ - */ - -#ifndef TVMET_MATRIX_IMPL_H -#define TVMET_MATRIX_IMPL_H - -#include <iomanip> // setw - -#include <tvmet/Functional.h> - -namespace tvmet { - -/* - * member operators for i/o - */ -template<class T, int Rows, int Cols> -std::ostream& Matrix<T, Rows, Cols>::print_xpr(std::ostream& os, int l) const -{ - os << IndentLevel(l++) << "Matrix[" << ops << "]<" - << typeid(T).name() << ", " << Rows << ", " << Cols << ">," - << IndentLevel(--l) - << std::endl; - - return os; -} - - -template<class T, int Rows, int Cols> -std::ostream& Matrix<T, Rows, Cols>::print_on(std::ostream& os) const -{ - os << "[\n"; - for(int i = 0; i < Rows; ++i) { - os << " ["; - for(int j = 0; j < (Cols - 1); ++j) { - os << this->operator()(i, j) << ", "; - } - os << this->operator()(i, Cols - 1) - << (i != (Rows-1) ? "],\n" : "]\n"); - } - os << "]"; - return os; -} - -/* - * member operators with scalars, per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template<class T, int Rows, int Cols> \ -inline \ -Matrix<T, Rows, Cols>& \ -Matrix<T, Rows, Cols>::operator OP (value_type rhs) { \ - typedef XprLiteral<value_type> expr_type; \ - this->M_##NAME(XprMatrix<expr_type, Rows, Cols>(expr_type(rhs))); \ - return *this; \ -} - -TVMET_IMPLEMENT_MACRO(add_eq, +=) -TVMET_IMPLEMENT_MACRO(sub_eq, -=) -TVMET_IMPLEMENT_MACRO(mul_eq, *=) -TVMET_IMPLEMENT_MACRO(div_eq, /=) -#undef TVMET_IMPLEMENT_MACRO - -/* - * member functions (operators) with matrizes, for use with +=,-= ... - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T1, int Rows, int Cols> \ -template <class T2> \ -inline \ -Matrix<T1, Rows, Cols>& \ -Matrix<T1, Rows, Cols>::M_##NAME (const Matrix<T2, Rows, Cols>& rhs) { \ - this->M_##NAME( XprMatrix<typename Matrix<T2, Rows, Cols>::ConstRef, Rows, Cols>(rhs.constRef()) ); \ - return *this; \ -} - -TVMET_IMPLEMENT_MACRO(add_eq) -TVMET_IMPLEMENT_MACRO(sub_eq) -TVMET_IMPLEMENT_MACRO(mul_eq) -TVMET_IMPLEMENT_MACRO(div_eq) -#undef TVMET_IMPLEMENT_MACRO - - -/* - * member functions (operators) with expressions, for use with +=,-= ... - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T, int Rows, int Cols> \ -template<class E> \ -inline \ -Matrix<T, Rows, Cols>& \ -Matrix<T, Rows, Cols>::M_##NAME (const XprMatrix<E, Rows, Cols>& rhs) { \ - rhs.assign_to(*this, Fcnl_##NAME<value_type, typename E::value_type>()); \ - return *this; \ -} - -TVMET_IMPLEMENT_MACRO(add_eq) -TVMET_IMPLEMENT_MACRO(sub_eq) -TVMET_IMPLEMENT_MACRO(mul_eq) -TVMET_IMPLEMENT_MACRO(div_eq) -#undef TVMET_IMPLEMENT_MACRO - -/* - * aliased member functions (operators) with matrizes, - * for use with +=,-= ... - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T1, int Rows, int Cols> \ -template <class T2> \ -inline \ -Matrix<T1, Rows, Cols>& \ -Matrix<T1, Rows, Cols>::alias_##NAME (const Matrix<T2, Rows, Cols>& rhs) { \ - this->alias_##NAME( XprMatrix<typename Matrix<T2, Rows, Cols>::ConstRef, Rows, Cols>(rhs.constRef()) ); \ - return *this; \ -} - -TVMET_IMPLEMENT_MACRO(assign) -TVMET_IMPLEMENT_MACRO(add_eq) -TVMET_IMPLEMENT_MACRO(sub_eq) -TVMET_IMPLEMENT_MACRO(mul_eq) -TVMET_IMPLEMENT_MACRO(div_eq) -#undef TVMET_IMPLEMENT_MACRO - - -/* - * aliased member functions (operators) with expressions, - * for use with +=,-= ... and aliased(), - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T, int Rows, int Cols> \ -template<class E> \ -inline \ -Matrix<T, Rows, Cols>& \ -Matrix<T, Rows, Cols>::alias_##NAME (const XprMatrix<E, Rows, Cols>& rhs) { \ - typedef Matrix<T, Rows, Cols> temp_type; \ - temp_type(rhs).assign_to(*this, Fcnl_##NAME<value_type, typename E::value_type>()); \ - return *this; \ -} - -TVMET_IMPLEMENT_MACRO(assign) -TVMET_IMPLEMENT_MACRO(add_eq) -TVMET_IMPLEMENT_MACRO(sub_eq) -TVMET_IMPLEMENT_MACRO(mul_eq) -TVMET_IMPLEMENT_MACRO(div_eq) -#undef TVMET_IMPLEMENT_MACRO - - -} // namespace tvmet - -#endif // TVMET_MATRIX_IMPL_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/MatrixOperators.h b/tvmet-1.7.1/include/tvmet/MatrixOperators.h deleted file mode 100644 index 958fc0d22..000000000 --- a/tvmet-1.7.1/include/tvmet/MatrixOperators.h +++ /dev/null @@ -1,718 +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: MatrixOperators.h,v 1.33 2004/06/17 15:53:12 opetzold Exp $ - */ - -#ifndef TVMET_MATRIX_OPERATORS_H -#define TVMET_MATRIX_OPERATORS_H - -namespace tvmet { - - -/********************************************************* - * PART I: DECLARATION - *********************************************************/ - - -template<class T, int Rows, int Cols> -std::ostream& operator<<(std::ostream& os, - const Matrix<T, Rows, Cols>& rhs) _tvmet_always_inline; - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Member operators (arithmetic and bit ops) - *++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * update_operator(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>) - * update_operator(Matrix<T1, Rows, Cols>, XprMatrix<E, Rows, Cols> rhs) - * Note: per se element wise - * \todo: the operator*= can have element wise mul oder product, decide! - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template<class T1, class T2, int Rows, int Cols> \ -Matrix<T1, Rows, Cols>& \ -operator OP (Matrix<T1, Rows, Cols>& lhs, \ - const Matrix<T2, Rows, Cols>& rhs) _tvmet_always_inline; \ - \ -template<class T, class E, int Rows, int Cols> \ -Matrix<T, Rows, Cols>& \ -operator OP (Matrix<T, Rows, Cols>& lhs, \ - const XprMatrix<E, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add_eq, +=) // per se element wise -TVMET_DECLARE_MACRO(sub_eq, -=) // per se element wise -namespace element_wise { - TVMET_DECLARE_MACRO(mul_eq, *=) // see note - TVMET_DECLARE_MACRO(div_eq, /=) // not defined for vectors -} - -#undef TVMET_DECLARE_MACRO - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Matrix arithmetic operators implemented by functions - * add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>) - * operator(XprMatrix<E, Rows, Cols>, Matrix<T, Rows, Cols>) - * operator(Matrix<T, Rows, Cols>, XprMatrix<E, Rows, Cols>) - * Note: per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template<class T1, class T2, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<T1, T2>, \ - MatrixConstRef<T1, Rows, Cols>, \ - MatrixConstRef<T2, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix<T1, Rows, Cols>& lhs, \ - const Matrix<T2, Rows, Cols>& rhs) _tvmet_always_inline; \ - \ -template<class E, class T, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - XprMatrix<E, Rows, Cols>, \ - MatrixConstRef<T, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix<E, Rows, Cols>& lhs, \ - const Matrix<T, Rows, Cols>& rhs) _tvmet_always_inline; \ - \ -template<class T, class E, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - MatrixConstRef<T, Rows, Cols>, \ - XprMatrix<E, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix<T, Rows, Cols>& lhs, \ - const XprMatrix<E, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, +) // per se element wise -TVMET_DECLARE_MACRO(sub, -) // per se element wise -namespace element_wise { - TVMET_DECLARE_MACRO(mul, *) // see as prod() - TVMET_DECLARE_MACRO(div, /) // not defined for matrizes -} -#undef TVMET_DECLARE_MACRO - - -/* - * 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, POD) \ -template<class T, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<T, POD >, \ - MatrixConstRef<T, Rows, Cols>, \ - XprLiteral<POD > \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix<T, Rows, Cols>& lhs, \ - POD rhs) _tvmet_always_inline; \ - \ -template<class T, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< POD, T>, \ - XprLiteral< POD >, \ - MatrixConstRef<T, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (POD lhs, \ - const Matrix<T, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, +, int) -TVMET_DECLARE_MACRO(sub, -, int) -TVMET_DECLARE_MACRO(mul, *, int) -TVMET_DECLARE_MACRO(div, /, int) - -TVMET_DECLARE_MACRO(add, +, float) -TVMET_DECLARE_MACRO(sub, -, float) -TVMET_DECLARE_MACRO(mul, *, float) -TVMET_DECLARE_MACRO(div, /, float) - -TVMET_DECLARE_MACRO(add, +, double) -TVMET_DECLARE_MACRO(sub, -, double) -TVMET_DECLARE_MACRO(mul, *, double) -TVMET_DECLARE_MACRO(div, /, double) - -#undef TVMET_DECLARE_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * operator(Matrix<T, Rows, Cols>, complex<T>) - * operator(complex<T>, Matrix<T, Rows, Cols>) - * Note: operations +,-,*,/ are per se element wise - * \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> >, \ - MatrixConstRef< 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_always_inline; \ - \ -template<class T, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - XprLiteral< std::complex<T> >, \ - MatrixConstRef< std::complex<T>, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const std::complex<T>& lhs, \ - const Matrix< std::complex<T>, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, +) -TVMET_DECLARE_MACRO(sub, -) -TVMET_DECLARE_MACRO(mul, *) -TVMET_DECLARE_MACRO(div, /) - -#undef TVMET_DECLARE_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix specific operator*() = prod() operations - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -template<class T1, int Rows1, int Cols1, - class T2, int Cols2> -XprMatrix< - XprMMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, - MatrixConstRef<T2, Cols1, Cols2>, Cols2 - >, - Rows1, Cols2 -> -operator*(const Matrix<T1, Rows1, Cols1>& lhs, - const Matrix<T2, Cols1, Cols2>& rhs) _tvmet_always_inline; - - -template<class E1, int Rows1, int Cols1, - class T2, int Cols2> -XprMatrix< - XprMMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, - MatrixConstRef<T2, Cols1, Cols2>, Cols2 - >, - Rows1, Cols2 -> -operator*(const XprMatrix<E1, Rows1, Cols1>& lhs, - const Matrix<T2, Cols1, Cols2>& rhs) _tvmet_always_inline; - - -template<class T1, int Rows1, int Cols1, - class E2, int Cols2> -XprMatrix< - XprMMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, - XprMatrix<E2, Cols1, Cols2>, Cols2 - >, - Rows1, Cols2 -> -operator*(const Matrix<T1, Rows1, Cols1>& lhs, - const XprMatrix<E2, Cols1, Cols2>& rhs) _tvmet_always_inline; - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix-vector specific prod( ... ) operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -template<class T1, int Rows, int Cols, class T2> -XprVector< - XprMVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, - VectorConstRef<T2, Cols> - >, - Rows -> -operator*(const Matrix<T1, Rows, Cols>& lhs, - const Vector<T2, Cols>& rhs) _tvmet_always_inline; - - -template<class T1, class E2, int Rows, int Cols> -XprVector< - XprMVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, - XprVector<E2, Cols> - >, - Rows -> -operator*(const Matrix<T1, Rows, Cols>& lhs, - const XprVector<E2, Cols>& rhs) _tvmet_always_inline; - - -template<class E1, class T2, int Rows, int Cols> -XprVector< - XprMVProduct< - XprMatrix<E1, Rows, Cols>, Rows, Cols, - VectorConstRef<T2, Cols> - >, - Rows -> -operator*(const XprMatrix<E1, Rows, Cols>& lhs, - const Vector<T2, Cols>& rhs) _tvmet_always_inline; - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * global unary operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * unary_operator(Matrix<T, Rows, Cols>) - * Note: per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template <class T, int Rows, int Cols> \ -XprMatrix< \ - XprUnOp< \ - Fcnl_##NAME<T>, \ - MatrixConstRef<T, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix<T, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(neg, -) -#undef TVMET_DECLARE_MACRO - - -/********************************************************* - * PART II: IMPLEMENTATION - *********************************************************/ - - -/** - * \fn operator<<(std::ostream& os, const Matrix<T, Rows, Cols>& rhs) - * \brief Overload operator for i/o - * \ingroup _binary_operator - */ -template<class T, int Rows, int Cols> -inline -std::ostream& operator<<(std::ostream& os, const Matrix<T, Rows, Cols>& rhs) { - return rhs.print_on(os); -} - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Member operators (arithmetic and bit ops) - *++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * update_operator(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>) - * update_operator(Matrix<T1, Rows, Cols>, XprMatrix<E, Rows, Cols> rhs) - * Note: per se element wise - * \todo: the operator*= can have element wise mul oder product, decide! - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template<class T1, class T2, int Rows, int Cols> \ -inline \ -Matrix<T1, Rows, Cols>& \ -operator OP (Matrix<T1, Rows, Cols>& lhs, const Matrix<T2, Rows, Cols>& rhs) { \ - return lhs.M_##NAME(rhs); \ -} \ - \ -template<class T, class E, int Rows, int Cols> \ -inline \ -Matrix<T, Rows, Cols>& \ -operator OP (Matrix<T, Rows, Cols>& lhs, const XprMatrix<E, Rows, Cols>& rhs) { \ - return lhs.M_##NAME(rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add_eq, +=) // per se element wise -TVMET_IMPLEMENT_MACRO(sub_eq, -=) // per se element wise -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mul_eq, *=) // see note - TVMET_IMPLEMENT_MACRO(div_eq, /=) // not defined for vectors -} - -#undef TVMET_IMPLEMENT_MACRO - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Matrix arithmetic operators implemented by functions - * add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(Matrix<T1, Rows, Cols>, Matrix<T2, Rows, Cols>) - * operator(XprMatrix<E, Rows, Cols>, Matrix<T, Rows, Cols>) - * operator(Matrix<T, Rows, Cols>, XprMatrix<E, Rows, Cols>) - * Note: per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template<class T1, class T2, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<T1, T2>, \ - MatrixConstRef<T1, Rows, Cols>, \ - MatrixConstRef<T2, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix<T1, Rows, Cols>& lhs, const Matrix<T2, Rows, Cols>& rhs) { \ - return NAME(lhs, rhs); \ -} \ - \ -template<class E, class T, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - XprMatrix<E, Rows, Cols>, \ - MatrixConstRef<T, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix<E, Rows, Cols>& lhs, const Matrix<T, Rows, Cols>& rhs) { \ - return NAME(lhs, rhs); \ -} \ - \ -template<class T, class E, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - MatrixConstRef<T, Rows, Cols>, \ - XprMatrix<E, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix<T, Rows, Cols>& lhs, const XprMatrix<E, Rows, Cols>& rhs) { \ - return NAME(lhs, rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add, +) // per se element wise -TVMET_IMPLEMENT_MACRO(sub, -) // per se element wise -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mul, *) // see as prod() - TVMET_IMPLEMENT_MACRO(div, /) // not defined for matrizes -} -#undef TVMET_IMPLEMENT_MACRO - - -/* - * 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, POD) \ -template<class T, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<T, POD >, \ - MatrixConstRef<T, Rows, Cols>, \ - XprLiteral<POD > \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix<T, Rows, Cols>& lhs, POD rhs) { \ - return NAME (lhs, rhs); \ -} \ - \ -template<class T, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< POD, T>, \ - XprLiteral< POD >, \ - MatrixConstRef<T, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (POD lhs, const Matrix<T, Rows, Cols>& rhs) { \ - return NAME (lhs, rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add, +, int) -TVMET_IMPLEMENT_MACRO(sub, -, int) -TVMET_IMPLEMENT_MACRO(mul, *, int) -TVMET_IMPLEMENT_MACRO(div, /, int) - -TVMET_IMPLEMENT_MACRO(add, +, float) -TVMET_IMPLEMENT_MACRO(sub, -, float) -TVMET_IMPLEMENT_MACRO(mul, *, float) -TVMET_IMPLEMENT_MACRO(div, /, float) - -TVMET_IMPLEMENT_MACRO(add, +, double) -TVMET_IMPLEMENT_MACRO(sub, -, double) -TVMET_IMPLEMENT_MACRO(mul, *, double) -TVMET_IMPLEMENT_MACRO(div, /, double) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * operator(Matrix<T, Rows, Cols>, complex<T>) - * operator(complex<T>, Matrix<T, Rows, Cols>) - * Note: operations +,-,*,/ are per se element wise - * \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> >, \ - MatrixConstRef< 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) { \ - return NAME (lhs, rhs); \ -} \ - \ -template<class T, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - XprLiteral< std::complex<T> >, \ - MatrixConstRef< std::complex<T>, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const std::complex<T>& lhs, \ - const Matrix< std::complex<T>, Rows, Cols>& rhs) { \ - return NAME (lhs, rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add, +) -TVMET_IMPLEMENT_MACRO(sub, -) -TVMET_IMPLEMENT_MACRO(mul, *) -TVMET_IMPLEMENT_MACRO(div, /) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix specific operator*() = prod() operations - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn operator*(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) - * \brief multiply two Matrices. - * \ingroup _binary_operator - * \note The rows2 has to be equal to cols1. - * \sa prod(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) - */ -template<class T1, int Rows1, int Cols1, - class T2, int Cols2> -inline -XprMatrix< - XprMMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, - MatrixConstRef<T2, Cols1, Cols2>, Cols2 - >, - Rows1, Cols2 -> -operator*(const Matrix<T1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) { - return prod(lhs, rhs); -} - - -/** - * \fn operator*(const XprMatrix<E1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) - * \brief Evaluate the product of XprMatrix and Matrix. - * \ingroup _binary_operator - * \sa prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) - */ -template<class E1, int Rows1, int Cols1, - class T2, int Cols2> -inline -XprMatrix< - XprMMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, - MatrixConstRef<T2, Cols1, Cols2>, Cols2 - >, - Rows1, Cols2 -> -operator*(const XprMatrix<E1, Rows1, Cols1>& lhs, const Matrix<T2, Cols1, Cols2>& rhs) { - return prod(lhs, rhs); -} - - -/** - * \fn operator*(const Matrix<T1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) - * \brief Evaluate the product of Matrix and XprMatrix. - * \ingroup _binary_operator - * \sa prod(const Matrix<T, Rows1, Cols1>& lhs, const XprMatrix<E, Cols1, Cols2>& rhs) - */ -template<class T1, int Rows1, int Cols1, - class E2, int Cols2> -inline -XprMatrix< - XprMMProduct< - MatrixConstRef<T1, Rows1, Cols1>, Rows1, Cols1, - XprMatrix<E2, Cols1, Cols2>, Cols2 - >, - Rows1, Cols2 -> -operator*(const Matrix<T1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) { - return prod(lhs, rhs); -} - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix-vector specific prod( ... ) operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn operator*(const Matrix<T1, Rows, Cols>& lhs, const Vector<T2, Cols>& rhs) - * \brief multiply a Matrix with a Vector. - * \ingroup _binary_operator - * \note The length of the Vector has to be equal to the number of Columns. - * \sa prod(const Matrix<T1, Rows, Cols>& m, const Vector<T2, Cols>& v) - */ -template<class T1, int Rows, int Cols, class T2> -inline -XprVector< - XprMVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, - VectorConstRef<T2, Cols> - >, - Rows -> -operator*(const Matrix<T1, Rows, Cols>& lhs, const Vector<T2, Cols>& rhs) { - return prod(lhs, rhs); -} - - -/** - * \fn operator*(const Matrix<T1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs) - * \brief Function for the matrix-vector-product - * \ingroup _binary_operator - * \sa prod(const Matrix<T, Rows, Cols>& lhs, const XprVector<E, Cols>& rhs) - */ -template<class T1, class E2, int Rows, int Cols> -inline -XprVector< - XprMVProduct< - MatrixConstRef<T1, Rows, Cols>, Rows, Cols, - XprVector<E2, Cols> - >, - Rows -> -operator*(const Matrix<T1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs) { - return prod(lhs, rhs); -} - - -/** - * \fn operator*(const XprMatrix<E1, Rows, Cols>& lhs, const Vector<T2, Cols>& rhs) - * \brief Compute the product of an XprMatrix with a Vector. - * \ingroup _binary_operator - * \sa prod(const XprMatrix<E, Rows, Cols>& lhs, const Vector<T, Cols>& rhs) - */ -template<class E1, class T2, int Rows, int Cols> -inline -XprVector< - XprMVProduct< - XprMatrix<E1, Rows, Cols>, Rows, Cols, - VectorConstRef<T2, Cols> - >, - Rows -> -operator*(const XprMatrix<E1, Rows, Cols>& lhs, const Vector<T2, Cols>& rhs) { - return prod(lhs, rhs); -} - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * global unary operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * unary_operator(Matrix<T, Rows, Cols>) - * Note: per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template <class T, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprUnOp< \ - Fcnl_##NAME<T>, \ - MatrixConstRef<T, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const Matrix<T, Rows, Cols>& rhs) { \ - typedef XprUnOp< \ - Fcnl_##NAME<T>, \ - MatrixConstRef<T, Rows, Cols> \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>(expr_type(rhs.constRef())); \ -} - -TVMET_IMPLEMENT_MACRO(neg, -) -#undef TVMET_IMPLEMENT_MACRO - - -} // namespace tvmet - -#endif // TVMET_MATRIX_OPERATORS_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/MatrixUnaryFunctions.h b/tvmet-1.7.1/include/tvmet/MatrixUnaryFunctions.h deleted file mode 100644 index 7cb09d1d0..000000000 --- a/tvmet-1.7.1/include/tvmet/MatrixUnaryFunctions.h +++ /dev/null @@ -1,90 +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.9 2004/06/10 16:36:55 opetzold Exp $ - */ - -#ifndef TVMET_MATRIX_UNARY_FUNCTIONS_H -#define TVMET_MATRIX_UNARY_FUNCTIONS_H - -namespace tvmet { - -/* - * unary_function(Matrix<std::complex<T>, Rows, Cols>) - */ -#if defined(EIGEN_USE_COMPLEX) -#define TVMET_DECLARE_MACRO(NAME) \ -template<class T, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprUnOp< \ - Fcnl_##NAME< std::complex<T> >, \ - MatrixConstRef<std::complex<T>, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME(const Matrix<std::complex<T>, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(real) -TVMET_DECLARE_MACRO(imag) -TVMET_DECLARE_MACRO(conj) - -#undef TVMET_DECLARE_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - -/* - * unary_function(Matrix<std::complex<T>, Rows, Cols>) - */ -#if defined(EIGEN_USE_COMPLEX) -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprUnOp< \ - Fcnl_##NAME< std::complex<T> >, \ - MatrixConstRef<std::complex<T>, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME(const Matrix<std::complex<T>, Rows, Cols>& rhs) { \ - typedef XprUnOp< \ - Fcnl_##NAME< std::complex<T> >, \ - MatrixConstRef<std::complex<T>, Rows, Cols> \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>(expr_type(rhs.constRef())); \ -} - -TVMET_IMPLEMENT_MACRO(real) -TVMET_IMPLEMENT_MACRO(imag) -TVMET_IMPLEMENT_MACRO(conj) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -} // namespace tvmet - -#endif // TVMET_MATRIX_UNARY_FUNCTIONS_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/Traits.h b/tvmet-1.7.1/include/tvmet/Traits.h deleted file mode 100644 index ceb4f03eb..000000000 --- a/tvmet-1.7.1/include/tvmet/Traits.h +++ /dev/null @@ -1,122 +0,0 @@ -/* This file is part of Eigen, a C++ template library for linear algebra - * Copyright (C) 2007 Benoit Jacob <jacob@math.jussieu.fr> - * - * Based on Tvmet source code, http://tvmet.sourceforge.net, - * Copyright (C) 2001 - 2003 Olaf Petzold <opetzold@users.sourceforge.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id: Traits.h,v 1.11 2004/11/04 18:10:35 opetzold Exp $ - */ - -#ifndef TVMET_NUMERIC_TRAITS_H -#define TVMET_NUMERIC_TRAITS_H - -#if defined(EIGEN_USE_COMPLEX) -# include <complex> -#endif - -#include <cmath> - -#include <tvmet/TraitsBase.h> - -namespace tvmet { - -/** - * \class Traits Traits.h "tvmet/Traits.h" - * \brief Traits for standard types. - * - */ -template<typename T> -struct Traits : public TraitsBase<T> -{ - typedef TraitsBase<T> Base; - typedef typename Base::value_type value_type; - typedef typename Base::real_type real_type; - typedef typename Base::float_type float_type; - typedef typename Base::argument_type argument_type; - - using Base::isFloat; - using Base::isComplex; - using Base::epsilon; - using Base::abs; - using Base::real; - using Base::imag; - using Base::conj; - using Base::sqrt; - using Base::isLessThan_nonfuzzy; - - static value_type random() - { - value_type x; - pickRandom(x); - return x; - } - /** - * Short version: returns true if the absolute value of \a a is much smaller - * than that of \a b. - * - * Full story: returns(abs(a) <= abs(b) * epsilon()); - */ - static bool isNegligible(argument_type a, argument_type b) - { - if(isFloat()) - return(abs(a) <= abs(b) * epsilon()); - else - return(a==static_cast<value_type>(0)); - } - - /** - * Short version: returns true if \a a is approximately zero. - * - * Full story: returns isNegligible( a, static_cast<T>(1) ); - */ - static bool isZero(argument_type a) - { - return isNegligible(a, static_cast<value_type>(1)); - } - - /** - * Short version: returns true if a is very close to b, false otherwise. - * - * Full story: returns abs( a - b ) <= min( abs(a), abs(b) ) * epsilon<T>. - */ - static bool isApprox(argument_type a, argument_type b) - { - if(isFloat()) - return(abs( a - b ) <= std::min(abs(a), abs(b)) * epsilon()); - else - return(a==b); - } - - /** - * Short version: returns true if a is smaller or approximately equalt to b, false otherwise. - * - * Full story: returns a <= b || isApprox(a, b); - */ - static bool isLessThan(argument_type a, argument_type b) - { - if(isFloat()) - return(isLessThan_nonfuzzy(a,b) || isApprox(a, b)); - else - return(isLessThan_nonfuzzy(a,b)); - } - -}; - - -} // namespace tvmet - -#endif // TVMET_NUMERIC_TRAITS_H diff --git a/tvmet-1.7.1/include/tvmet/TraitsBase.h b/tvmet-1.7.1/include/tvmet/TraitsBase.h deleted file mode 100644 index 16c958baf..000000000 --- a/tvmet-1.7.1/include/tvmet/TraitsBase.h +++ /dev/null @@ -1,347 +0,0 @@ -/* This file is part of Eigen, a C++ template library for linear algebra - * Copyright (C) 2007 Benoit Jacob <jacob@math.jussieu.fr> - * - * Based on Tvmet source code, http://tvmet.sourceforge.net, - * Copyright (C) 2001 - 2003 Olaf Petzold <opetzold@users.sourceforge.net> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id: TraitsBase.h,v 1.11 2004/11/04 18:10:35 opetzold Exp $ - */ - -#ifndef TVMET_NUMERIC_TRAITS_BASE_H -#define TVMET_NUMERIC_TRAITS_BASE_H - -#if defined(EIGEN_USE_COMPLEX) -# include <complex> -#endif - -#include <cmath> -#include <cstdlib> - -namespace tvmet { - -/** - * \class TraitsBase TraitsBase.h "tvmet/TraitsBase.h" - * \brief Traits for standard types. - * - * In this base class goes the basic stuff that has to be implemented specifically - * for each type. - */ -template<typename T> -struct TraitsBase { - typedef T real_type; - typedef T value_type; - typedef T float_type; - typedef const T & argument_type; - - static real_type real(argument_type x); - static real_type imag(argument_type x); - static value_type conj(argument_type x); - static real_type abs(argument_type x); - static value_type sqrt(argument_type x); - static real_type epsilon(); - static bool isComplex(); - static bool isFloat(); - - static bool isLessThan_nonfuzzy(argument_type x, argument_type y); -}; - -/* - * numeric traits for built-in types - */ - -/** - * \class TraitsBase<int> TraitsBase.h "tvmet/TraitsBase.h" - * \brief Traits specialized for int. - */ -template<> -struct TraitsBase<int> { - typedef int value_type; - typedef value_type real_type; - typedef double float_type; - typedef value_type argument_type; - - static real_type real(argument_type x) { return x; } - static real_type imag(argument_type x) { TVMET_UNUSED(x); return 0; } - static value_type conj(argument_type x) { return x; } - static value_type sqrt(argument_type x) { - return static_cast<value_type>(std::sqrt(static_cast<float_type>(x))); - } - static real_type abs(argument_type x) { - return std::abs(x); - } - static real_type epsilon() { return 0; } - static bool isComplex() { return false; } - static bool isFloat() { return false; } - - /** Complexity on operations. */ - enum { - ops_plus = 1, /**< Complexity on plus/minus ops. */ - ops_muls = 1 /**< Complexity on multiplications. */ - }; - - static bool isLessThan_nonfuzzy(argument_type x, argument_type y) { - return x <= y; - } -}; - -/** - * \class TraitsBase<float> TraitsBase.h "tvmet/TraitsBase.h" - * \brief Traits specialized for float. - */ -template<> -struct TraitsBase<float> { - typedef float value_type; - typedef value_type real_type; - typedef value_type float_type; - typedef value_type argument_type; - - static real_type real(argument_type x) { return x; } - static real_type imag(argument_type x) { TVMET_UNUSED(x); return 0; } - static value_type conj(argument_type x) { return x; } - static value_type sqrt(argument_type x) { - return std::sqrt(x); - } - static real_type abs(argument_type x) { - return std::abs(x); - } - static real_type epsilon() { return 1e-5f; } - static bool isComplex() { return false; } - static bool isFloat() { return true; } - - /** Complexity on operations. */ - enum { - ops_plus = 1, /**< Complexity on plus/minus ops. */ - ops_muls = 1 /**< Complexity on multiplications. */ - }; - - static bool isLessThan_nonfuzzy(argument_type x, argument_type y) { - return x <= y; - } -}; - - -/** - * \class TraitsBase<double> TraitsBase.h "tvmet/TraitsBase.h" - * \brief Traits specialized for double. - */ -template<> -struct TraitsBase<double> { - typedef double value_type; - typedef value_type real_type; - typedef value_type float_type; - typedef value_type argument_type; - - static real_type real(argument_type x) { return x; } - static real_type imag(argument_type x) { TVMET_UNUSED(x); return 0; } - static value_type conj(argument_type x) { return x; } - static value_type sqrt(argument_type x) { - return std::sqrt(x); - } - static real_type abs(argument_type x) { - return std::abs(x); - } - static real_type epsilon() { return 1e-11; } - static bool isComplex() { return false; } - static bool isFloat() { return true; } - - /** Complexity on operations. */ - enum { - ops_plus = 1, /**< Complexity on plus/minus ops. */ - ops_muls = 1 /**< Complexity on multiplications. */ - }; - - static bool isLessThan_nonfuzzy(argument_type x, argument_type y) { - return x <= y; - } - -}; - - -/* - * numeric traits for complex types - */ -#if defined(EIGEN_USE_COMPLEX) - -/** - * \class TraitsBase< std::complex<int> > TraitsBase.h "tvmet/TraitsBase.h" - * \brief Traits specialized for std::complex<int>. - */ -template<> -struct TraitsBase< std::complex<int> > -{ - typedef std::complex<int> value_type; - typedef int real_type; - typedef std::complex<float> float_type; - typedef const value_type& argument_type; - - static real_type real(argument_type z) { return std::real(z); } - static real_type imag(argument_type z) { return std::imag(z); } - static value_type conj(argument_type z) { return std::conj(z); } - static real_type abs(argument_type x) { - // the use of ceil() guarantees e.g. that abs(real(x)) <= abs(x), - // and that abs(x)==0 if and only if x==0. - return static_cast<int>(std::ceil(std::abs(float_type(x.real(),x.imag())))); - } - static value_type sqrt(argument_type x) { - float_type y = std::sqrt(float_type(x.real(), x.imag())); - int r = static_cast<int>(y.real()); - int i = static_cast<int>(y.imag()); - return value_type(r,i); - } - static real_type epsilon() { return 0; } - static bool isComplex() { return true; } - static bool isFloat() { return false; } - - /** Complexity on operations. */ - enum { - ops_plus = 2, /**< Complexity on plus/minus ops. */ - ops_muls = 6 /**< Complexity on multiplications. */ - }; - - static bool isLessThan_nonfuzzy(argument_type x, argument_type y) { - TVMET_UNUSED(x); - TVMET_UNUSED(y); - return false; - } - -}; - - -/** - * \class TraitsBase< std::complex<float> > TraitsBase.h "tvmet/TraitsBase.h" - * \brief Traits specialized for std::complex<float>. - */ -template<> -struct TraitsBase< std::complex<float> > { - typedef std::complex<float> value_type; - typedef float real_type; - typedef value_type float_type; - typedef const value_type& argument_type; - - static real_type real(argument_type z) { return std::real(z); } - static real_type imag(argument_type z) { return std::imag(z); } - static value_type conj(argument_type z) { return std::conj(z); } - static value_type sqrt(argument_type x) { - return std::sqrt(x); - } - static real_type abs(argument_type x) { - return std::abs(x); - } - static real_type epsilon() { return 1e-5f; } - static bool isComplex() { return true; } - static bool isFloat() { return true; } - - /** Complexity on operations. */ - enum { - ops_plus = 2, /**< Complexity on plus/minus ops. */ - ops_muls = 6 /**< Complexity on multiplications. */ - }; - - static bool isLessThan_nonfuzzy(argument_type x, argument_type y) { - TVMET_UNUSED(x); - TVMET_UNUSED(y); - return false; - } - -}; - - -/** - * \class TraitsBase< std::complex<double> > TraitsBase.h "tvmet/TraitsBase.h" - * \brief Traits specialized for std::complex<double>. - */ -template<> -struct TraitsBase< std::complex<double> > { - typedef std::complex<double> value_type; - typedef double real_type; - typedef value_type float_type; - typedef const value_type& argument_type; - - static real_type real(argument_type z) { return std::real(z); } - static real_type imag(argument_type z) { return std::imag(z); } - static value_type conj(argument_type z) { return std::conj(z); } - static value_type sqrt(argument_type x) { - return std::sqrt(x); - } - static real_type abs(argument_type x) { - return std::abs(x); - } - static real_type epsilon() { return 1e-11; } - static bool isComplex() { return true; } - static bool isFloat() { return true; } - - /** Complexity on operations. */ - enum { - ops_plus = 2, /**< Complexity on plus/minus ops. */ - ops_muls = 6 /**< Complexity on multiplications. */ - }; - - static bool isLessThan_nonfuzzy(argument_type x, argument_type y) { - TVMET_UNUSED(x); - TVMET_UNUSED(y); - return false; - } - -}; - -#endif // defined(EIGEN_USE_COMPLEX) - -#ifdef __GNUC__ -# if __GNUC__>=4 -# define EIGEN_WITH_GCC_4_OR_LATER -# endif -#endif - -/** Stores in x a random int between -RAND_MAX/2 and RAND_MAX/2 */ -inline void pickRandom( int & x ) -{ - x = rand() - RAND_MAX / 2; -} - -/** Stores in x a random float between -1.0 and 1.0 */ -inline void pickRandom( float & x ) -{ - x = 2.0f * rand() / RAND_MAX - 1.0f; -} - -/** Stores in x a random double between -1.0 and 1.0 */ -inline void pickRandom( double & x ) -{ - x = 2.0 * rand() / RAND_MAX - 1.0; -} - -#ifdef EIGEN_USE_COMPLEX -/** Stores in the real and imaginary parts of x - * random values between -1.0 and 1.0 */ -template<typename T> void pickRandom( std::complex<T> & x ) -{ -#ifdef EIGEN_WITH_GCC_4_OR_LATER - pickRandom( x.real() ); - pickRandom( x.imag() ); -#else // workaround by David Faure for MacOS 10.3 and GCC 3.3, commit 630812 - T r = x.real(); - T i = x.imag(); - pickRandom( r ); - pickRandom( i ); - x = std::complex<T>(r,i); -#endif -} -#endif // EIGEN_USE_COMPLEX - -} // namespace tvmet - -#endif // TVMET_NUMERIC_TRAITS_BASE_H diff --git a/tvmet-1.7.1/include/tvmet/TvmetBase.h b/tvmet-1.7.1/include/tvmet/TvmetBase.h deleted file mode 100644 index 262f860d4..000000000 --- a/tvmet-1.7.1/include/tvmet/TvmetBase.h +++ /dev/null @@ -1,101 +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: TvmetBase.h,v 1.11 2004/06/10 16:36:55 opetzold Exp $ - */ - -#ifndef TVMET_BASE_H -#define TVMET_BASE_H - -#include <iosfwd> // io streams forward declaration -#include <typeinfo> // rtti: used by Xpr.h level printing -#include <cmath> // unary and binary math -#include <cstdlib> // labs - -namespace tvmet { - - -/** - * \class TvmetBase TvmetBase.h "tvmet/TvmetBase.h" - * \brief Base class - * Used for static polymorph call of print_xpr - */ -template<class E> class TvmetBase { }; - - -/** - * \class IndentLevel TvmetBase.h "tvmet/TvmetBase.h" - * \brief Prints the level indent. - */ -class IndentLevel : public TvmetBase< IndentLevel > -{ -public: - IndentLevel(int level) : m_level(level) { } - - std::ostream& print_xpr(std::ostream& os) const { - for(int i = 0; i != m_level; ++i) os << " "; - return os; - } - -private: - int m_level; -}; - - -/** - * \fn operator<<(std::ostream& os, const TvmetBase<E>& e) - * \brief overloaded ostream operator using static polymorphic. - * \ingroup _binary_operator - */ -template<class E> -inline -std::ostream& operator<<(std::ostream& os, const TvmetBase<E>& e) { - static_cast<const E&>(e).print_xpr(os); - return os; -} - - -/** - * \class dispatch TvmetBase.h "tvmet/TvmetBase.h" - * \brief Class helper to distuingish between e.g. meta - * and loop strategy used. - */ -template<bool> struct dispatch; - -/** - * \class dispatch<true> TvmetBase.h "tvmet/TvmetBase.h" - * \brief specialized. - */ -template<> struct dispatch<true> { }; - -/** - * \class dispatch<false> TvmetBase.h "tvmet/TvmetBase.h" - * \brief specialized. - */ -template<> struct dispatch<false> { }; - - -} // namespace tvmet - -#endif // TVMET_BASE_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/TypePromotion.h b/tvmet-1.7.1/include/tvmet/TypePromotion.h deleted file mode 100644 index 3bed8bf76..000000000 --- a/tvmet-1.7.1/include/tvmet/TypePromotion.h +++ /dev/null @@ -1,176 +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: TypePromotion.h,v 1.6 2003/11/30 08:26:25 opetzold Exp $ - */ - -#ifndef TVMET_TYPE_PROMOTION_H -#define TVMET_TYPE_PROMOTION_H - -namespace tvmet { - - -/** - * \class PrecisionTraits TypePromotion.h "tvmet/TypePromotion.h" - * \brief Declaring ranks of types to avoid specializing - * - * All possible promoted types. For example, bool=1, int=2, float=3, double=4, - * etc. We can use a traits class to map from a type such as float onto its - * "precision rank". We will promote to whichever type has a higher - * "precision rank". f there is no "precision rank" for a type, we'll - * promote to whichever type requires more storage space - * (and hopefully more precision). - */ -template<class T> -struct PrecisionTraits { - enum { - rank = 0, /**< the rank of type. */ - known = 0 /**< true, if the rank is specialized = known. */ - }; -}; - - -#define TVMET_PRECISION(T,R) \ -template<> \ -struct PrecisionTraits< T > { \ - enum { \ - rank = R, \ - known = 1 \ - }; \ -}; - - -/* - * pod types - */ -TVMET_PRECISION(int, 100) -TVMET_PRECISION(float, 700) -TVMET_PRECISION(double, 800) - -/* - * complex types - */ -#if defined(EIGEN_USE_COMPLEX) -TVMET_PRECISION(std::complex<int>, 1000) -TVMET_PRECISION(std::complex<float>, 1600) -TVMET_PRECISION(std::complex<double>, 1700) -#endif // defined(EIGEN_USE_COMPLEX) - - -/** \class PrecisionTraits<int> TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits<unsigned int> TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits<long> TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits<unsigned long> TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits<long long> TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits<unsigned long long> TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits<float> TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits<double> TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits<long double> TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits< std::complex<int> > TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits< std::complex<unsigned int> > TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits< std::complex<long> > TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits< std::complex<unsigned long> > TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits< std::complex<long long> > TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits< std::complex<unsigned long long> > TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits< std::complex<float> > TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits< std::complex<double> > TypePromotion.h "tvmet/TypePromotion.h" */ -/** \class PrecisionTraits< std::complex<long double> > TypePromotion.h "tvmet/TypePromotion.h" */ - -#undef TVMET_PRECISION - - -/** - * \class AutopromoteTraits TypePromotion.h "tvmet/TypePromotion.h" - * \brief The promoted types traits. - */ -template<class T> -struct AutopromoteTraits { - typedef T value_type; -}; - -/** - * \class promoteTo TypePromotion.h "tvmet/TypePromotion.h" - * \brief Promote to T1. - */ -template<class T1, class T2, int promoteToT1> -struct promoteTo { - typedef T1 value_type; -}; - - -/** - * \class promoteTo<T1,T2,0> TypePromotion.h "tvmet/TypePromotion.h" - * \brief Promote to T2 - */ -template<class T1, class T2> -struct promoteTo<T1,T2,0> { - typedef T2 value_type; -}; - - -/** - * \class PromoteTraits TypePromotion.h "tvmet/TypePromotion.h" - * \brief Promote type traits - */ -template<class T1org, class T2org> -class PromoteTraits { - // Handle promotion of small integers to int/unsigned int - typedef typename AutopromoteTraits<T1org>::value_type T1; - typedef typename AutopromoteTraits<T2org>::value_type T2; - - enum { - // True if T1 is higher ranked - T1IsBetter = int(PrecisionTraits<T1>::rank) > int(PrecisionTraits<T2>::rank), - - // True if we know ranks for both T1 and T2 - knowBothRanks = PrecisionTraits<T1>::known && PrecisionTraits<T2>::known, - - // True if we know T1 but not T2 - knowT1butNotT2 = PrecisionTraits<T1>::known && !(PrecisionTraits<T2>::known), - - // True if we know T2 but not T1 - knowT2butNotT1 = PrecisionTraits<T2>::known && !(PrecisionTraits<T1>::known), - - // True if T1 is bigger than T2 - T1IsLarger = sizeof(T1) >= sizeof(T2), - - // We know T1 but not T2: true - // We know T2 but not T1: false - // Otherwise, if T1 is bigger than T2: true - defaultPromotion = knowT1butNotT2 ? false : (knowT2butNotT1 ? true : T1IsLarger), - - // If we have both ranks, then use them. - // If we have only one rank, then use the unknown type. - // If we have neither rank, then promote to the larger type. - promoteToT1 = (knowBothRanks ? T1IsBetter : defaultPromotion) ? 1 : 0 - }; - - public: - typedef typename promoteTo<T1,T2,promoteToT1>::value_type value_type; -}; - - -} // namespace tvmet - -#endif // TVMET_TYPE_PROMOTION_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/UnaryFunctionals.h b/tvmet-1.7.1/include/tvmet/UnaryFunctionals.h deleted file mode 100644 index 3ba35f2e3..000000000 --- a/tvmet-1.7.1/include/tvmet/UnaryFunctionals.h +++ /dev/null @@ -1,119 +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: UnaryFunctionals.h,v 1.18 2004/10/04 11:44:42 opetzold Exp $ - */ - -#ifndef TVMET_UNARY_FUNCTIONAL_H -#define TVMET_UNARY_FUNCTIONAL_H - -namespace tvmet { - -/** \class Fcnl_compl UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_neg UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template <class T> \ -struct Fcnl_##NAME : public UnaryFunctional { \ - typedef T value_type; \ - \ - static inline \ - value_type apply_on(value_type rhs) { \ - return OP rhs; \ - } \ - \ - static \ - void print_xpr(std::ostream& os, int l=0) { \ - os << IndentLevel(l) << "Fcnl_" << #NAME << "<T=" \ - << typeid(T).name() << ">," \ - << std::endl; \ - } \ -}; - -TVMET_IMPLEMENT_MACRO(neg, -) -#undef TVMET_IMPLEMENT_MACRO - -/* - * complex support - */ - - -#if defined(EIGEN_USE_COMPLEX) - -/** - * \class Fcnl_conj< std::complex<T> > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" - * \brief %Functional for conj. - */ -template <class T> struct Fcnl_conj : public UnaryFunctional { }; - - -/** \class Fcnl_conj< std::complex<T> > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -template <class T> -struct Fcnl_conj< std::complex<T> > : public UnaryFunctional { - typedef std::complex<T> value_type; - - static inline - value_type apply_on(const std::complex<T>& rhs) { - return std::conj(rhs); - } - - static - void print_xpr(std::ostream& os, int l=0) { - os << IndentLevel(l) << "Fcnl_conj<T=" - << typeid(std::complex<T>).name() << ">," - << std::endl; - } -}; - - -/** \class Fcnl_real< std::complex<T> > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -/** \class Fcnl_imag< std::complex<T> > UnaryFunctionals.h "tvmet/UnaryFunctionals.h" */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template <class T> struct Fcnl_##NAME; \ -template <class T> \ -struct Fcnl_##NAME< std::complex<T> > : public UnaryFunctional { \ - typedef T value_type; \ - \ - static inline \ - value_type apply_on(const std::complex<T>& rhs) { \ - return TVMET_STD_SCOPE(NAME)(rhs); \ - } \ - \ - static \ - void print_xpr(std::ostream& os, int l=0) { \ - os << IndentLevel(l) << "Fcnl_" << #NAME << "<T=" \ - << typeid(std::complex<T>).name() << ">," \ - << std::endl; \ - } \ -}; - -TVMET_IMPLEMENT_MACRO(real) -TVMET_IMPLEMENT_MACRO(imag) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - -} // namespace tvmet - -#endif // TVMET_UNARY_FUNCTIONAL_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/Vector.h b/tvmet-1.7.1/include/tvmet/Vector.h deleted file mode 100644 index 275355f3e..000000000 --- a/tvmet-1.7.1/include/tvmet/Vector.h +++ /dev/null @@ -1,317 +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: Vector.h,v 1.44 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_VECTOR_H -#define TVMET_VECTOR_H - -#include <iterator> // reverse_iterator -#include <cassert> - -#include <tvmet/tvmet.h> -#include <tvmet/TypePromotion.h> -#include <tvmet/CommaInitializer.h> - -#include <tvmet/xpr/Vector.h> - -namespace tvmet { - - -/* forwards */ -template<class T, int Sz> class Vector; - - -/** - * \class VectorConstRef Vector.h "tvmet/Vector.h" - * \brief Const value iterator for ET - */ -template<class T, int Sz> -class VectorConstRef - : public TvmetBase< VectorConstRef<T, Sz> > -{ -public: // types - typedef T value_type; - typedef T* pointer; - typedef const T* const_pointer; - -public: - /** Dimensions. */ - enum { - Size = Sz /**< The size of the vector. */ - }; - -public: - /** Complexity counter. */ - enum { - ops = Size - }; - -private: - VectorConstRef(); - VectorConstRef& operator=(const VectorConstRef&); - -public: - /** Constructor. */ - explicit VectorConstRef(const Vector<T, Size>& rhs) - : m_array(rhs.array()) - { } - - /** Constructor by a given memory pointer. */ - explicit VectorConstRef(const_pointer data) - : m_array(data) - { } - -public: // access operators - /** access by index. */ - value_type operator()(int i) const { - assert(i < Size); - return m_array[i]; - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l) - << "VectorConstRef[O=" << ops << "]<" - << "T=" << typeid(T).name() << ">," - << std::endl; - } - -private: - const_pointer _tvmet_restrict m_array; -}; - - -/** - * \class Vector Vector.h "tvmet/Vector.h" - * \brief Compile time fixed length vector with evaluation on compile time. - */ -template<class T, int Size> -class Vector -{ -public: - /** Data type of the tvmet::Vector. */ - typedef T value_type; - -public: - /** Complexity counter. */ - enum { - ops_assign = Size, - ops = ops_assign, - use_meta = ops < TVMET_COMPLEXITY_V_ASSIGN_TRIGGER ? true : false - }; - -public: - /** Default Destructor */ - ~Vector() {} - - /** Default Constructor. Does nothing. */ - explicit Vector() {} - - /** Copy Constructor, not explicit! */ - Vector(const Vector& rhs) - { - *this = XprVector<ConstRef, Size>(rhs.constRef()); - } - - explicit Vector(const value_type* array) - { - for(int i = 0; i < Size; i++) m_array[i] = array[i]; - } - - /** Construct a vector by expression. */ - template <class E> - explicit Vector(const XprVector<E, Size>& e) - { - *this = e; - } - - /** Assign a value_type on array, this can be used for a single value - or a comma separeted list of values. */ - CommaInitializer<Vector, Size> operator=(value_type rhs) { - return CommaInitializer<Vector, Size>(*this, rhs); - } - -public: // access operators - value_type* _tvmet_restrict array() { return m_array; } - const value_type* _tvmet_restrict array() const { return m_array; } - -public: // index access operators - value_type& _tvmet_restrict operator()(int i) { - // Note: g++-2.95.3 does have problems on typedef reference - assert(i < Size); - return m_array[i]; - } - - value_type operator()(int i) const { - assert(i < Size); - return m_array[i]; - } - - value_type& _tvmet_restrict operator[](int i) { - // Note: g++-2.95.3 does have problems on typedef reference - return this->operator()(i); - } - - value_type operator[](int i) const { - return this->operator()(i); - } - -public: // ET interface - typedef VectorConstRef<T, Size> ConstRef; - - /** Return a const Reference of the internal data */ - ConstRef constRef() const { return ConstRef(*this); } - - /** Return the vector as const expression. */ - XprVector<ConstRef, Size> expr() const { - return XprVector<ConstRef, Size>(this->constRef()); - } - -private: - /** Wrapper for meta assign. */ - template<class Dest, class Src, class Assign> - static inline - void do_assign(dispatch<true>, Dest& dest, const Src& src, const Assign& assign_fn) { - meta::Vector<Size, 0>::assign(dest, src, assign_fn); - } - - /** Wrapper for loop assign. */ - template<class Dest, class Src, class Assign> - static inline - void do_assign(dispatch<false>, Dest& dest, const Src& src, const Assign& assign_fn) { - loop::Vector<Size>::assign(dest, src, assign_fn); - } - -public: - /** assign this to a vector expression using the functional assign_fn. */ - template<class T2, class Assign> - void assign_to(Vector<T2, Size>& dest, const Assign& assign_fn) const { - do_assign(dispatch<use_meta>(), dest, *this, assign_fn); - } - -public: // assign operations - /** assign a given Vector element wise to this vector. - The operator=(const Vector&) is compiler generated. */ - template<class T2> - Vector& operator=(const Vector<T2, Size>& rhs) { - rhs.assign_to(*this, Fcnl_assign<value_type, T2>()); - return *this; - } - - /** assign a given XprVector element wise to this vector. */ - template<class E> - Vector& operator=(const XprVector<E, Size>& rhs) { - rhs.assign_to(*this, Fcnl_assign<value_type, typename E::value_type>()); - return *this; - } - -private: - template<class Obj, int LEN> friend class CommaInitializer; - - void commaWrite(int index, T rhs) - { - m_array[index] = rhs; - } - -public: // math operators with scalars - // NOTE: this meaning is clear - element wise ops even if not in ns element_wise - Vector& operator+=(value_type) _tvmet_always_inline; - Vector& operator-=(value_type) _tvmet_always_inline; - Vector& operator*=(value_type) _tvmet_always_inline; - Vector& operator/=(value_type) _tvmet_always_inline; - -public: // math assign operators with vectors - // NOTE: access using the operators in ns element_wise, since that's what is does - template <class T2> Vector& M_add_eq(const Vector<T2, Size>&) _tvmet_always_inline; - template <class T2> Vector& M_sub_eq(const Vector<T2, Size>&) _tvmet_always_inline; - template <class T2> Vector& M_mul_eq(const Vector<T2, Size>&) _tvmet_always_inline; - template <class T2> Vector& M_div_eq(const Vector<T2, Size>&) _tvmet_always_inline; - -public: // math operators with expressions - // NOTE: access using the operators in ns element_wise, since that's what is does - template <class E> Vector& M_add_eq(const XprVector<E, Size>&) _tvmet_always_inline; - template <class E> Vector& M_sub_eq(const XprVector<E, Size>&) _tvmet_always_inline; - template <class E> Vector& M_mul_eq(const XprVector<E, Size>&) _tvmet_always_inline; - template <class E> Vector& M_div_eq(const XprVector<E, Size>&) _tvmet_always_inline; - -public: // aliased math operators with expressions, used with proxy - template <class T2> Vector& alias_assign(const Vector<T2, Size>&) _tvmet_always_inline; - template <class T2> Vector& alias_add_eq(const Vector<T2, Size>&) _tvmet_always_inline; - template <class T2> Vector& alias_sub_eq(const Vector<T2, Size>&) _tvmet_always_inline; - template <class T2> Vector& alias_mul_eq(const Vector<T2, Size>&) _tvmet_always_inline; - template <class T2> Vector& alias_div_eq(const Vector<T2, Size>&) _tvmet_always_inline; - - template <class E> Vector& alias_assign(const XprVector<E, Size>&) _tvmet_always_inline; - template <class E> Vector& alias_add_eq(const XprVector<E, Size>&) _tvmet_always_inline; - template <class E> Vector& alias_sub_eq(const XprVector<E, Size>&) _tvmet_always_inline; - template <class E> Vector& alias_mul_eq(const XprVector<E, Size>&) _tvmet_always_inline; - template <class E> Vector& alias_div_eq(const XprVector<E, Size>&) _tvmet_always_inline; - -public: // io - /** Structure for info printing as Vector<T, Size>. */ - struct Info : public TvmetBase<Info> { - std::ostream& print_xpr(std::ostream& os) const { - os << "Vector<T=" << typeid(value_type).name() - << ", Sz=" << Size << ">"; - return os; - } - }; - - /** Get an info object of this vector. */ - static Info info() { return Info(); } - - /** Member function for expression level printing. */ - std::ostream& print_xpr(std::ostream& os, int l=0) const; - - /** Member function for printing internal data. */ - std::ostream& print_on(std::ostream& os) const; - -private: - /** The data of vector self. */ - - value_type m_array[Size]; -}; - -typedef Vector<int, 2> Vector2i; -typedef Vector<int, 3> Vector3i; -typedef Vector<int, 4> Vector4i; -typedef Vector<float, 2> Vector2f; -typedef Vector<float, 3> Vector3f; -typedef Vector<float, 4> Vector4f; -typedef Vector<double, 2> Vector2d; -typedef Vector<double, 3> Vector3d; -typedef Vector<double, 4> Vector4d; - -} // namespace tvmet - -#include <tvmet/VectorImpl.h> -#include <tvmet/VectorFunctions.h> -#include <tvmet/VectorUnaryFunctions.h> -#include <tvmet/VectorOperators.h> -#include <tvmet/VectorEval.h> -#include <tvmet/AliasProxy.h> - -#endif // TVMET_VECTOR_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/VectorEval.h b/tvmet-1.7.1/include/tvmet/VectorEval.h deleted file mode 100644 index 47a7cf6b2..000000000 --- a/tvmet-1.7.1/include/tvmet/VectorEval.h +++ /dev/null @@ -1,373 +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: VectorEval.h,v 1.14 2003/11/30 08:26:25 opetzold Exp $ - */ - -#ifndef TVMET_VECTOR_EVAL_H -#define TVMET_VECTOR_EVAL_H - -namespace tvmet { - - -/******************************************************************** - * functions all_elements/any_elements - ********************************************************************/ - - -/** - * \fn bool all_elements(const XprVector<E, Sz>& e) - * \brief check on statements for all elements - * \ingroup _unary_function - * This is for use with boolean operators like - * \par Example: - * \code - * all_elements(vector > 0) { - * // true branch - * } else { - * // false branch - * } - * \endcode - * \sa \ref compare - */ -template<class E, int Sz> -inline -bool all_elements(const XprVector<E, Sz>& e) { - return meta::Vector<Sz>::all_elements(e); -} - - -/** - * \fn bool any_elements(const XprVector<E, Sz>& e) - * \brief check on statements for any elements - * \ingroup _unary_function - * This is for use with boolean operators like - * \par Example: - * \code - * any_elements(vector > 0) { - * // true branch - * } else { - * // false branch - * } - * \endcode - * \sa \ref compare - */ -template<class E, int Sz> -inline -bool any_elements(const XprVector<E, Sz>& e) { - return meta::Vector<Sz>::any_elements(e); -} - - -/* - * trinary evaluation functions with vectors and xpr of - * XprVector<E1, Sz> ? Vector<T2, Sz> : Vector<T3, Sz> - * XprVector<E1, Sz> ? Vector<T2, Sz> : XprVector<E3, Sz> - * XprVector<E1, Sz> ? XprVector<E2, Sz> : Vector<T3, Sz> - * XprVector<E1, Sz> ? XprVector<E2, Sz> : XprVector<E3, Sz> - */ - -/** - * eval(const XprVector<E1, Sz>& e1, const Vector<T2, Sz>& v2, const Vector<T3, Sz>& v3) - * \brief Evals the vector expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E1, class T2, class T3, int Sz> -inline -XprVector< - XprEval< - XprVector<E1, Sz>, - VectorConstRef<T2, Sz>, - VectorConstRef<T3, Sz> - >, - Sz -> -eval(const XprVector<E1, Sz>& e1, const Vector<T2, Sz>& v2, const Vector<T3, Sz>& v3) { - typedef XprEval< - XprVector<E1, Sz>, - VectorConstRef<T2, Sz>, - VectorConstRef<T3, Sz> - > expr_type; - return XprVector<expr_type, Sz>( - expr_type(e1, v2.constRef(), v3.constRef())); -} - - -/** - * eval(const XprVector<E1, Sz>& e1, const Vector<T2, Sz>& v2, const XprVector<E3, Sz>& e3) - * \brief Evals the vector expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E1, class T2, class E3, int Sz> -inline -XprVector< - XprEval< - XprVector<E1, Sz>, - VectorConstRef<T2, Sz>, - XprVector<E3, Sz> - >, - Sz -> -eval(const XprVector<E1, Sz>& e1, const Vector<T2, Sz>& v2, const XprVector<E3, Sz>& e3) { - typedef XprEval< - XprVector<E1, Sz>, - VectorConstRef<T2, Sz>, - XprVector<E3, Sz> - > expr_type; - return XprVector<expr_type, Sz>( - expr_type(e1, v2.constRef(), e3)); -} - - -/** - * eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, const Vector<T3, Sz>& v3) - * \brief Evals the vector expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E1, class E2, class T3, int Sz> -inline -XprVector< - XprEval< - XprVector<E1, Sz>, - XprVector<E2, Sz>, - VectorConstRef<T3, Sz> - >, - Sz -> -eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, const Vector<T3, Sz>& v3) { - typedef XprEval< - XprVector<E1, Sz>, - XprVector<E2, Sz>, - VectorConstRef<T3, Sz> - > expr_type; - return XprVector<expr_type, Sz>( - expr_type(e1, e2, v3.constRef())); -} - - -/** - * eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, const XprVector<E3, Sz>& e3) - * \brief Evals the vector expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E1, class E2, class E3, int Sz> -inline -XprVector< - XprEval< - XprVector<E1, Sz>, - XprVector<E2, Sz>, - XprVector<E3, Sz> - >, - Sz -> -eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, const XprVector<E3, Sz>& e3) { - typedef XprEval< - XprVector<E1, Sz>, - XprVector<E2, Sz>, - XprVector<E3, Sz> - > expr_type; - return XprVector<expr_type, Sz>(expr_type(e1, e2, e3)); -} - - -/* - * trinary evaluation functions with vectors, xpr of and POD - * - * XprVector<E, Sz> ? POD1 : POD2 - * XprVector<E1, Sz> ? POD : XprVector<E3, Sz> - * XprVector<E1, Sz> ? XprVector<E2, Sz> : POD - */ -#define TVMET_IMPLEMENT_MACRO(POD) \ -template<class E, int Sz> \ -inline \ -XprVector< \ - XprEval< \ - XprVector<E, Sz>, \ - XprLiteral< POD >, \ - XprLiteral< POD > \ - >, \ - Sz \ -> \ -eval(const XprVector<E, Sz>& e, POD x2, POD x3) { \ - typedef XprEval< \ - XprVector<E, Sz>, \ - XprLiteral< POD >, \ - XprLiteral< POD > \ - > expr_type; \ - return XprVector<expr_type, Sz>( \ - expr_type(e, XprLiteral< POD >(x2), XprLiteral< POD >(x3))); \ -} \ - \ -template<class E1, class E3, int Sz> \ -inline \ -XprVector< \ - XprEval< \ - XprVector<E1, Sz>, \ - XprLiteral< POD >, \ - XprVector<E3, Sz> \ - >, \ - Sz \ -> \ -eval(const XprVector<E1, Sz>& e1, POD x2, const XprVector<E3, Sz>& e3) { \ - typedef XprEval< \ - XprVector<E1, Sz>, \ - XprLiteral< POD >, \ - XprVector<E3, Sz> \ - > expr_type; \ - return XprVector<expr_type, Sz>( \ - expr_type(e1, XprLiteral< POD >(x2), e3)); \ -} \ - \ -template<class E1, class E2, int Sz> \ -inline \ -XprVector< \ - XprEval< \ - XprVector<E1, Sz>, \ - XprVector<E2, Sz>, \ - XprLiteral< POD > \ - >, \ - Sz \ -> \ -eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, POD x3) { \ - typedef XprEval< \ - XprVector<E1, Sz>, \ - XprVector<E2, Sz>, \ - XprLiteral< POD > \ - > expr_type; \ - return XprVector<expr_type, Sz>( \ - expr_type(e1, e2, XprLiteral< POD >(x3))); \ -} - -TVMET_IMPLEMENT_MACRO(int) - -TVMET_IMPLEMENT_MACRO(float) -TVMET_IMPLEMENT_MACRO(double) - -#undef TVMET_IMPLEMENT_MACRO - - -/* - * trinary evaluation functions with vectors, xpr of and complex<> types - * - * XprVector<E, Sz> e, std::complex<T> z2, std::complex<T> z3 - * XprVector<E1, Sz> e1, std::complex<T> z2, XprVector<E3, Sz> e3 - * XprVector<E1, Sz> e1, XprVector<E2, Sz> e2, std::complex<T> z3 - */ -#if defined(EIGEN_USE_COMPLEX) - - -/** - * eval(const XprVector<E, Sz>& e, std::complex<T> z2, std::complex<T> z3) - * \brief Evals the vector expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E, int Sz, class T> -inline -XprVector< - XprEval< - XprVector<E, Sz>, - XprLiteral< std::complex<T> >, - XprLiteral< std::complex<T> > - >, - Sz -> -eval(const XprVector<E, Sz>& e, std::complex<T> z2, std::complex<T> z3) { - typedef XprEval< - XprVector<E, Sz>, - XprLiteral< std::complex<T> >, - XprLiteral< std::complex<T> > - > expr_type; - return XprVector<expr_type, Sz>( - expr_type(e, XprLiteral< std::complex<T> >(z2), XprLiteral< std::complex<T> >(z3))); -} - -/** - * eval(const XprVector<E1, Sz>& e1, std::complex<T> z2, const XprVector<E3, Sz>& e3) - * \brief Evals the vector expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E1, class E3, int Sz, class T> -inline -XprVector< - XprEval< - XprVector<E1, Sz>, - XprLiteral< std::complex<T> >, - XprVector<E3, Sz> - >, - Sz -> -eval(const XprVector<E1, Sz>& e1, std::complex<T> z2, const XprVector<E3, Sz>& e3) { - typedef XprEval< - XprVector<E1, Sz>, - XprLiteral< std::complex<T> >, - XprVector<E3, Sz> - > expr_type; - return XprVector<expr_type, Sz>( - expr_type(e1, XprLiteral< std::complex<T> >(z2), e3)); -} - -/** - * eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, std::complex<T> z3) - * \brief Evals the vector expressions. - * \ingroup _trinary_function - * This eval is for the a?b:c syntax, since it's not allowed to overload - * these operators. - */ -template<class E1, class E2, int Sz, class T> -inline -XprVector< - XprEval< - XprVector<E1, Sz>, - XprVector<E2, Sz>, - XprLiteral< std::complex<T> > - >, - Sz -> -eval(const XprVector<E1, Sz>& e1, const XprVector<E2, Sz>& e2, std::complex<T> z3) { - typedef XprEval< - XprVector<E1, Sz>, - XprVector<E2, Sz>, - XprLiteral< std::complex<T> > - > expr_type; - return XprVector<expr_type, Sz>( - expr_type(e1, e2, XprLiteral< std::complex<T> >(z3))); -} -#endif // defined(EIGEN_USE_COMPLEX) - - -} // namespace tvmet - -#endif // TVMET_VECTOR_EVAL_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/VectorFunctions.h b/tvmet-1.7.1/include/tvmet/VectorFunctions.h deleted file mode 100644 index 2e34ab466..000000000 --- a/tvmet-1.7.1/include/tvmet/VectorFunctions.h +++ /dev/null @@ -1,854 +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: VectorFunctions.h,v 1.32 2004/07/06 09:45:54 opetzold Exp $ - */ - -#ifndef TVMET_VECTOR_FUNCTIONS_H -#define TVMET_VECTOR_FUNCTIONS_H - -#include <tvmet/Extremum.h> - -namespace tvmet { - - -/********************************************************* - * PART I: DECLARATION - *********************************************************/ - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector arithmetic functions add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * function(Vector<T1, Sz>, Vector<T2, Sz>) - * function(Vector<T, Sz>, XprVector<E, Sz>) - * function(XprVector<E, Sz>, Vector<T, Sz>) - */ -#define TVMET_DECLARE_MACRO(NAME) \ -template<class T1, class T2, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<T1, T2>, \ - VectorConstRef<T1, Sz>, \ - VectorConstRef<T2, Sz> \ - >, \ - Sz \ -> \ -NAME (const Vector<T1, Sz>& lhs, \ - const Vector<T2, Sz>& rhs) _tvmet_always_inline; \ - \ -template<class E, class T, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - XprVector<E, Sz>, \ - VectorConstRef<T, Sz> \ - >, \ - Sz \ -> \ -NAME (const XprVector<E, Sz>& lhs, \ - const Vector<T, Sz>& rhs) _tvmet_always_inline; \ - \ -template<class E, class T, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<T, typename E::value_type>, \ - VectorConstRef<T, Sz>, \ - XprVector<E, Sz> \ - >, \ - Sz \ -> \ -NAME (const Vector<T, Sz>& lhs, \ - const XprVector<E, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add) // per se element wise -TVMET_DECLARE_MACRO(sub) // per se element wise -TVMET_DECLARE_MACRO(mul) // per se element wise -namespace element_wise { - TVMET_DECLARE_MACRO(div) // not defined for vectors -} - -#undef TVMET_DECLARE_MACRO - - -/* - * function(Vector<T, Sz>, POD) - * function(POD, Vector<T, Sz>) - * Note: - operations +,-,*,/ are per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, POD) \ -template<class T, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< T, POD >, \ - VectorConstRef<T, Sz>, \ - XprLiteral< POD > \ - >, \ - Sz \ -> \ -NAME (const Vector<T, Sz>& lhs, \ - POD rhs) _tvmet_always_inline; \ - \ -template<class T, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< POD, T>, \ - XprLiteral< POD >, \ - VectorConstRef<T, Sz> \ - >, \ - Sz \ -> \ -NAME (POD lhs, \ - const Vector<T, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, int) -TVMET_DECLARE_MACRO(sub, int) -TVMET_DECLARE_MACRO(mul, int) -TVMET_DECLARE_MACRO(div, int) - -TVMET_DECLARE_MACRO(add, float) -TVMET_DECLARE_MACRO(sub, float) -TVMET_DECLARE_MACRO(mul, float) -TVMET_DECLARE_MACRO(div, float) - -TVMET_DECLARE_MACRO(add, double) -TVMET_DECLARE_MACRO(sub, double) -TVMET_DECLARE_MACRO(mul, double) -TVMET_DECLARE_MACRO(div, double) - -#undef TVMET_DECLARE_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * function(Vector<std::complex<T>, Sz>, std::complex<T>) - * function(std::complex<T>, Vector<std::complex<T>, Sz>) - * Note: per se element wise - * \todo type promotion - */ -#define TVMET_DECLARE_MACRO(NAME) \ -template<class T, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - VectorConstRef< std::complex<T>, Sz>, \ - XprLiteral< std::complex<T> > \ - >, \ - Sz \ -> \ -NAME (const Vector<std::complex<T>, Sz>& lhs, \ - const std::complex<T>& rhs) _tvmet_always_inline; \ - \ -template<class T, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - XprLiteral< std::complex<T> >, \ - VectorConstRef< std::complex<T>, Sz> \ - >, \ - Sz \ -> \ -NAME (const std::complex<T>& lhs, \ - const Vector< std::complex<T>, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add) -TVMET_DECLARE_MACRO(sub) -TVMET_DECLARE_MACRO(mul) -TVMET_DECLARE_MACRO(div) - -#undef TVMET_DECLARE_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * vector specific functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -template<class T, int Sz> -typename Traits<T>::sum_type -sum(const Vector<T, Sz>& v) _tvmet_always_inline; - - -template<class T, int Sz> -typename Traits<T>::sum_type -product(const Vector<T, Sz>& v) _tvmet_always_inline; - - -template<class T1, class T2, int Sz> -typename PromoteTraits<T1, T2>::value_type -dot(const Vector<T1, Sz>& lhs, - const Vector<T2, Sz>& rhs) _tvmet_always_inline; - - -template<class T1, class T2> -Vector<typename PromoteTraits<T1, T2>::value_type, 3> -cross(const Vector<T1, 3>& lhs, - const Vector<T2, 3>& rhs) _tvmet_always_inline; - - -template<class T, int Sz> -typename Traits<T>::sum_type -norm1(const Vector<T, Sz>& v) _tvmet_always_inline; - - -template<class T, int Sz> -typename Traits<T>::sum_type -norm2(const Vector<T, Sz>& v) _tvmet_always_inline; - - -template<class T, int Sz> -XprVector< - XprBinOp< - Fcnl_div<T, T>, - VectorConstRef<T, Sz>, - XprLiteral< T > - >, - Sz -> -normalize(const Vector<T, Sz>& v) _tvmet_always_inline; - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * min/max unary functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - -template<class E, int Sz> -Extremum<typename E::value_type, int, vector_tag> -maximum(const XprVector<E, Sz>& e); // NOT _tvmet_always_inline; - - -template<class T, int Sz> -Extremum<T, int, vector_tag> -maximum(const Vector<T, Sz>& v) _tvmet_always_inline; - - -template<class E, int Sz> -Extremum<typename E::value_type, int, vector_tag> -minimum(const XprVector<E, Sz>& e); // NOT _tvmet_always_inline; - - -template<class T, int Sz> -Extremum<T, int, vector_tag> -minimum(const Vector<T, Sz>& v) _tvmet_always_inline; - - -template<class E, int Sz> -typename E::value_type -max(const XprVector<E, Sz>& e); // NOT _tvmet_always_inline; - - -template<class T, int Sz> -T max(const Vector<T, Sz>& v) _tvmet_always_inline; - - -template<class E, int Sz> -typename E::value_type -min(const XprVector<E, Sz>& e); // NOT _tvmet_always_inline; - - -template<class T, int Sz> -T min(const Vector<T, Sz>& v) _tvmet_always_inline; - - -template<class T, int Sz> -XprVector< - VectorConstRef<T, Sz>, - Sz -> -cvector_ref(const T* mem) _tvmet_always_inline; - - -/********************************************************* - * PART II: IMPLEMENTATION - *********************************************************/ - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector arithmetic functions add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * function(Vector<T1, Sz>, Vector<T2, Sz>) - * function(Vector<T, Sz>, XprVector<E, Sz>) - * function(XprVector<E, Sz>, Vector<T, Sz>) - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T1, class T2, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<T1, T2>, \ - VectorConstRef<T1, Sz>, \ - VectorConstRef<T2, Sz> \ - >, \ - Sz \ -> \ -NAME (const Vector<T1, Sz>& lhs, const Vector<T2, Sz>& rhs) { \ - typedef XprBinOp < \ - Fcnl_##NAME<T1, T2>, \ - VectorConstRef<T1, Sz>, \ - VectorConstRef<T2, Sz> \ - > expr_type; \ - return XprVector<expr_type, Sz>( \ - expr_type(lhs.constRef(), rhs.constRef())); \ -} \ - \ -template<class E, class T, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - XprVector<E, Sz>, \ - VectorConstRef<T, Sz> \ - >, \ - Sz \ -> \ -NAME (const XprVector<E, Sz>& lhs, const Vector<T, Sz>& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - XprVector<E, Sz>, \ - VectorConstRef<T, Sz> \ - > expr_type; \ - return XprVector<expr_type, Sz>( \ - expr_type(lhs, rhs.constRef())); \ -} \ - \ -template<class E, class T, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<T, typename E::value_type>, \ - VectorConstRef<T, Sz>, \ - XprVector<E, Sz> \ - >, \ - Sz \ -> \ -NAME (const Vector<T, Sz>& lhs, const XprVector<E, Sz>& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME<T, typename E::value_type>, \ - VectorConstRef<T, Sz>, \ - XprVector<E, Sz> \ - > expr_type; \ - return XprVector<expr_type, Sz>( \ - expr_type(lhs.constRef(), rhs)); \ -} - -TVMET_IMPLEMENT_MACRO(add) // per se element wise -TVMET_IMPLEMENT_MACRO(sub) // per se element wise -TVMET_IMPLEMENT_MACRO(mul) // per se element wise -namespace element_wise { - TVMET_IMPLEMENT_MACRO(div) // not defined for vectors -} - -#undef TVMET_IMPLEMENT_MACRO - - -/* - * function(Vector<T, Sz>, POD) - * function(POD, Vector<T, Sz>) - * Note: - operations +,-,*,/ are per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, POD) \ -template<class T, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< T, POD >, \ - VectorConstRef<T, Sz>, \ - XprLiteral< POD > \ - >, \ - Sz \ -> \ -NAME (const Vector<T, Sz>& lhs, POD rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME<T, POD >, \ - VectorConstRef<T, Sz>, \ - XprLiteral< POD > \ - > expr_type; \ - return XprVector<expr_type, Sz>( \ - expr_type(lhs.constRef(), XprLiteral< POD >(rhs))); \ -} \ - \ -template<class T, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< POD, T>, \ - XprLiteral< POD >, \ - VectorConstRef<T, Sz> \ - >, \ - Sz \ -> \ -NAME (POD lhs, const Vector<T, Sz>& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< POD, T>, \ - XprLiteral< POD >, \ - VectorConstRef<T, Sz> \ - > expr_type; \ - return XprVector<expr_type, Sz>( \ - expr_type(XprLiteral< POD >(lhs), rhs.constRef())); \ -} - -TVMET_IMPLEMENT_MACRO(add, int) -TVMET_IMPLEMENT_MACRO(sub, int) -TVMET_IMPLEMENT_MACRO(mul, int) -TVMET_IMPLEMENT_MACRO(div, int) - -TVMET_IMPLEMENT_MACRO(add, float) -TVMET_IMPLEMENT_MACRO(sub, float) -TVMET_IMPLEMENT_MACRO(mul, float) -TVMET_IMPLEMENT_MACRO(div, float) - -TVMET_IMPLEMENT_MACRO(add, double) -TVMET_IMPLEMENT_MACRO(sub, double) -TVMET_IMPLEMENT_MACRO(mul, double) -TVMET_IMPLEMENT_MACRO(div, double) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * function(Vector<std::complex<T>, Sz>, std::complex<T>) - * function(std::complex<T>, Vector<std::complex<T>, Sz>) - * Note: per se element wise - * \todo type promotion - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - VectorConstRef< std::complex<T>, Sz>, \ - XprLiteral< std::complex<T> > \ - >, \ - Sz \ -> \ -NAME (const Vector<std::complex<T>, Sz>& lhs, const std::complex<T>& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - VectorConstRef< std::complex<T>, Sz>, \ - XprLiteral< std::complex<T> > \ - > expr_type; \ - return XprVector<expr_type, Sz>( \ - expr_type(lhs.constRef(), 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> >, \ - VectorConstRef< std::complex<T>, Sz> \ - >, \ - Sz \ -> \ -NAME (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> >, \ - VectorConstRef< std::complex<T>, Sz> \ - > expr_type; \ - return XprVector<expr_type, Sz>( \ - expr_type(XprLiteral< std::complex<T> >(lhs), rhs.constRef())); \ -} - -TVMET_IMPLEMENT_MACRO(add) -TVMET_IMPLEMENT_MACRO(sub) -TVMET_IMPLEMENT_MACRO(mul) -TVMET_IMPLEMENT_MACRO(div) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * vector specific functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn sum(const Vector<T, Sz>& v) - * \brief Compute the sum of the vector. - * \ingroup _unary_function - * - * Simply compute the sum of the given vector as: - * \f[ - * \sum_{i = 0}^{Sz-1} v[i] - * \f] - */ -template<class T, int Sz> -inline -typename Traits<T>::sum_type -sum(const Vector<T, Sz>& v) { - return meta::Vector<Sz>::sum(v); -} - - -/** - * \fn product(const Vector<T, Sz>& v) - * \brief Compute the product of the vector elements. - * \ingroup _unary_function - * - * Simply computer the product of the given vector as: - * \f[ - * \prod_{i = 0}^{Sz - 1} v[i] - * \f] - */ -template<class T, int Sz> -inline -typename Traits<T>::sum_type -product(const Vector<T, Sz>& v) { - return meta::Vector<Sz>::product(v); -} - - -/** - * \fn dot(const Vector<T1, Sz>& lhs, const Vector<T2, Sz>& rhs) - * \brief Compute the dot/inner product - * \ingroup _binary_function - * - * Compute the dot product as: - * \f[ - * \sum_{i = 0}^{Sz - 1} ( lhs[i] * rhs[i] ) - * \f] - * where lhs is a column vector and rhs is a row vector, both vectors - * have the same dimension. - */ -template<class T1, class T2, int Sz> -inline -typename PromoteTraits<T1, T2>::value_type -dot(const Vector<T1, Sz>& lhs, const Vector<T2, Sz>& rhs) { - return meta::Vector<Sz>::dot(lhs, rhs); -} - - -/** - * \fn cross(const Vector<T1, 3>& lhs, const Vector<T2, 3>& rhs) - * \brief Compute the cross/outer product - * \ingroup _binary_function - * \note working only for vectors of size = 3 - * \todo Implement vector outer product as ET and MT, returning a XprVector - */ -template<class T1, class T2> -inline -Vector<typename PromoteTraits<T1, T2>::value_type, 3> -cross(const Vector<T1, 3>& lhs, const Vector<T2, 3>& rhs) { - typedef typename PromoteTraits<T1, T2>::value_type value_type; - return Vector<value_type, 3>(lhs(1)*rhs(2) - rhs(1)*lhs(2), - rhs(0)*lhs(2) - lhs(0)*rhs(2), - lhs(0)*rhs(1) - rhs(0)*lhs(1)); -} - - -/** - * \fn norm1(const Vector<T, Sz>& v) - * \brief The \f$l_1\f$ norm of a vector v. - * \ingroup _unary_function - * The norm of any vector is just the square root of the dot product of - * a vector with itself, or - * - * \f[ - * |Vector<T, Sz> v| = |v| = \sum_{i=0}^{Sz-1}\,|v[i]| - * \f] - */ -template<class T, int Sz> -inline -typename Traits<T>::sum_type -norm1(const Vector<T, Sz>& v) { - return sum(abs(v)); -} - - -/** - * \fn norm2(const Vector<T, Sz>& v) - * \brief The euklidian norm (or \f$l_2\f$ norm) of a vector v. - * \ingroup _unary_function - * The norm of any vector is just the square root of the dot product of - * a vector with itself, or - * - * \f[ - * |Vector<T, Sz> v| = |v| = \sqrt{ \sum_{i=0}^{Sz-1}\,v[i]^2 } - * \f] - * - * \note The internal cast for Vector<int> avoids warnings on sqrt. - */ -template<class T, int Sz> -inline -typename Traits<T>::sum_type -norm2(const Vector<T, Sz>& v) { - return static_cast<T>( std::sqrt(static_cast<typename Traits<T>::float_type>(dot(v, v))) ); -} - - -/** - * \fn normalize(const Vector<T, Sz>& v) - * \brief Normalize the given vector. - * \ingroup _unary_function - * \sa norm2 - * - * using the equation: - * \f[ - * \frac{Vector<T, Sz> v}{\sqrt{ \sum_{i=0}^{Sz-1}\,v[i]^2 }} - * \f] - */ -template<class T, int Sz> -inline -XprVector< - XprBinOp< - Fcnl_div<T, T>, - VectorConstRef<T, Sz>, - XprLiteral< T > - >, - Sz -> -normalize(const Vector<T, Sz>& v) { - typedef XprBinOp< - Fcnl_div<T, T>, - VectorConstRef<T, Sz>, - XprLiteral< T > - > expr_type; - return XprVector<expr_type, Sz>( - expr_type(v.constRef(), XprLiteral< T >(norm2(v)))); -} - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * min/max unary functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn maximum(const XprVector<E, Sz>& e) - * \brief Find the maximum of a vector expression - * \ingroup _unary_function - */ -template<class E, int Sz> -inline -Extremum<typename E::value_type, int, vector_tag> -maximum(const XprVector<E, Sz>& e) { - typedef typename E::value_type value_type; - - value_type m_max(e(0)); - int m_idx(0); - - // this loop is faster than meta templates! - for(int i = 1; i != Sz; ++i) { - if(e(i) > m_max) { - m_max = e(i); - m_idx = i; - } - } - - return Extremum<value_type, int, vector_tag>(m_max, m_idx); -} - - -/** - * \fn maximum(const Vector<T, Sz>& v) - * \brief Find the maximum of a vector - * \ingroup _unary_function - */ -template<class T, int Sz> -inline -Extremum<T, int, vector_tag> -maximum(const Vector<T, Sz>& v) { return maximum(v.expr()); } - - -/** - * \fn minimum(const XprVector<E, Sz>& e) - * \brief Find the minimum of a vector expression - * \ingroup _unary_function - */ -template<class E, int Sz> -inline -Extremum<typename E::value_type, int, vector_tag> -minimum(const XprVector<E, Sz>& e) { - typedef typename E::value_type value_type; - - value_type m_min(e(0)); - int m_idx(0); - - // this loop is faster than meta templates! - for(int i = 1; i != Sz; ++i) { - if(e(i) < m_min) { - m_min = e(i); - m_idx = i; - } - } - - return Extremum<value_type, int, vector_tag>(m_min, m_idx); -} - - -/** - * \fn minimum(const Vector<T, Sz>& v) - * \brief Find the minimum of a vector - * \ingroup _unary_function - */ -template<class T, int Sz> -inline -Extremum<T, int, vector_tag> -minimum(const Vector<T, Sz>& v) { return minimum(v.expr()); } - - -/** - * \fn max(const XprVector<E, Sz>& e) - * \brief Find the maximum of a vector expression - * \ingroup _unary_function - */ -template<class E, int Sz> -inline -typename E::value_type -max(const XprVector<E, Sz>& e) { - typedef typename E::value_type value_type; - - value_type m_max(e(0)); - - // this loop is faster than meta templates! - for(int i = 1; i != Sz; ++i) - if(e(i) > m_max) - m_max = e(i); - - return m_max; -} - - -/** - * \fn max(const Vector<T, Sz>& v) - * \brief Find the maximum of a vector - * \ingroup _unary_function - */ -template<class T, int Sz> -inline -T max(const Vector<T, Sz>& v) { - typedef T value_type; - typedef typename Vector<T, Sz>::const_iterator const_iterator; - - const_iterator iter(v.begin()); - const_iterator last(v.end()); - value_type temp(*iter); - - for( ; iter != last; ++iter) - if(*iter > temp) - temp = *iter; - - return temp; -} - - -/** - * \fn min(const XprVector<E, Sz>& e) - * \brief Find the minimum of a vector expression - * \ingroup _unary_function - */ -template<class E, int Sz> -inline -typename E::value_type -min(const XprVector<E, Sz>& e) { - typedef typename E::value_type value_type; - - value_type m_min(e(0)); - - // this loop is faster than meta templates! - for(int i = 1; i != Sz; ++i) - if(e(i) < m_min) - m_min = e(i); - - return m_min; -} - - -/** - * \fn min(const Vector<T, Sz>& v) - * \brief Find the minimum of a vector - * \ingroup _unary_function - */ -template<class T, int Sz> -inline -T min(const Vector<T, Sz>& v) { - typedef T value_type; - typedef typename Vector<T, Sz>::const_iterator const_iterator; - - const_iterator iter(v.begin()); - const_iterator last(v.end()); - value_type temp(*iter); - - for( ; iter != last; ++iter) - if(*iter < temp) - temp = *iter; - - return temp; -} - - -/** - * \fn cvector_ref(const T* mem) - * \brief Creates an expression wrapper for a C like vector arrays. - * \ingroup _unary_function - * - * This is like creating a vector of external data, as described - * at \ref construct. With this function you wrap an expression - * around a C style vector array and you can operate directly with it - * as usual. - * - * \par Example: - * \code - * static float vertices[N][3] = { - * {-1, 0, 1}, { 1, 0, 1}, ... - * }; - * ... - * typedef Vector<float, 3> vector_type; - * ... - * vector_type V( cross(cvector_ref<float, 3>(&vertices[0][0]), - * cvector_ref<float, 3>(&vertices[1][0])) ); - * \endcode - * - * \since release 1.6.0 - */ -template<class T, int Sz> -inline -XprVector< - VectorConstRef<T, Sz>, - Sz -> -cvector_ref(const T* mem) { - typedef VectorConstRef<T, Sz> expr_type; - - return XprVector<expr_type, Sz>(expr_type(mem)); -}; - - -} // namespace tvmet - -#endif // TVMET_VECTOR_FUNCTIONS_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/VectorImpl.h b/tvmet-1.7.1/include/tvmet/VectorImpl.h deleted file mode 100644 index 1eb85d816..000000000 --- a/tvmet-1.7.1/include/tvmet/VectorImpl.h +++ /dev/null @@ -1,169 +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: VectorImpl.h,v 1.27 2004/06/10 16:36:55 opetzold Exp $ - */ - -#ifndef TVMET_VECTOR_IMPL_H -#define TVMET_VECTOR_IMPL_H - -#include <iomanip> // setw - -#include <tvmet/Functional.h> - -namespace tvmet { - -/* - * member operators for i/o - */ -template<class T, int Size> -std::ostream& Vector<T, Size>::print_xpr(std::ostream& os, int l) const -{ - os << IndentLevel(l++) << "Vector[" << ops << "]<" - << typeid(T).name() << ", " << Size << ">," - << IndentLevel(--l) - << std::endl; - - return os; -} - - -template<class T, int Size> -std::ostream& Vector<T, Size>::print_on(std::ostream& os) const -{ - os << "[\n "; - for(int i = 0; i < (Size - 1); ++i) { - os << m_array[i] << ", "; - } - os << m_array[Size - 1] << "\n]"; - return os; -} - - -/* - * member operators with scalars, per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template<class T, int Size> \ -inline \ -Vector<T, Size>& Vector<T, Size>::operator OP (value_type rhs) { \ - typedef XprLiteral<value_type> expr_type; \ - this->M_##NAME(XprVector<expr_type, Size>(expr_type(rhs))); \ - return *this; \ -} - -TVMET_IMPLEMENT_MACRO(add_eq, +=) -TVMET_IMPLEMENT_MACRO(sub_eq, -=) -TVMET_IMPLEMENT_MACRO(mul_eq, *=) -TVMET_IMPLEMENT_MACRO(div_eq, /=) -#undef TVMET_IMPLEMENT_MACRO - - -/* - * member functions (operators) with vectors, for use with +=,-= ... <<= - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T1, int Size> \ -template <class T2> \ -inline Vector<T1, Size>& \ -Vector<T1, Size>::M_##NAME (const Vector<T2, Size>& rhs) { \ - this->M_##NAME( XprVector<typename Vector<T2, Size>::ConstRef, Size>(rhs.constRef()) ); \ - return *this; \ -} - -TVMET_IMPLEMENT_MACRO(add_eq) -TVMET_IMPLEMENT_MACRO(sub_eq) -TVMET_IMPLEMENT_MACRO(mul_eq) -TVMET_IMPLEMENT_MACRO(div_eq) -#undef TVMET_IMPLEMENT_MACRO - - -/* - * member functions (operators) with expressions, for use with +=,-= ... <<= - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T, int Size> \ -template <class E> \ -inline \ -Vector<T, Size>& \ -Vector<T, Size>::M_##NAME (const XprVector<E, Size>& rhs) { \ - rhs.assign_to(*this, Fcnl_##NAME<value_type, typename E::value_type>()); \ - return *this; \ -} - -TVMET_IMPLEMENT_MACRO(add_eq) -TVMET_IMPLEMENT_MACRO(sub_eq) -TVMET_IMPLEMENT_MACRO(mul_eq) -TVMET_IMPLEMENT_MACRO(div_eq) -#undef TVMET_IMPLEMENT_MACRO - - -/* - * aliased member functions (operators) with vectors, - * for use with +=,-= ... <<= - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T1, int Size> \ -template <class T2> \ -inline \ -Vector<T1, Size>& \ -Vector<T1, Size>::alias_##NAME (const Vector<T2, Size>& rhs) { \ - this->alias_##NAME( XprVector<typename Vector<T2, Size>::ConstRef, Size>(rhs.constRef()) ); \ - return *this; \ -} - -TVMET_IMPLEMENT_MACRO(assign) -TVMET_IMPLEMENT_MACRO(add_eq) -TVMET_IMPLEMENT_MACRO(sub_eq) -TVMET_IMPLEMENT_MACRO(mul_eq) -TVMET_IMPLEMENT_MACRO(div_eq) -#undef TVMET_IMPLEMENT_MACRO - - -/* - * aliased member functions (operators) with expressions, - * for use with +=,-= ... <<= - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T, int Size> \ -template <class E> \ -inline \ -Vector<T, Size>& \ -Vector<T, Size>::alias_##NAME (const XprVector<E, Size>& rhs) { \ - typedef Vector<T, Size> temp_type; \ - temp_type(rhs).assign_to(*this, Fcnl_##NAME<value_type, typename E::value_type>()); \ - return *this; \ -} - -TVMET_IMPLEMENT_MACRO(assign) -TVMET_IMPLEMENT_MACRO(add_eq) -TVMET_IMPLEMENT_MACRO(sub_eq) -TVMET_IMPLEMENT_MACRO(mul_eq) -TVMET_IMPLEMENT_MACRO(div_eq) -#undef TVMET_IMPLEMENT_MACRO - - -} // namespace tvmet - -#endif // TVMET_VECTOR_IMPL_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/VectorOperators.h b/tvmet-1.7.1/include/tvmet/VectorOperators.h deleted file mode 100644 index f513bb19a..000000000 --- a/tvmet-1.7.1/include/tvmet/VectorOperators.h +++ /dev/null @@ -1,496 +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: VectorOperators.h,v 1.14 2004/06/10 16:36:55 opetzold Exp $ - */ - -#ifndef TVMET_VECTOR_OPERATORS_H -#define TVMET_VECTOR_OPERATORS_H - -namespace tvmet { - - -/********************************************************* - * PART I: DECLARATION - *********************************************************/ - - -template<class T, int Sz> -inline -std::ostream& operator<<(std::ostream& os, - const Vector<T, Sz>& rhs) _tvmet_always_inline; - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Member operators (arithmetic and bit ops) - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * update_operator(Vector<T1, Sz>, Vector<T2, Sz>) - * update_operator(Vector<T1, Sz>, XprVector<E, Sz>) - * Note: per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template<class T1, class T2, int Sz> \ -Vector<T1, Sz>& \ -operator OP (Vector<T1, Sz>& lhs, \ - const Vector<T2, Sz>& rhs) _tvmet_always_inline; \ - \ -template<class T, class E, int Sz> \ -Vector<T, Sz>& \ -operator OP (Vector<T, Sz>& lhs, \ - const XprVector<E, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add_eq, +=) // per se element wise -TVMET_DECLARE_MACRO(sub_eq, -=) // per se element wise -TVMET_DECLARE_MACRO(mul_eq, *=) // per se element wise -namespace element_wise { - TVMET_DECLARE_MACRO(div_eq, /=) // not defined for vectors -} - -#undef TVMET_DECLARE_MACRO - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector arithmetic operators implemented by functions - * add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(Vector<T1, Sz>, Vector<T2, Sz>) - * operator(Vector<T1, Sz>, XprVector<E, Sz>) - * operator(XprVector<E, Sz>, Vector<T1, Sz>) - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template<class T1, class T2, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<T1, T2>, \ - VectorConstRef<T1, Sz>, \ - VectorConstRef<T2, Sz> \ - >, \ - Sz \ -> \ -operator OP (const Vector<T1, Sz>& lhs, \ - const Vector<T2, Sz>& rhs) _tvmet_always_inline; \ - \ -template<class E, class T, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - XprVector<E, Sz>, \ - VectorConstRef<T, Sz> \ - >, \ - Sz \ -> \ -operator OP (const XprVector<E, Sz>& lhs, \ - const Vector<T, Sz>& rhs) _tvmet_always_inline; \ - \ -template<class E, class T, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<T, typename E::value_type>, \ - VectorConstRef<T, Sz>, \ - XprVector<E, Sz> \ - >, \ - Sz \ -> \ -operator OP (const Vector<T, Sz>& lhs, \ - const XprVector<E, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, +) // per se element wise -TVMET_DECLARE_MACRO(sub, -) // per se element wise -TVMET_DECLARE_MACRO(mul, *) // per se element wise -namespace element_wise { - TVMET_DECLARE_MACRO(div, /) // not defined for vectors -} - -#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, POD) \ -template<class T, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< T, POD >, \ - VectorConstRef<T, Sz>, \ - XprLiteral< POD > \ - >, \ - Sz \ -> \ -operator OP (const Vector<T, Sz>& lhs, \ - POD rhs) _tvmet_always_inline; \ - \ -template<class T, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< POD, T>, \ - XprLiteral< POD >, \ - VectorConstRef<T, Sz> \ - >, \ - Sz \ -> \ -operator OP (POD lhs, \ - const Vector<T, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, +, int) -TVMET_DECLARE_MACRO(sub, -, int) -TVMET_DECLARE_MACRO(mul, *, int) -TVMET_DECLARE_MACRO(div, /, int) - -TVMET_DECLARE_MACRO(add, +, float) -TVMET_DECLARE_MACRO(sub, -, float) -TVMET_DECLARE_MACRO(mul, *, float) -TVMET_DECLARE_MACRO(div, /, float) - -TVMET_DECLARE_MACRO(add, +, double) -TVMET_DECLARE_MACRO(sub, -, double) -TVMET_DECLARE_MACRO(mul, *, double) -TVMET_DECLARE_MACRO(div, /, double) - -#undef TVMET_DECLARE_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * operator(Vector<std::complex<T>, Sz>, std::complex<T>) - * operator(std::complex<T>, Vector<std::complex<T>, Sz>) - * Note: operations +,-,*,/ are per se element wise - * \todo type promotion - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template<class T, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - VectorConstRef< std::complex<T>, Sz>, \ - XprLiteral< std::complex<T> > \ - >, \ - Sz \ -> \ -operator OP (const Vector<std::complex<T>, Sz>& lhs, \ - const std::complex<T>& rhs) _tvmet_always_inline; \ - \ -template<class T, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - XprLiteral< std::complex<T> >, \ - VectorConstRef< std::complex<T>, Sz> \ - >, \ - Sz \ -> \ -operator OP (const std::complex<T>& lhs, \ - const Vector< std::complex<T>, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, +) // per se element wise -TVMET_DECLARE_MACRO(sub, -) // per se element wise -TVMET_DECLARE_MACRO(mul, *) // per se element wise -TVMET_DECLARE_MACRO(div, /) // per se element wise -#undef TVMET_DECLARE_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * global unary operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * unary_operator(Vector<T, Sz>) - * Note: per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template <class T, int Sz> \ -XprVector< \ - XprUnOp< \ - Fcnl_##NAME<T>, \ - VectorConstRef<T, Sz> \ - >, \ - Sz \ -> \ -operator OP (const Vector<T, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(neg, -) -#undef TVMET_DECLARE_MACRO - - -/********************************************************* - * PART II: IMPLEMENTATION - *********************************************************/ - - -/** - * \fn operator<<(std::ostream& os, const Vector<T, Sz>& rhs) - * \brief Overload operator for i/o - * \ingroup _binary_operator - */ -template<class T, int Sz> -inline -std::ostream& operator<<(std::ostream& os, const Vector<T, Sz>& rhs) { - return rhs.print_on(os); -} - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Member operators (arithmetic and bit ops) - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * update_operator(Vector<T1, Sz>, Vector<T2, Sz>) - * update_operator(Vector<T1, Sz>, XprVector<E, Sz>) - * Note: per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template<class T1, class T2, int Sz> \ -inline Vector<T1, Sz>& \ -operator OP (Vector<T1, Sz>& lhs, const Vector<T2, Sz>& rhs) { \ - return lhs.M_##NAME(rhs); \ -} \ - \ -template<class T, class E, int Sz> \ -inline Vector<T, Sz>& \ -operator OP (Vector<T, Sz>& lhs, const XprVector<E, Sz>& rhs) { \ - return lhs.M_##NAME(rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add_eq, +=) // per se element wise -TVMET_IMPLEMENT_MACRO(sub_eq, -=) // per se element wise -TVMET_IMPLEMENT_MACRO(mul_eq, *=) // per se element wise -namespace element_wise { - TVMET_IMPLEMENT_MACRO(div_eq, /=) // not defined for vectors -} - -#undef TVMET_IMPLEMENT_MACRO - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector arithmetic operators implemented by functions - * add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(Vector<T1, Sz>, Vector<T2, Sz>) - * operator(Vector<T1, Sz>, XprVector<E, Sz>) - * operator(XprVector<E, Sz>, Vector<T1, Sz>) - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template<class T1, class T2, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<T1, T2>, \ - VectorConstRef<T1, Sz>, \ - VectorConstRef<T2, Sz> \ - >, \ - Sz \ -> \ -operator OP (const Vector<T1, Sz>& lhs, const Vector<T2, Sz>& rhs) { \ - return NAME (lhs, rhs); \ -} \ - \ -template<class E, class T, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, T>, \ - XprVector<E, Sz>, \ - VectorConstRef<T, Sz> \ - >, \ - Sz \ -> \ -operator OP (const XprVector<E, Sz>& lhs, const Vector<T, Sz>& rhs) { \ - return NAME (lhs, rhs); \ -} \ - \ -template<class E, class T, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<T, typename E::value_type>, \ - VectorConstRef<T, Sz>, \ - XprVector<E, Sz> \ - >, \ - Sz \ -> \ -operator OP (const Vector<T, Sz>& lhs, const XprVector<E, Sz>& rhs) { \ - return NAME (lhs, rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add, +) // per se element wise -TVMET_IMPLEMENT_MACRO(sub, -) // per se element wise -TVMET_IMPLEMENT_MACRO(mul, *) // per se element wise -namespace element_wise { - TVMET_IMPLEMENT_MACRO(div, /) // not defined for vectors -} - -#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, POD) \ -template<class T, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< T, POD >, \ - VectorConstRef<T, Sz>, \ - XprLiteral< POD > \ - >, \ - Sz \ -> \ -operator OP (const Vector<T, Sz>& lhs, POD rhs) { \ - return NAME (lhs, rhs); \ -} \ - \ -template<class T, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< POD, T>, \ - XprLiteral< POD >, \ - VectorConstRef<T, Sz> \ - >, \ - Sz \ -> \ -operator OP (POD lhs, const Vector<T, Sz>& rhs) { \ - return NAME (lhs, rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add, +, int) -TVMET_IMPLEMENT_MACRO(sub, -, int) -TVMET_IMPLEMENT_MACRO(mul, *, int) -TVMET_IMPLEMENT_MACRO(div, /, int) - -TVMET_IMPLEMENT_MACRO(add, +, float) -TVMET_IMPLEMENT_MACRO(sub, -, float) -TVMET_IMPLEMENT_MACRO(mul, *, float) -TVMET_IMPLEMENT_MACRO(div, /, float) - -TVMET_IMPLEMENT_MACRO(add, +, double) -TVMET_IMPLEMENT_MACRO(sub, -, double) -TVMET_IMPLEMENT_MACRO(mul, *, double) -TVMET_IMPLEMENT_MACRO(div, /, double) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * operator(Vector<std::complex<T>, Sz>, std::complex<T>) - * operator(std::complex<T>, Vector<std::complex<T>, Sz>) - * Note: operations +,-,*,/ are per se element wise - * \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> >, \ - VectorConstRef< std::complex<T>, Sz>, \ - XprLiteral< std::complex<T> > \ - >, \ - Sz \ -> \ -operator OP (const Vector<std::complex<T>, Sz>& lhs, \ - const std::complex<T>& rhs) { \ - return NAME (lhs, rhs); \ -} \ - \ -template<class T, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, std::complex<T> >, \ - XprLiteral< std::complex<T> >, \ - VectorConstRef< std::complex<T>, Sz> \ - >, \ - Sz \ -> \ -operator OP (const std::complex<T>& lhs, \ - const Vector< std::complex<T>, Sz>& rhs) { \ - return NAME (lhs, rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add, +) // per se element wise -TVMET_IMPLEMENT_MACRO(sub, -) // per se element wise -TVMET_IMPLEMENT_MACRO(mul, *) // per se element wise -TVMET_IMPLEMENT_MACRO(div, /) // per se element wise - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * global unary operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * unary_operator(Vector<T, Sz>) - * Note: per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template <class T, int Sz> \ -inline \ -XprVector< \ - XprUnOp< \ - Fcnl_##NAME<T>, \ - VectorConstRef<T, Sz> \ - >, \ - Sz \ -> \ -operator OP (const Vector<T, Sz>& rhs) { \ - typedef XprUnOp< \ - Fcnl_##NAME<T>, \ - VectorConstRef<T, Sz> \ - > expr_type; \ - return XprVector<expr_type, Sz>(expr_type(rhs.constRef())); \ -} - -TVMET_IMPLEMENT_MACRO(neg, -) - -#undef TVMET_IMPLEMENT_MACRO - - -} // namespace tvmet - -#endif // TVMET_VECTOR_OPERATORS_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/VectorUnaryFunctions.h b/tvmet-1.7.1/include/tvmet/VectorUnaryFunctions.h deleted file mode 100644 index dbe1a2c59..000000000 --- a/tvmet-1.7.1/include/tvmet/VectorUnaryFunctions.h +++ /dev/null @@ -1,100 +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.9 2004/06/10 16:36:55 opetzold Exp $ - */ - -#ifndef TVMET_VECTOR_UNARY_FUNCTIONS_H -#define TVMET_VECTOR_UNARY_FUNCTIONS_H - -namespace tvmet { - - -/********************************************************* - * PART I: DECLARATION - *********************************************************/ - -/* - * unary_function(Vector<std::complex<T>, Sz>) - */ -#if defined(EIGEN_USE_COMPLEX) -#define TVMET_DECLARE_MACRO(NAME) \ -template<class T, int Sz> \ -XprVector< \ - XprUnOp< \ - Fcnl_##NAME< std::complex<T> >, \ - VectorConstRef<std::complex<T>, Sz> \ - >, \ - Sz \ -> \ -NAME(const Vector<std::complex<T>, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(real) -TVMET_DECLARE_MACRO(imag) -TVMET_DECLARE_MACRO(conj) - -#undef TVMET_DECLARE_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/********************************************************* - * PART II: IMPLEMENTATION - *********************************************************/ - - -/* - * unary_function(Vector<std::complex<T>, Sz>) - */ -#if defined(EIGEN_USE_COMPLEX) -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class T, int Sz> \ -inline \ -XprVector< \ - XprUnOp< \ - Fcnl_##NAME< std::complex<T> >, \ - VectorConstRef<std::complex<T>, Sz> \ - >, \ - Sz \ -> \ -NAME(const Vector<std::complex<T>, Sz>& rhs) { \ - typedef XprUnOp< \ - Fcnl_##NAME< std::complex<T> >, \ - VectorConstRef<std::complex<T>, Sz> \ - > expr_type; \ - return XprVector<expr_type, Sz>(expr_type(rhs.constRef())); \ -} - -TVMET_IMPLEMENT_MACRO(real) -TVMET_IMPLEMENT_MACRO(imag) -TVMET_IMPLEMENT_MACRO(conj) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -} // namespace tvmet - -#endif // TVMET_VECTOR_UNARY_FUNCTIONS_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/config.h.cmake b/tvmet-1.7.1/include/tvmet/config.h.cmake deleted file mode 100644 index 707370c45..000000000 --- a/tvmet-1.7.1/include/tvmet/config.h.cmake +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _INCLUDE_TVMET_CONFIG_H -#define _INCLUDE_TVMET_CONFIG_H - -/* Define to 1 if you have the <sys/time.h> header file. */ -#cmakedefine TVMET_HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#cmakedefine TVMET_HAVE_UNISTD_H 1 - -#define _tvmet_restrict @TVMET_RESTRICT_KEYWORD@ - -#define _tvmet_always_inline @TVMET_ALWAYS_INLINE@ - -/* _INCLUDE_TVMET_CONFIG_H */ -#endif diff --git a/tvmet-1.7.1/include/tvmet/loop/CMakeLists.txt b/tvmet-1.7.1/include/tvmet/loop/CMakeLists.txt deleted file mode 100644 index db60d4ce1..000000000 --- a/tvmet-1.7.1/include/tvmet/loop/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -FILE(GLOB tvmet_loop_header_SRCS "*.h") - -INSTALL(FILES - ${tvmet_loop_header_SRCS} - DESTINATION ${INCLUDE_INSTALL_DIR}/loop - ) diff --git a/tvmet-1.7.1/include/tvmet/loop/Gemm.h b/tvmet-1.7.1/include/tvmet/loop/Gemm.h deleted file mode 100644 index 41ec66a64..000000000 --- a/tvmet-1.7.1/include/tvmet/loop/Gemm.h +++ /dev/null @@ -1,114 +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: Gemm.h,v 1.8 2004/06/16 09:30:07 opetzold Exp $ - */ - -#ifndef TVMET_LOOP_GEMM_H -#define TVMET_LOOP_GEMM_H - -namespace tvmet { - -namespace loop { - - -/** - * \class gemm Gemm.h "tvmet/loop/Gemm.h" - * \brief class for matrix-matrix product using loop unrolling. - * using formula - * \f[ - * M_1\,M_2 - * \f] - * \par Example: - * \code - * template<class T, int Rows1, int Cols1, int Cols2> - * inline - * void - * prod(const Matrix<T, Rows1, Cols1>& lhs, const Matrix<T, Cols1, Cols2>& rhs, - * Matrix<T, Rows1, Cols2>& dest) - * { - * for (int i = 0; i != Rows1; ++i) { - * for (int j = 0; j != Cols2; ++j) { - * dest(i, j) = tvmet::loop::gemm<Rows1, Cols1, Cols2>().prod(lhs, rhs, i, j); - * } - * } - * } - * \endcode - * \note The number of rows of rhs matrix have to be equal to cols of lhs matrix. - * The result is a (Rows1 x Cols2) matrix. - */ -template<int Rows1, int Cols1, - int Cols2> -class gemm -{ - gemm(const gemm&); - gemm& operator=(const gemm&); - -private: - enum { - count = Cols1, - N = (count+7)/8 - }; - -public: - gemm() { } - -public: - template<class E1, class E2> - static inline - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type - prod(const E1& lhs, const E2& rhs, int i, int j) { - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type sum(0); - int k(0); - int n(N); - - // Duff's device - switch(count % 8) { - case 0: do { sum += lhs(i, k) * rhs(k, j); ++k; - case 7: sum += lhs(i, k) * rhs(k, j); ++k; - case 6: sum += lhs(i, k) * rhs(k, j); ++k; - case 5: sum += lhs(i, k) * rhs(k, j); ++k; - case 4: sum += lhs(i, k) * rhs(k, j); ++k; - case 3: sum += lhs(i, k) * rhs(k, j); ++k; - case 2: sum += lhs(i, k) * rhs(k, j); ++k; - case 1: sum += lhs(i, k) * rhs(k, j); ++k; - } while(--n != 0); - } - - return sum; - } -}; - - -} // namespace loop - -} // namespace tvmet - -#endif /* TVMET_LOOP_GEMM_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/loop/Gemmt.h b/tvmet-1.7.1/include/tvmet/loop/Gemmt.h deleted file mode 100644 index 045773072..000000000 --- a/tvmet-1.7.1/include/tvmet/loop/Gemmt.h +++ /dev/null @@ -1,114 +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: Gemmt.h,v 1.5 2004/06/16 09:30:07 opetzold Exp $ - */ - -#ifndef TVMET_LOOP_GEMMT_H -#define TVMET_LOOP_GEMMT_H - -namespace tvmet { - -namespace loop { - - -/** - * \class gemmt Gemmt.h "tvmet/loop/Gemmt.h" - * \brief class for for product matrix-transpose(matrix) operations. - * using formula - * \f[ - * M_1\,M_2^{T} - * \f] - * \par Example: - * \code - * template<class T, int Rows1, int Cols1, int Cols2> - * inline - * void - * prod(const Matrix<T, Rows1, Cols1>& lhs, const Matrix<T, Rows2, Cols1>& rhs, - * Matrix<T, Rows1, Rows2>& dest) - * { - * for (int i = 0; i != Rows1; ++i) { - * for (int j = 0; j != Rows2; ++j) { - * dest(i, j) = tvmet::loop::gemmt<Rows1, Cols1, Cols1>().prod(lhs, rhs, i, j); - * } - * } - * } - * \endcode - * \note The number of cols of rhs matrix have to be equal to cols of rhs matrix. - * The result is a (Rows1 x Rows2) matrix. - */ -template<int Rows1, int Cols1, - int Cols2 /* unused */> -class gemmt -{ - gemmt(const gemmt&); - gemmt& operator=(const gemmt&); - -private: - enum { - count = Cols1, - N = (count+7)/8 - }; - -public: - gemmt() { } - -public: - template<class E1, class E2> - static inline - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type - prod(const E1& lhs, const E2& rhs, int i, int j) { - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type sum(0); - int k(0); - int n(N); - - // Duff's device - switch(count % 8) { - case 0: do { sum += lhs(i, k) * rhs(j, k); ++k; - case 7: sum += lhs(i, k) * rhs(j, k); ++k; - case 6: sum += lhs(i, k) * rhs(j, k); ++k; - case 5: sum += lhs(i, k) * rhs(j, k); ++k; - case 4: sum += lhs(i, k) * rhs(j, k); ++k; - case 3: sum += lhs(i, k) * rhs(j, k); ++k; - case 2: sum += lhs(i, k) * rhs(j, k); ++k; - case 1: sum += lhs(i, k) * rhs(j, k); ++k; - } while(--n != 0); - } - - return sum; - } -}; - - -} // namespace loop - -} // namespace tvmet - -#endif /* TVMET_LOOP_GEMMT_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/loop/Gemtm.h b/tvmet-1.7.1/include/tvmet/loop/Gemtm.h deleted file mode 100644 index a91caa011..000000000 --- a/tvmet-1.7.1/include/tvmet/loop/Gemtm.h +++ /dev/null @@ -1,115 +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: Gemtm.h,v 1.5 2004/06/16 09:30:07 opetzold Exp $ - */ - -#ifndef TVMET_LOOP_GEMTM_H -#define TVMET_LOOP_GEMTM_H - -namespace tvmet { - -namespace loop { - - -/** - * \class gemtm Gemtm.h "tvmet/loop/Gemtm.h" - * \brief class for matrix-matrix product using loop unrolling. - * using formula - * \f[ - * M_1^{T}\,M_2 - * \f] - * \par Example: - * \code - * template<class T, int Rows1, int Cols1, int Cols2> - * inline - * void - * prod(const Matrix<T, Rows1, Cols1>& lhs, const Matrix<T, Rows1, Cols2>& rhs, - * Matrix<T, Cols2, Cols1>& dest) - * { - * for (int i = 0; i != Cols1; ++i) { - * for (int j = 0; j != Cols2; ++j) { - * dest(i, j) = tvmet::loop::gemtm<Rows1, Cols1, Cols2>::prod(lhs, rhs, i, j); - * } - * } - * } - * \endcode - * \note The number of rows of rhs matrix have to be equal rows of rhs matrix, - * since lhs matrix 1 is transposed. - * The result is a (Cols1 x Cols2) matrix. - */ -template<int Rows1, int Cols1, - int Cols2> -class gemtm -{ - gemtm(const gemtm&); - gemtm& operator=(const gemtm&); - -private: - enum { - count = Cols1, - N = (count+7)/8 - }; - -public: - gemtm() { } - -public: - template<class E1, class E2> - static inline - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type - prod(const E1& lhs, const E2& rhs, int i, int j) { - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type sum(0); - int k(0); - int n(N); - - // Duff's device - switch(count % 8) { - case 0: do { sum += lhs(k, i) * rhs(k, j); ++k; - case 7: sum += lhs(k, i) * rhs(k, j); ++k; - case 6: sum += lhs(k, i) * rhs(k, j); ++k; - case 5: sum += lhs(k, i) * rhs(k, j); ++k; - case 4: sum += lhs(k, i) * rhs(k, j); ++k; - case 3: sum += lhs(k, i) * rhs(k, j); ++k; - case 2: sum += lhs(k, i) * rhs(k, j); ++k; - case 1: sum += lhs(k, i) * rhs(k, j); ++k; - } while(--n != 0); - } - - return sum; - } -}; - - -} // namespace loop - -} // namespace tvmet - -#endif /* TVMET_LOOP_GEMTM_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/loop/Gemtv.h b/tvmet-1.7.1/include/tvmet/loop/Gemtv.h deleted file mode 100644 index 1584ab6a3..000000000 --- a/tvmet-1.7.1/include/tvmet/loop/Gemtv.h +++ /dev/null @@ -1,109 +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: Gemtv.h,v 1.3 2004/06/16 09:30:07 opetzold Exp $ - */ - -#ifndef TVMET_LOOP_GEMTV_H -#define TVMET_LOOP_GEMTV_H - -namespace tvmet { - -namespace loop { - - -/** - * \class gemtv Gemtv.h "tvmet/loop/Gemtv.h" - * \brief class for transposed(matrix)-vector product using loop unrolling. - * using formula - * \f[ - * M^T\,v - * \f] - * \par Example: - * \code - * template<class T, int Rows, int Cols> - * inline - * void - * prod(const Matrix<T, Rows, Cols>& lhs, const Vector<T, Rows>& rhs, - * Vector<T, Cols>& dest) - * { - * for (int i = 0; i != Cols; ++i) { - * dest(i) = tvmet::loop::gemtv<Rows, Cols>().prod(lhs, rhs, i); - * } - * } - * \endcode - */ -template<int Rows, int Cols> -class gemtv -{ - gemtv(const gemtv&); - gemtv& operator=(const gemtv&); - -private: - enum { - count = Rows, - N = (count+7)/8 - }; - -public: - gemtv() { } - -public: - template<class E1, class E2> - static inline - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type - prod(const E1& lhs, const E2& rhs, int i) { - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type sum(0); - int j(0); - int n(N); - - // Duff's device - switch(count % 8) { - case 0: do { sum += lhs(j, i) * rhs(j); ++j; - case 7: sum += lhs(j, i) * rhs(j); ++j; - case 6: sum += lhs(j, i) * rhs(j); ++j; - case 5: sum += lhs(j, i) * rhs(j); ++j; - case 4: sum += lhs(j, i) * rhs(j); ++j; - case 3: sum += lhs(j, i) * rhs(j); ++j; - case 2: sum += lhs(j, i) * rhs(j); ++j; - case 1: sum += lhs(j, i) * rhs(j); ++j; - } while(--n != 0); - } - - return sum; - } -}; - - -} // namespace loop - -} // namespace tvmet - -#endif /* TVMET_LOOP_GEMTV_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/loop/Gemv.h b/tvmet-1.7.1/include/tvmet/loop/Gemv.h deleted file mode 100644 index 01118a93d..000000000 --- a/tvmet-1.7.1/include/tvmet/loop/Gemv.h +++ /dev/null @@ -1,109 +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: Gemv.h,v 1.3 2004/06/16 09:30:07 opetzold Exp $ - */ - -#ifndef TVMET_LOOP_GEMV_H -#define TVMET_LOOP_GEMV_H - -namespace tvmet { - -namespace loop { - - -/** - * \class gemv Gemv.h "tvmet/loop/Gemv.h" - * \brief class for matrix-vector product using loop unrolling. - * using formula - * \f[ - * M\,v - * \f] - * \par Example: - * \code - * template<class T, int Rows, int Cols> - * inline - * void - * prod(const Matrix<T, Rows, Cols>& lhs, const Vector<T, Cols>& rhs, - * Vector<T, Rows>& dest) - * { - * for (int i = 0; i != Rows; ++i) { - * dest(i) = tvmet::loop::gemv<Rows, Cols>().prod(lhs, rhs, i); - * } - * } - * \endcode - */ -template<int Rows, int Cols> -class gemv -{ - gemv(const gemv&); - gemv& operator=(const gemv&); - -private: - enum { - count = Cols, - N = (count+7)/8 - }; - -public: - gemv() { } - -public: - template<class E1, class E2> - static inline - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type - prod(const E1& lhs, const E2& rhs, int i) { - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type sum(0); - int j(0); - int n(N); - - // Duff's device - switch(count % 8) { - case 0: do { sum += lhs(i, j) * rhs(j); ++j; - case 7: sum += lhs(i, j) * rhs(j); ++j; - case 6: sum += lhs(i, j) * rhs(j); ++j; - case 5: sum += lhs(i, j) * rhs(j); ++j; - case 4: sum += lhs(i, j) * rhs(j); ++j; - case 3: sum += lhs(i, j) * rhs(j); ++j; - case 2: sum += lhs(i, j) * rhs(j); ++j; - case 1: sum += lhs(i, j) * rhs(j); ++j; - } while(--n != 0); - } - - return sum; - } -}; - - -} // namespace loop - -} // namespace tvmet - -#endif /* TVMET_LOOP_GEMV_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/loop/Matrix.h b/tvmet-1.7.1/include/tvmet/loop/Matrix.h deleted file mode 100644 index beea9f5fe..000000000 --- a/tvmet-1.7.1/include/tvmet/loop/Matrix.h +++ /dev/null @@ -1,65 +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: Matrix.h,v 1.7 2004/06/27 20:32:55 opetzold Exp $ - */ - -#ifndef TVMET_LOOP_MATRIX_H -#define TVMET_LOOP_MATRIX_H - -namespace tvmet { - -namespace loop { - - -/** - * \class Matrix Matrix.h "tvmet/loop/Matrix.h" - * \brief Loop %Matrix class using expression and loop templates. - */ -template<int Rows, int Cols> -class Matrix -{ - Matrix(const Matrix&); - Matrix& operator=(const Matrix&); - -public: - Matrix() { } - -public: - /** assign an expression on columns on given row using the functional fn. */ - template<class E1, class E2, class Assign> - static inline - void assign(E1& lhs, const E2& rhs, const Assign& assign_fn) { - for(int i = 0; i != Rows; ++i) - for(int j = 0; j != Cols; ++j) - assign_fn.apply_on(lhs(i, j), rhs(i, j)); - } -}; - - -} // namespace loop - -} // namespace tvmet - -#endif /* TVMET_LOOP_MATRIX_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/loop/Vector.h b/tvmet-1.7.1/include/tvmet/loop/Vector.h deleted file mode 100644 index 5462ad7a1..000000000 --- a/tvmet-1.7.1/include/tvmet/loop/Vector.h +++ /dev/null @@ -1,64 +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: Vector.h,v 1.5 2004/06/27 20:32:55 opetzold Exp $ - */ - -#ifndef TVMET_LOOP_VECTOR_H -#define TVMET_LOOP_VECTOR_H - -namespace tvmet { - -namespace loop { - - -/** - * \class Vector Vector.h "tvmet/loop/Vector.h" - * \brief Loop %Vector class using expression and loop templates. - */ -template<int Sz> -class Vector -{ - Vector(const Vector&); - Vector& operator=(const Vector&); - -public: - Vector() { } - -public: - /** assign an expression on columns on given row using the functional fn. */ - template<class E1, class E2, class Assign> - static inline - void assign(E1& lhs, const E2& rhs, const Assign& assign_fn) { - for(int i = 0; i != Sz; ++i) - assign_fn.apply_on(lhs(i), rhs(i)); - } -}; - - -} // namespace loop - -} // namespace tvmet - -#endif /* TVMET_LOOP_VECTOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/meta/CMakeLists.txt b/tvmet-1.7.1/include/tvmet/meta/CMakeLists.txt deleted file mode 100644 index 0f65437c3..000000000 --- a/tvmet-1.7.1/include/tvmet/meta/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -FILE(GLOB tvmet_meta_header_SRCS "*.h") - -INSTALL(FILES - ${tvmet_meta_header_SRCS} - DESTINATION ${INCLUDE_INSTALL_DIR}/meta - ) diff --git a/tvmet-1.7.1/include/tvmet/meta/Gemm.h b/tvmet-1.7.1/include/tvmet/meta/Gemm.h deleted file mode 100644 index 7aad8e354..000000000 --- a/tvmet-1.7.1/include/tvmet/meta/Gemm.h +++ /dev/null @@ -1,101 +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: Gemm.h,v 1.11 2004/06/17 15:53:12 opetzold Exp $ - */ - -#ifndef TVMET_META_GEMM_H -#define TVMET_META_GEMM_H - -#include <tvmet/xpr/Null.h> - -namespace tvmet { - -namespace meta { - - -/** - * \class gemm Gemm.h "tvmet/meta/Gemm.h" - * \brief Meta class for matrix-matrix operations, like product - * using formula - * \f[ - * M_1\,M_2 - * \f] - * \note The rows of matrix 2 have to be equal to cols of matrix 1. - */ -template<int Rows1, int Cols1, - int Cols2, - int K> -class gemm -{ - gemm(); - gemm(const gemm&); - gemm& operator=(const gemm&); - -private: - enum { - doIt = (K != Cols1 - 1) /**< recursive counter */ - }; - -public: - template<class E1, class E2> - static inline - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type - prod(const E1& lhs, const E2& rhs, int i, int j) { - return lhs(i, K) * rhs(K, j) - + gemm<Rows1 * doIt, Cols1 * doIt, - Cols2 * doIt, - (K+1) * doIt>::prod(lhs, rhs, i, j); - } -}; - - -/** - * \class gemm<0,0,0,0> Gemm.h "tvmet/meta/Gemm.h" - * \brief gemm Specialized for recursion. - */ -template<> -class gemm<0,0,0,0> -{ - gemm(); - gemm(const gemm&); - gemm& operator=(const gemm&); - -public: - template<class E1, class E2> - static inline - XprNull prod(const E1&, const E2&, int, int) { - return XprNull(); - } -}; - - -} // namespace meta - -} // namespace tvmet - -#endif /* TVMET_META_GEMM_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/meta/Gemmt.h b/tvmet-1.7.1/include/tvmet/meta/Gemmt.h deleted file mode 100644 index a3669be5c..000000000 --- a/tvmet-1.7.1/include/tvmet/meta/Gemmt.h +++ /dev/null @@ -1,102 +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: Gemmt.h,v 1.9 2004/06/17 15:53:12 opetzold Exp $ - */ - -#ifndef TVMET_META_GEMMT_H -#define TVMET_META_GEMMT_H - -#include <tvmet/xpr/Null.h> - -namespace tvmet { - -namespace meta { - - -/** - * \class gemmt Gemmt.h "tvmet/meta/Gemmt.h" - * \brief Meta class for product matrix-transpose(matrix) operations. - * using formula - * \f[ - * M_1\,M_2^{T} - * \f] - * \note The rows of matrix 2 have to be equal to cols of matrix 1. The result - * is a rows1 * cols2 matrix. - */ -template<int Rows1, int Cols1, - int Cols2, - int K> -class gemmt -{ - gemmt(); - gemmt(const gemmt&); - gemmt& operator=(const gemmt&); - -private: - enum { - doIt = (K != Cols2 - 1) /**< recursive counter */ - }; - -public: - template<class E1, class E2> - static inline - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type - prod(const E1& lhs, const E2& rhs, int i, int j) { - return lhs(i, K) * rhs(j, K) - + gemmt<Rows1 * doIt, Cols1 * doIt, - Cols2 * doIt, - (K+1) * doIt>::prod(lhs, rhs, i, j); - } -}; - - -/** - * \class gemmt<0,0,0,0> Gemmt.h "tvmet/meta/Gemmt.h" - * \brief gemmt Specialized for recursion. - */ -template<> -class gemmt<0,0,0,0> -{ - gemmt(); - gemmt(const gemmt&); - gemmt& operator=(const gemmt&); - -public: - template<class E1, class E2> - static inline - XprNull prod(const E1&, const E2&, int, int) { - return XprNull(); - } -}; - - -} // namespace meta - -} // namespace tvmet - -#endif /* TVMET_META_GEMMT_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/meta/Gemtm.h b/tvmet-1.7.1/include/tvmet/meta/Gemtm.h deleted file mode 100644 index 815175d43..000000000 --- a/tvmet-1.7.1/include/tvmet/meta/Gemtm.h +++ /dev/null @@ -1,105 +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: Gemtm.h,v 1.8 2004/06/17 15:53:12 opetzold Exp $ - */ - -#ifndef TVMET_META_GEMTM_H -#define TVMET_META_GEMTM_H - -#include <tvmet/xpr/Null.h> - -namespace tvmet { - -namespace meta { - - -/** - * \class gemtm Gemtm.h "tvmet/meta/Gemtm.h" - * \brief Meta class for trans(matrix)-matrix operations, like product. - * using formula - * \f[ - * M_1^{T}\,M_2 - * \f] - * \note The number of cols of matrix 2 have to be equal to number of rows of - * matrix 1, since matrix 1 is transposed - the result is a (Cols1 x Cols2) - * matrix. - */ - -template<int Rows1, int Cols1, - int Cols2, - int K> -class gemtm -{ -private: - gemtm(); - gemtm(const gemtm&); - gemtm& operator=(const gemtm&); - -private: - enum { - doIt = (K != Rows1 - 1) /**< recursive counter */ - }; - -public: - template<class E1, class E2> - static inline - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type - prod(const E1& lhs, const E2& rhs, int i, int j) { - return lhs(K, i) * rhs(K, j) - + gemtm<Rows1 * doIt, Cols1 * doIt, - Cols2 * doIt, - (K+1) * doIt>::prod(lhs, rhs, i, j); - } -}; - - -/** - * \class gemtm<0,0,0,0> Gemtm.h "tvmet/meta/Gemtm.h" - * \brief gemtm Specialized for recursion. - */ -template<> -class gemtm<0,0,0,0> -{ - gemtm(); - gemtm(const gemtm&); - gemtm& operator=(const gemtm&); - -public: - template<class E1, class E2> - static inline - XprNull prod(const E1&, const E2&, int, int) { - return XprNull(); - } -}; - - -} // namespace meta - -} // namespace tvmet - -#endif /* TVMET_META_GEMTM_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/meta/Gemtv.h b/tvmet-1.7.1/include/tvmet/meta/Gemtv.h deleted file mode 100644 index 93c333687..000000000 --- a/tvmet-1.7.1/include/tvmet/meta/Gemtv.h +++ /dev/null @@ -1,99 +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: Gemtv.h,v 1.4 2004/06/17 15:53:12 opetzold Exp $ - */ - -#ifndef TVMET_META_GEMTV_H -#define TVMET_META_GEMTV_H - -#include <tvmet/xpr/Null.h> - -namespace tvmet { - -namespace meta { - - -/** - * \class gemtv Gemtv.h "tvmet/meta/Gemtv.h" - * \brief Meta class for matrix-transpose-vector operations. - * using formula - * \f[ - * M^T\,v - * \f] - */ -template<int Rows, int Cols, - int I> -class gemtv -{ - gemtv(); - gemtv(const gemtv&); - gemtv& operator=(const gemtv&); - -private: - enum { - doIt = I < (Rows-1) /**< recursive counter */ - }; - -public: - /** Meta template for %Matrix lhs %Vector rhs product. */ - template<class E1, class E2> - static inline - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type - prod(const E1& lhs, const E2& rhs, int j) { - return lhs(I, j) * rhs(I) - + gemtv<Rows * doIt, Cols * doIt, - (I+1)* doIt>::prod(lhs, rhs, j); - } -}; - - -/** - * \class gemtv<0,0,0> Gemtv.h "tvmet/meta/Gemtv.h" - * \brief gemtv Specialized for recursion - */ -template<> -class gemtv<0,0,0> -{ - gemtv(); - gemtv(const gemtv&); - gemtv& operator=(const gemtv&); - -public: - template<class E1, class E2> - static inline - XprNull prod(const E1&, const E2&, int) { - return XprNull(); - } -}; - - -} // namespace meta - -} // namespace tvmet - -#endif /* TVMET_META_GEMTV_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/meta/Gemv.h b/tvmet-1.7.1/include/tvmet/meta/Gemv.h deleted file mode 100644 index fda045f71..000000000 --- a/tvmet-1.7.1/include/tvmet/meta/Gemv.h +++ /dev/null @@ -1,99 +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: Gemv.h,v 1.9 2004/06/17 15:53:12 opetzold Exp $ - */ - -#ifndef TVMET_META_GEMV_H -#define TVMET_META_GEMV_H - -#include <tvmet/xpr/Null.h> - -namespace tvmet { - -namespace meta { - - -/** - * \class gemv Gemv.h "tvmet/meta/Gemv.h" - * \brief Meta class for matrix-vector operations. - * using formula - * \f[ - * M\,v - * \f] - */ -template<int Rows, int Cols, - int J> -class gemv -{ - gemv(); - gemv(const gemv&); - gemv& operator=(const gemv&); - -private: - enum { - doIt = J < (Cols-1) /**< recursive counter */ - }; - -public: - /** Meta template for %Matrix lhs %Vector rhs product. */ - template<class E1, class E2> - static inline - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type - prod(const E1& lhs, const E2& rhs, int i) { - return lhs(i, J) * rhs(J) - + gemv<Rows * doIt, Cols * doIt, - (J+1)* doIt>::prod(lhs, rhs, i); - } -}; - - -/** - * \class gemv<0,0,0> Gemv.h "tvmet/meta/Gemv.h" - * \brief gemv Specialized for recursion - */ -template<> -class gemv<0,0,0> -{ - gemv(); - gemv(const gemv&); - gemv& operator=(const gemv&); - -public: - template<class E1, class E2> - static inline - XprNull prod(const E1&, const E2&, int) { - return XprNull(); - } -}; - - -} // namespace meta - -} // namespace tvmet - -#endif /* TVMET_META_GEMV_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/meta/Matrix.h b/tvmet-1.7.1/include/tvmet/meta/Matrix.h deleted file mode 100644 index b6b4014dc..000000000 --- a/tvmet-1.7.1/include/tvmet/meta/Matrix.h +++ /dev/null @@ -1,165 +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: Matrix.h,v 1.15 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_META_MATRIX_H -#define TVMET_META_MATRIX_H - -#include <tvmet/Traits.h> -#include <tvmet/xpr/Null.h> - -namespace tvmet { - -namespace meta { - - -/** - * \class Matrix Matrix.h "tvmet/meta/Matrix.h" - * \brief Meta %Matrix class using expression and meta templates. - */ -template<int Rows, int Cols, - int M=0, int N=0> -class Matrix -{ - Matrix(); - Matrix(const Matrix&); - Matrix& operator=(const Matrix&); - -private: - enum { - doRows = (M < Rows - 1) ? 1 : 0, /**< recursive counter Rows. */ - doCols = (N < Cols - 1) ? 1 : 0 /**< recursive counter Cols. */ - }; - -public: - /** assign an expression on columns on given row using the functional assign_fn. */ - template<class Dest, class Src, class Assign> - static inline - void assign2(Dest& lhs, const Src& rhs, const Assign& assign_fn) { - assign_fn.apply_on(lhs(M, N), rhs(M, N)); - Matrix<Rows * doCols, Cols * doCols, - M * doCols, (N+1) * doCols>::assign2(lhs, rhs, assign_fn); - } - - /** assign an expression on row-wise using the functional assign_fn. */ - template<class Dest, class Src, class Assign> - static inline - void assign(Dest& lhs, const Src& rhs, const Assign& assign_fn) { - Matrix<Rows, Cols, - M, 0>::assign2(lhs, rhs, assign_fn); - Matrix<Rows * doRows, Cols * doRows, - (M+1) * doRows, 0>::assign(lhs, rhs, assign_fn); - } - - /** evaluate a given matrix expression, column wise. */ - template<class E> - static inline - bool all_elements2(const E& e) { - if(!e(M, N)) return false; - return Matrix<Rows * doCols, Cols * doCols, - M * doCols, (N+1) * doCols>::all_elements2(e); - } - - /** evaluate a given matrix expression, row wise. */ - template<class E> - static inline - bool all_elements(const E& e) { - if(!Matrix<Rows, Cols, M, 0>::all_elements2(e) ) return false; - return Matrix<Rows * doRows, Cols * doRows, - (M+1) * doRows, 0>::all_elements(e); - } - - /** evaluate a given matrix expression, column wise. */ - template<class E> - static inline - bool any_elements2(const E& e) { - if(e(M, N)) return true; - return Matrix<Rows * doCols, Cols * doCols, - M * doCols, (N+1) * doCols>::any_elements2(e); - } - - /** evaluate a given matrix expression, row wise. */ - template<class E> - static inline - bool any_elements(const E& e) { - if(Matrix<Rows, Cols, M, 0>::any_elements2(e) ) return true; - return Matrix<Rows * doRows, Cols * doRows, - (M+1) * doRows, 0>::any_elements(e); - } - - /** trace a given matrix expression. */ - template<class E> - static inline - typename E::value_type - trace(const E& e) { - return e(M, N) - + Matrix<Rows * doCols, Cols * doCols, - (M+1) * doCols, (N+1) * doCols>::trace(e); - } - -}; - - -/** - * \class Matrix<0, 0, 0, 0> Matrix.h "tvmet/meta/Matrix.h" - * \brief Meta %Matrix specialized for recursion. - */ -template<> -class Matrix<0, 0, 0, 0> -{ - Matrix(); - Matrix(const Matrix&); - Matrix& operator=(const Matrix&); - -public: - template<class Dest, class Src, class Assign> - static inline void assign2(Dest&, const Src&, const Assign&) { } - - template<class Dest, class Src, class Assign> - static inline void assign(Dest&, const Src&, const Assign&) { } - - template<class E> - static inline bool all_elements2(const E&) { return true; } - - template<class E> - static inline bool all_elements(const E&) { return true; } - - template<class E> - static inline bool any_elements2(const E&) { return false; } - - template<class E> - static inline bool any_elements(const E&) { return false; } - - template<class E> - static inline XprNull trace(const E&) { return XprNull(); } -}; - - -} // namespace meta - -} // namespace tvmet - -#endif /* TVMET_META_MATRIX_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/meta/Vector.h b/tvmet-1.7.1/include/tvmet/meta/Vector.h deleted file mode 100644 index 02888c4cb..000000000 --- a/tvmet-1.7.1/include/tvmet/meta/Vector.h +++ /dev/null @@ -1,154 +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: Vector.h,v 1.20 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_META_VECTOR_H -#define TVMET_META_VECTOR_H - -#include <tvmet/Traits.h> -#include <tvmet/xpr/Null.h> - -namespace tvmet { - -/* forwards */ -template<class T, int Sz> class Vector; - - -namespace meta { - - -/** - * \class Vector Vector.h "tvmet/meta/Vector.h" - * \brief Meta %Vector class using expression templates - */ -template<int Sz, int K=0> -class Vector -{ - Vector(); - Vector(const Vector&); - Vector& operator=(const Vector&); - -private: - enum { - doIt = (K < (Sz-1)) ? 1 : 0 /**< recursive counter */ - }; - -public: - /** assign an expression expr using the functional assign_fn. */ - template <class Dest, class Src, class Assign> - static inline - void assign(Dest& lhs, const Src& rhs, const Assign& assign_fn) { - assign_fn.apply_on(lhs(K), rhs(K)); - meta::Vector<Sz * doIt, (K+1) * doIt>::assign(lhs, rhs, assign_fn); - } - - /** build the sum of the vector. */ - template<class E> - static inline - typename E::value_type - sum(const E& e) { - return e(K) + meta::Vector<Sz * doIt, (K+1) * doIt>::sum(e); - } - - /** build the product of the vector. */ - template<class E> - static inline - typename Traits< - typename E::value_type - >::sum_type - product(const E& e) { - return e(K) * meta::Vector<Sz * doIt, (K+1) * doIt>::product(e); - } - - /** build the dot product of the vector. */ - template<class Dest, class Src> - static inline - typename PromoteTraits< - typename Dest::value_type, - typename Src::value_type - >::value_type - dot(const Dest& lhs, const Src& rhs) { - return lhs(K) * rhs(K) - + meta::Vector<Sz * doIt, (K+1) * doIt>::dot(lhs, rhs); - } - - /** check for all elements */ - template<class E> - static inline - bool - all_elements(const E& e) { - if(!e(K)) return false; - return meta::Vector<Sz * doIt, (K+1) * doIt>::all_elements(e); - } - - /** check for any elements */ - template<class E> - static inline - bool - any_elements(const E& e) { - if(e(K)) return true; - return meta::Vector<Sz * doIt, (K+1) * doIt>::any_elements(e); - } -}; - - -/** - * \class Vector<0,0> Vector.h "tvmet/meta/Vector.h" - * \brief Meta %Vector Specialized for recursion - */ -template<> -class Vector<0,0> -{ - Vector(); - Vector(const Vector&); - Vector& operator=(const Vector&); - -public: - template <class Dest, class Src, class Assign> - static inline void assign(Dest&, const Src&, const Assign&) { } - - template<class E> - static inline XprNull sum(const E&) { return XprNull(); } - - template<class E> - static inline XprNull product(const E&) { return XprNull(); } - - template<class Dest, class Src> - static inline XprNull dot(const Dest&, const Src&) { return XprNull(); } - - template<class E> - static inline bool all_elements(const E&) { return true; } - - template<class E> - static inline bool any_elements(const E&) { return false; } -}; - - -} // namespace meta - -} // namespace tvmet - -#endif /* TVMET_META_VECTOR_H */ - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/tvmet.h b/tvmet-1.7.1/include/tvmet/tvmet.h deleted file mode 100644 index 9af49498a..000000000 --- a/tvmet-1.7.1/include/tvmet/tvmet.h +++ /dev/null @@ -1,140 +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: tvmet.h,v 1.17 2004/11/04 16:28:32 opetzold Exp $ - */ - -#ifndef TVMET_H -#define TVMET_H - -#include <tvmet/config.h> - -// this might not work on all platforms. Specifically, Qt uses a -// slightly different solution in the case when compiler==intel && -// os != windows. See in Qt's source code, the definition of Q_UNUSED -// in src/corelib/global/qglobal.h -#define TVMET_UNUSED(x) (void)x - -/* - * Complexity triggers, compiler and architecture specific. - * If not defined, use defaults. - */ - -/** - * \def TVMET_COMPLEXITY_DEFAULT_TRIGGER - * \brief Trigger for changing the matrix-product strategy. - */ -#if !defined(TVMET_COMPLEXITY_DEFAULT_TRIGGER) -# define TVMET_COMPLEXITY_DEFAULT_TRIGGER 1000 -#endif - -/** - * \def TVMET_COMPLEXITY_M_ASSIGN_TRIGGER - * \brief Trigger for changing the matrix assign strategy. - */ -#if !defined(TVMET_COMPLEXITY_M_ASSIGN_TRIGGER) -# define TVMET_COMPLEXITY_M_ASSIGN_TRIGGER 8*8 -#endif - -/** - * \def TVMET_COMPLEXITY_MM_TRIGGER - * \brief Trigger for changing the matrix-matrix-product strategy. - * One strategy to build the matrix-matrix-product is to use - * meta templates. The other to use looping. - */ -#if !defined(TVMET_COMPLEXITY_MM_TRIGGER) -# define TVMET_COMPLEXITY_MM_TRIGGER 8*8 -#endif - -/** - * \def TVMET_COMPLEXITY_V_ASSIGN_TRIGGER - * \brief Trigger for changing the vector assign strategy. - */ -#if !defined(TVMET_COMPLEXITY_V_ASSIGN_TRIGGER) -# define TVMET_COMPLEXITY_V_ASSIGN_TRIGGER 8 -#endif - -/** - * \def TVMET_COMPLEXITY_MV_TRIGGER - * \brief Trigger for changing the matrix-vector strategy. - * One strategy to build the matrix-vector-product is to use - * meta templates. The other to use looping. - */ -#if !defined(TVMET_COMPLEXITY_MV_TRIGGER) -# define TVMET_COMPLEXITY_MV_TRIGGER 8*8 -#endif - -/*********************************************************************** - * Namespaces - ***********************************************************************/ - -/** - * \namespace std - * \brief Imported ISO/IEC 14882:1998 functions from std namespace. - */ - -/** - * \namespace tvmet - * \brief The namespace for the Tiny %Vector %Matrix using Expression Templates Libary. - */ - -/** - * \namespace tvmet::meta - * \brief Meta stuff inside here. - */ - -/** - * \namespace tvmet::loop - * \brief Loop stuff inside here. - */ - -/** - * \namespace tvmet::element_wise - * \brief Operators inside this namespace does elementwise operations. - */ - -/** - * \namespace tvmet::util - * \brief Miscellaneous utility functions used. - */ - - -/*********************************************************************** - * forwards - ***********************************************************************/ -#if defined(EIGEN_USE_COMPLEX) -namespace std { - template<class T> class complex; -} -#endif - - -/*********************************************************************** - * other stuff - ***********************************************************************/ -#include <tvmet/TvmetBase.h> - - -#endif // TVMET_H - -// Local Variables: -// mode:C++ -// End: -// LocalWords: gnuc gcc's icc's std diff --git a/tvmet-1.7.1/include/tvmet/util/General.h b/tvmet-1.7.1/include/tvmet/util/General.h deleted file mode 100644 index f6247d4b8..000000000 --- a/tvmet-1.7.1/include/tvmet/util/General.h +++ /dev/null @@ -1,125 +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: General.h,v 1.9 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_UTIL_GENERAL_H -#define TVMET_UTIL_GENERAL_H - - -/** forward */ -namespace tvmet { -template<class T, int Rows, int Cols> class Matrix; -template<class T, int Sz> class Vector; -} - -namespace tvmet { - -namespace util { - -/* - * \defgroup _util_function - * \brief Usefull utility functions - */ - -/** - * \fn Gemm(const Matrix<T, Rows, Cols>& m1, const Matrix<T, Rows, Cols>& m2, Matrix<T, Rows, Cols>& m3) - * \brief General matrix matrix multiplication using loops. - * \ingroup _util_function - */ -template<class T, int Rows, int Cols> -inline -void -Gemm(const Matrix<T, Rows, Cols>& m1, const Matrix<T, Rows, Cols>& m2, - Matrix<T, Rows, Cols>& m3) -{ - for (int i = 0; i < Rows; ++i) { - for (int j = 0; j < Cols; ++j) { - T sum(0); - for (int k = 0; k < Cols; ++k) { - sum += m1(i,k) * m2(k,j); - } - m3(i,j) = sum; - } - } -} - - -/** - * \fn Gemv(const Matrix<T, Rows, Cols>& m, const Vector<T, Cols>& v, Vector<T, Cols>& v2) - * \brief General matrix vector multiplication using loops. - * \ingroup _util_function - */ -template<class T, int Rows, int Cols> -inline -void -Gemv(const Matrix<T, Rows, Cols>& m, const Vector<T, Cols>& v, - Vector<T, Cols>& v2) -{ - for (int i = 0; i < Rows; ++i){ - v2(i) = T(0); // clean up before use - for (int j = 0; j < Cols; ++j) { - v2(i) += m(i,j) * v(j); - } - } -} - - -/** - * \fn Gevvmul(const Vector<T, Sz>& v1, const Vector<T, Sz>& v2, Vector<T, Sz>& v3) - * \brief General vector vector elementwise multiplication using loop. - * \ingroup _util_function - */ -template<class T, int Sz> -inline -void -Gevvmul(const Vector<T, Sz>& v1, const Vector<T, Sz>& v2, - Vector<T, Sz>& v3) -{ - for(int i = 0; i < Sz; ++i) - v3(i) = v1(i) * v2(i); -} - - -/** - * \fn Gevvadd(const Vector<T, Sz>& v1, const Vector<T, Sz>& v2, Vector<T, Sz>& v3) - * \brief General vector vector elementwise multiplication using loop. - * \ingroup _util_function - */ -template<class T, int Sz> -inline -void -Gevvadd(const Vector<T, Sz>& v1, const Vector<T, Sz>& v2, - Vector<T, Sz>& v3) -{ - for(int i = 0; i < Sz; ++i) - v3(i) = v1(i) + v2(i); -} - -} // namespace util - -} // namespace tvmet - -#endif // TVMET_UTIL_GENERAL_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/util/Incrementor.h b/tvmet-1.7.1/include/tvmet/util/Incrementor.h deleted file mode 100644 index 809865de7..000000000 --- a/tvmet-1.7.1/include/tvmet/util/Incrementor.h +++ /dev/null @@ -1,90 +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: Incrementor.h,v 1.3 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_UTIL_INCREMENTOR_H -#define TVMET_UTIL_INCREMENTOR_H - -namespace tvmet { - -namespace util { - - -/** - * \class Incrementor Incrementor.h "tvmet/util/Incrementor.h" - * \brief A simple incrementor class. - * The start value is given at construction time. After - * each access the class increments the internal counter. - * \ingroup _util_function - * - * \par Example: - * \code - * #include <algorithm> - * - * using namespace tvmet; - * - * ... - * - * std::generate(m1.begin(), m1.end(), - * util::Incrementor<typename matrix_type::value_type>()); - * \endcode - */ -template<class T> -struct Incrementor -{ - Incrementor(T start=0) : m_inc(start) { } - T operator()() { m_inc+=1; return m_inc; } - -private: - T m_inc; -}; - - -#if defined(EIGEN_USE_COMPLEX) -/** - * \class Incrementor< std::complex<T> > Incrementor.h "tvmet/util/Incrementor.h" - * \brief Specialized Incrementor class. - * \ingroup _util_function - */ -template<class T> -struct Incrementor< std::complex<T> > { - Incrementor(const std::complex<T>& start=0) - : m_inc(start) { } - std::complex<T> operator()() { - m_inc += std::complex<T>(1,1); - return m_inc; - } -private: - std::complex<T> m_inc; -}; -#endif // defined(EIGEN_USE_COMPLEX) - - -} // namespace util - -} // namespace tvmet - -#endif // TVMET_UTIL_INCREMENTOR_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/BinOperator.h b/tvmet-1.7.1/include/tvmet/xpr/BinOperator.h deleted file mode 100644 index 11ade5eb3..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/BinOperator.h +++ /dev/null @@ -1,104 +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: BinOperator.h,v 1.15 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_XPR_BINOPERATOR_H -#define TVMET_XPR_BINOPERATOR_H - -#include <tvmet/TypePromotion.h> - -namespace tvmet { - - -/** - * \class XprBinOp BinOperator.h "tvmet/xpr/BinOperator.h" - * \brief Binary operators working on two sub expressions. - * - * On acessing using the index operator() the binary operation will be - * evaluated at compile time. - */ -template<class BinOp, class E1, class E2> -class XprBinOp - : public TvmetBase< XprBinOp<BinOp, E1, E2> > -{ - XprBinOp(); - XprBinOp& operator=(const XprBinOp&); - -public: - typedef typename BinOp::value_type value_type; - -public: - /** Complexity counter. */ - enum { - ops_lhs = E1::ops, - ops_rhs = E2::ops, - ops = 2 * (ops_lhs + ops_rhs) // lhs op rhs - }; - -public: - /** Constructor for two expressions. */ - explicit XprBinOp(const E1& lhs, const E2& rhs) - : m_lhs(lhs), m_rhs(rhs) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprBinOp(const XprBinOp& e) - : m_lhs(e.m_lhs), m_rhs(e.m_rhs) - { } -#endif - - /** Index operator, evaluates the expression inside. */ - value_type operator()(int i) const { - return BinOp::apply_on(m_lhs(i), m_rhs(i)); - } - - /** Index operator for arrays/matrices */ - value_type operator()(int i, int j) const { - return BinOp::apply_on(m_lhs(i, j), m_rhs(i, j)); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprBinOp[O="<< ops << ", (O1=" << ops_lhs << ", O2=" << ops_rhs << ")]<" - << std::endl; - BinOp::print_xpr(os, l); - m_lhs.print_xpr(os, l); - m_rhs.print_xpr(os, l); - os << IndentLevel(--l) - << ">," << std::endl; - } - -private: - const E1 m_lhs; - const E2 m_rhs; -}; - - -} // namespace tvmet - -#endif // TVMET_XPR_BINOPERATOR_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/CMakeLists.txt b/tvmet-1.7.1/include/tvmet/xpr/CMakeLists.txt deleted file mode 100644 index 06cf78c0c..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -FILE(GLOB tvmet_xpr_header_SRCS "*.h") - -INSTALL(FILES - ${tvmet_xpr_header_SRCS} - DESTINATION ${INCLUDE_INSTALL_DIR}/xpr - ) diff --git a/tvmet-1.7.1/include/tvmet/xpr/Eval.h b/tvmet-1.7.1/include/tvmet/xpr/Eval.h deleted file mode 100644 index 7ed92161b..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/Eval.h +++ /dev/null @@ -1,115 +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: Eval.h,v 1.9 2003/11/30 18:35:17 opetzold Exp $ - */ - -#ifndef TVMET_XPR_EVAL_H -#define TVMET_XPR_EVAL_H - -namespace tvmet { - - -/** - * \class XprEval Eval.h "tvmet/xpr/Eval.h" - * \brief evaluate the expression - * - * Since we can't overwrite the ? operator we have to write a wrapper - * for expression like return v1>v2 ? true : false - */ -template<class E1, class E2, class E3> -class XprEval - : public TvmetBase< XprEval<E1, E2, E3> > -{ -public: - typedef E1 expr1_type; - typedef E2 expr2_type; - typedef E3 expr3_type; - - typedef typename expr2_type::value_type value2_type; - typedef typename expr3_type::value_type value3_type; - - typedef typename - PromoteTraits<value2_type, value3_type>::value_type value_type; - -public: - /** Complexity Counter */ - enum { - ops_expr1 = E1::ops, - ops_expr2 = E2::ops, - ops_expr3 = E3::ops, - ops = ops_expr1 // only (e1 op e2) are evaluated - }; - -private: - XprEval(); - XprEval& operator=(const XprEval<expr1_type, expr2_type, expr3_type>&); - -public: - /** Constructor */ - explicit XprEval(const expr1_type& e1, const expr2_type& e2, const expr3_type& e3) - : m_expr1(e1), m_expr2(e2), m_expr3(e3) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprEval(const XprEval& rhs) - : m_expr1(rhs.m_expr1), m_expr2(rhs.m_expr2), m_expr3(rhs.m_expr3) - { } -#endif - -public: //access - /** index operator for vectors. */ - value_type operator()(int i) const { - return m_expr1(i) ? m_expr2(i) : m_expr3(i); - } - - /** index operator for matrizes. */ - value_type operator()(int i, int j) const { - return m_expr1(i, j) ? m_expr2(i, j) : m_expr3(i, j); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprEval[" << ops << ", (" - << ops_expr1 << ", " << ops_expr2 << ", " << ops_expr3 << ")]<" - << std::endl; - m_expr1.print_xpr(os, l); - m_expr2.print_xpr(os, l); - m_expr3.print_xpr(os, l); - os << IndentLevel(--l) - << ">," << std::endl; - } - -private: - const expr1_type m_expr1; - const expr2_type m_expr2; - const expr3_type m_expr3; -}; - - -} // namespace tvmet - -#endif // TVMET_XPR_EVAL_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/Identity.h b/tvmet-1.7.1/include/tvmet/xpr/Identity.h deleted file mode 100644 index 7b13fa6b6..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/Identity.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * $Id: Identity.h,v 1.3 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_XPR_IDENTITY_H -#define TVMET_XPR_IDENTITY_H - - -namespace tvmet { - - -/** - * \class XprIdentity Identity.h "tvmet/xpr/Identity.h" - * \brief Expression for the identity matrix. - * - * This expression doesn't hold any other expression, it - * simply returns 1 or 0 depends where the row and column - * element excess is done. - * - * \since release 1.6.0 - * \sa identity - */ -template<class T, int Rows, int Cols> -struct XprIdentity - : public TvmetBase< XprIdentity<T, Rows, Cols> > -{ - XprIdentity& operator=(const XprIdentity&); - -public: - typedef T value_type; - -public: - /** Complexity counter. */ - enum { - ops_assign = Rows * Cols, - ops = ops_assign - }; - -public: - /** access by index. */ - value_type operator()(int i, int j) const { - return i==j ? 1 : 0; - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprIdentity[O="<< ops << ")]<" - << std::endl; - os << IndentLevel(l) - << typeid(T).name() << "," - << "R=" << Rows << ", C=" << Cols << std::endl; - os << IndentLevel(--l) << ">" - << ((l != 0) ? "," : "") << std::endl; - } -}; - - -} // namespace tvmet - - -#endif // TVMET_XPR_IDENTITY_H - - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/Literal.h b/tvmet-1.7.1/include/tvmet/xpr/Literal.h deleted file mode 100644 index 85d9c79c0..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/Literal.h +++ /dev/null @@ -1,89 +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: Literal.h,v 1.9 2003/11/30 18:35:17 opetzold Exp $ - */ - -#ifndef TVMET_XPR_LITERAL_H -#define TVMET_XPR_LITERAL_H - -namespace tvmet { - - -/** - * \class XprLiteral Literal.h "tvmet/xpr/Literal.h" - * \brief Specify literals like scalars into the expression. - * This expression is used for vectors and matrices - the - * decision is done by the access operator. - */ -template<class T> -class XprLiteral - : public TvmetBase< XprLiteral<T> > -{ - XprLiteral(); - XprLiteral& operator=(const XprLiteral&); - -public: - typedef T value_type; - -public: - /** Complexity counter. */ - enum { - ops = 1 - }; - -public: - /** Constructor by value for literals . */ - explicit XprLiteral(value_type value) - : m_data(value) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprLiteral(const XprLiteral& e) - : m_data(e.m_data) - { } -#endif - - /** Index operator, gives the value for vectors. */ - value_type operator()(int) const { return m_data; } - - /** Index operator for arrays/matrices. */ - value_type operator()(int, int) const { return m_data; } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) << "XprLiteral[O=" << ops << "]<T=" - << typeid(value_type).name() - << ">," << std::endl; - } - -private: - const value_type m_data; -}; - - -} // namespace tvmet - -#endif // TVMET_XPR_LITERAL_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MMProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MMProduct.h deleted file mode 100644 index 0d165ea8c..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MMProduct.h +++ /dev/null @@ -1,136 +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: MMProduct.h,v 1.20 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_XPR_MMPRODUCT_H -#define TVMET_XPR_MMPRODUCT_H - -#include <cassert> - -#include <tvmet/meta/Gemm.h> -#include <tvmet/loop/Gemm.h> - -namespace tvmet { - - -/** - * \class XprMMProduct MMProduct.h "tvmet/xpr/MMProduct.h" - * \brief Expression for matrix-matrix product. - * Using formula: - * \f[ - * M_1\,M_2 - * \f] - * \note The Rows2 has to be equal to Cols1. - */ -template<class E1, int Rows1, int Cols1, - class E2, int Cols2> -class XprMMProduct - : public TvmetBase< XprMMProduct<E1, Rows1, Cols1, E2, Cols2> > -{ -private: - XprMMProduct(); - XprMMProduct& operator=(const XprMMProduct&); - -public: - typedef typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type value_type; - -public: - /** Complexity counter. */ - enum { - ops_lhs = E1::ops, - ops_rhs = E2::ops, - M = Rows1 * Cols1 * Cols2, - N = Rows1 * (Cols1 - 1) * Cols2, - ops_plus = M * Traits<value_type>::ops_plus, - ops_muls = N * Traits<value_type>::ops_muls, - ops = ops_plus + ops_muls, - use_meta = Rows1*Cols2 < TVMET_COMPLEXITY_MM_TRIGGER ? true : false - }; - -public: - /** Constructor. */ - explicit XprMMProduct(const E1& lhs, const E2& rhs) - : m_lhs(lhs), m_rhs(rhs) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprMMProduct(const XprMMProduct& e) - : m_lhs(e.m_lhs), m_rhs(e.m_rhs) - { } -#endif - -private: - /** Wrapper for meta gemm. */ - static inline - value_type do_gemm(dispatch<true>, const E1& lhs, const E2& rhs, int i, int j) { - return meta::gemm<Rows1, Cols1, - Cols2, - 0>::prod(lhs, rhs, i, j); - } - - /** Wrapper for loop gemm. */ - static inline - value_type do_gemm(dispatch<false>, const E1& lhs, const E2& rhs, int i, int j) { - return loop::gemm<Rows1, Cols1, Cols2>::prod(lhs, rhs, i, j); - } - -public: - /** index operator for arrays/matrices */ - value_type operator()(int i, int j) const { - assert((i < Rows1) && (j < Cols2)); - return do_gemm(dispatch<use_meta>(), m_lhs, m_rhs, i, j); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprMMProduct[" - << (use_meta ? "M" : "L") << ", O=" << ops - << ", (O1=" << ops_lhs << ", O2=" << ops_rhs << ")]<" - << std::endl; - m_lhs.print_xpr(os, l); - os << IndentLevel(l) - << "R1=" << Rows1 << ", C1=" << Cols1 << ",\n"; - m_rhs.print_xpr(os, l); - os << IndentLevel(l) - << "C2=" << Cols2 << ",\n"; - os << IndentLevel(--l) - << ">," << std::endl; - } - -private: - const E1 m_lhs; - const E2 m_rhs; -}; - - -} // namespace tvmet - -#endif // TVMET_XPR_MMPRODUCT_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MMProductTransposed.h b/tvmet-1.7.1/include/tvmet/xpr/MMProductTransposed.h deleted file mode 100644 index d869e3af8..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MMProductTransposed.h +++ /dev/null @@ -1,138 +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: MMProductTransposed.h,v 1.16 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_XPR_MMPRODUCT_TRANSPOSED_H -#define TVMET_XPR_MMPRODUCT_TRANSPOSED_H - -#include <cassert> - -#include <tvmet/meta/Gemm.h> -#include <tvmet/loop/Gemm.h> - -namespace tvmet { - - -/** - * \class XprMMProductTransposed MMProductTransposed.h "tvmet/xpr/MMProductTransposed.h" - * \brief Expression for transpose(matrix-matrix product). - * Using formula: - * \f[ - * (M_1\,M_2)^T - * \f] - * \note The Rows2 has to be equal to Cols1. - * The result is a (Cols2 x Rows1) matrix. - */ -template<class E1, int Rows1, int Cols1, - class E2, int Cols2> -class XprMMProductTransposed - : public TvmetBase< XprMMProductTransposed<E1, Rows1, Cols1, E2, Cols2> > -{ -private: - XprMMProductTransposed(); - XprMMProductTransposed& operator=(const XprMMProductTransposed&); - -public: - typedef typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type value_type; - -public: - /** Complexity counter. */ - enum { - ops_lhs = E1::ops, - ops_rhs = E2::ops, - M = Rows1 * Cols1 * Cols2, - N = Rows1 * (Cols1-1) * Cols2, - ops_plus = M * Traits<value_type>::ops_plus, - ops_muls = N * Traits<value_type>::ops_muls, - ops = ops_plus + ops_muls, - use_meta = Cols2*Rows1 < TVMET_COMPLEXITY_MM_TRIGGER ? true : false - }; - -public: - /** Constructor. */ - explicit XprMMProductTransposed(const E1& lhs, const E2& rhs) - : m_lhs(lhs), m_rhs(rhs) { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprMMProductTransposed(const XprMMProductTransposed& e) - : m_lhs(e.m_lhs), m_rhs(e.m_rhs) - { } -#endif - -private: - /** Wrapper for meta gemm. */ - static inline - value_type do_gemm(dispatch<true>, const E1& lhs, const E2& rhs, int i, int j) { - return meta::gemm<Rows1, Cols1, - Cols2, - 0>::prod(lhs, rhs, i, j); - } - - /** Wrapper for loop gemm. */ - static inline - value_type do_gemm(dispatch<false>, const E1& lhs, const E2& rhs, int i, int j) { - return loop::gemm<Rows1, Cols1, Cols2>::prod(lhs, rhs, i, j); - } - -public: - /** index operator for arrays/matrices */ - value_type operator()(int i, int j) const { - assert((i < Cols2) && (j < Rows1)); - return do_gemm(dispatch<use_meta>(), m_lhs, m_rhs, j, i); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprMMProductTransposed[" - << (use_meta ? "M" : "L") << ", O=" << ops - << ", (O1=" << ops_lhs << ", O2=" << ops_rhs << ")]<" - << std::endl; - m_lhs.print_xpr(os, l); - os << IndentLevel(l) - << "R1=" << Rows1 << ", C1=" << Cols1 << ",\n"; - m_rhs.print_xpr(os, l); - os << IndentLevel(l) - << "C2=" << Cols2 << ",\n" - << IndentLevel(l) - << "\n" - << IndentLevel(--l) - << ">," << std::endl; - } - -private: - const E1 m_lhs; - const E2 m_rhs; -}; - - -} // namespace tvmet - -#endif // TVMET_XPR_MMPRODUCT_TRANSPOSED_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h deleted file mode 100644 index 71c6dda63..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MMtProduct.h +++ /dev/null @@ -1,139 +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: MMtProduct.h,v 1.16 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_XPR_MMTPRODUCT_H -#define TVMET_XPR_MMTPRODUCT_H - -#include <cassert> - -#include <tvmet/meta/Gemmt.h> -#include <tvmet/loop/Gemmt.h> - -namespace tvmet { - - -/** - * \class XprMMtProduct MMtProduct.h "tvmet/xpr/MMtProduct.h" - * \brief Expression for matrix-matrix product. - * Using formula: - * \f[ - * M_1\,M_2^T - * \f] - * \note The number of cols of rhs matrix have to be equal to cols of rhs matrix. - * The result is a (Rows1 x Rows2) matrix. - */ -template<class E1, int Rows1, int Cols1, - class E2, int Cols2> -class XprMMtProduct - : public TvmetBase< XprMMtProduct<E1, Rows1, Cols1, E2, Cols2> > -{ -private: - XprMMtProduct(); - XprMMtProduct& operator=(const XprMMtProduct&); - -public: - typedef typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type value_type; - -public: - /** Complexity counter. */ - enum { - ops_lhs = E1::ops, - ops_rhs = E2::ops, - Rows2 = Cols1, - M = Rows1 * Cols1 * Rows1, - N = Rows1 * (Cols1 - 1) * Rows2, - ops_plus = M * Traits<value_type>::ops_plus, - ops_muls = N * Traits<value_type>::ops_muls, - ops = ops_plus + ops_muls, - use_meta = Rows1*Rows2 < TVMET_COMPLEXITY_MM_TRIGGER ? true : false - }; - -public: - /** Constructor. */ - explicit XprMMtProduct(const E1& lhs, const E2& rhs) - : m_lhs(lhs), m_rhs(rhs) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprMMtProduct(const XprMMtProduct& e) - : m_lhs(e.m_lhs), m_rhs(e.m_rhs) - { } -#endif - -private: - /** Wrapper for meta gemm. */ - static inline - value_type do_gemmt(dispatch<true>, const E1& lhs, const E2& rhs, int i, int j) { - return meta::gemmt<Rows1, Cols1, - Cols2, - 0>::prod(lhs, rhs, i, j); - } - - /** Wrapper for loop gemm. */ - static inline - value_type do_gemmt(dispatch<false>, const E1& lhs, const E2& rhs, int i, int j) { - return loop::gemmt<Rows1, Cols1, Cols1>::prod(lhs, rhs, i, j); - } - -public: - /** index operator for arrays/matrices */ - value_type operator()(int i, int j) const { - assert((i < Rows1) && (j < Rows2)); - return do_gemmt(dispatch<use_meta>(), m_lhs, m_rhs, i, j); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprMMtProduct[" - << (use_meta ? "M" : "L") << ", O=" << ops - << ", (O1=" << ops_lhs << ", O2=" << ops_rhs << ")]<" - << std::endl; - m_lhs.print_xpr(os, l); - os << IndentLevel(l) - << "R1=" << Rows1 << ", C1=" << Cols1 << ",\n"; - m_rhs.print_xpr(os, l); - os << IndentLevel(l) - << "C2=" << Cols2 << ",\n" - << "\n" - << IndentLevel(--l) - << ">," << std::endl; - } - -private: - const E1 m_lhs; - const E2 m_rhs; -}; - - -} // namespace tvmet - -#endif // TVMET_XPR_MMTPRODUCT_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MVProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MVProduct.h deleted file mode 100644 index 0b9202f15..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MVProduct.h +++ /dev/null @@ -1,132 +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: MVProduct.h,v 1.17 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_XPR_MVPRODUCT_H -#define TVMET_XPR_MVPRODUCT_H - -#include <cassert> - -#include <tvmet/meta/Gemv.h> -#include <tvmet/loop/Gemv.h> - -namespace tvmet { - - -/** - * \class XprMVProduct MVProduct.h "tvmet/xpr/MVProduct.h" - * \brief Expression for matrix-vector product - * using formula - * \f[ - * M\,v - * \f] - */ -template<class E1, int Rows, int Cols, - class E2> -class XprMVProduct - : public TvmetBase< XprMVProduct<E1, Rows, Cols, E2> > -{ - XprMVProduct(); - XprMVProduct& operator=(const XprMVProduct&); - -public: - typedef typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type value_type; - -public: - /** Complexity counter. */ - enum { - ops_lhs = E1::ops, - ops_rhs = E2::ops, - M = Rows * Cols, - N = Rows * (Cols - 1), - ops_plus = M * Traits<value_type>::ops_plus, - ops_muls = N * Traits<value_type>::ops_muls, - ops = ops_plus + ops_muls, - use_meta = Rows*Cols < TVMET_COMPLEXITY_MV_TRIGGER ? true : false - }; - -public: - /** Constructor. */ - explicit XprMVProduct(const E1& lhs, const E2& rhs) - : m_lhs(lhs), m_rhs(rhs) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprMVProduct(const XprMVProduct& e) - : m_lhs(e.m_lhs), m_rhs(e.m_rhs) - { } -#endif - -private: - /** Wrapper for meta gemm. */ - static inline - value_type do_gemv(dispatch<true>, const E1& lhs, const E2& rhs, int j) { - return meta::gemv<Rows, Cols, - 0>::prod(lhs, rhs, j); - } - - /** Wrapper for loop gemm. */ - static inline - value_type do_gemv(dispatch<false>, const E1& lhs, const E2& rhs, int j) { - return loop::gemv<Rows, Cols>::prod(lhs, rhs, j); - } - -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 { - assert(j < Rows); - return do_gemv(dispatch<use_meta>(), m_lhs, m_rhs, j); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprMVProduct[" - << (use_meta ? "M" : "L") << ", O=" << ops - << ", (O1=" << ops_lhs << ", O2=" << ops_rhs << ")]<" - << std::endl; - m_lhs.print_xpr(os, l); - os << IndentLevel(l) - << "R=" << Rows << ", C=" << Cols << ",\n"; - m_rhs.print_xpr(os, l); - os << IndentLevel(--l) - << ">," << std::endl; - } - -private: - const E1 m_lhs; - const E2 m_rhs; -}; - - -} // namespace tvmet - -#endif // TVMET_XPR_MVPRODUCT_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/Matrix.h b/tvmet-1.7.1/include/tvmet/xpr/Matrix.h deleted file mode 100644 index d10176f89..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/Matrix.h +++ /dev/null @@ -1,156 +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: Matrix.h,v 1.22 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_XPR_MATRIX_H -#define TVMET_XPR_MATRIX_H - -#include <cassert> - -#include <tvmet/meta/Matrix.h> -#include <tvmet/loop/Matrix.h> - -namespace tvmet { - - -/* forwards */ -template <class T, int Rows, int Cols> class Matrix; - -/** - * \class XprMatrix Matrix.h "tvmet/xpr/Matrix.h" - * \brief Represents the expression for vectors at any node in the parse tree. - * - * Specifically, XprMatrix is the class that wraps the expression, and the - * expression itself is represented by the template parameter E. The - * class XprMatrix is known as an anonymizing expression wrapper because - * it can hold any subexpression of arbitrary complexity, allowing - * clients to work with any expression by holding on to it via the - * wrapper, without having to know the name of the type object that - * actually implements the expression. - * \note leave the CCtors non-explicit to allow implicit type conversation. - */ -template<class E, int Rows, int Cols> -class XprMatrix - : public TvmetBase< XprMatrix<E, Rows, Cols> > -{ - XprMatrix(); - XprMatrix& operator=(const XprMatrix&); - -public: - /** Complexity counter. */ - enum { - ops_assign = Rows * Cols, - ops = E::ops, - use_meta = ops_assign < TVMET_COMPLEXITY_M_ASSIGN_TRIGGER ? true : false - }; - -public: - typedef typename E::value_type value_type; - -public: - /** Constructor. */ - explicit XprMatrix(const E& e) - : m_expr(e) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprMatrix(const XprMatrix& rhs) - : m_expr(rhs.m_expr) - { } -#endif - - /** access by index. */ - value_type operator()(int i, int j) const { - assert((i < Rows) && (j < Cols)); - return m_expr(i, j); - } - -private: - /** Wrapper for meta assign. */ - template<class Dest, class Src, class Assign> - static inline - void do_assign(dispatch<true>, Dest& dest, const Src& src, const Assign& assign_fn) { - meta::Matrix<Rows, Cols, 0, 0>::assign(dest, src, assign_fn); - } - - /** Wrapper for loop assign. */ - template<class Dest, class Src, class Assign> - static inline - void do_assign(dispatch<false>, Dest& dest, const Src& src, const Assign& assign_fn) { - loop::Matrix<Rows, Cols>::assign(dest, src, assign_fn); - } - -public: - /** assign this expression to Matrix dest. */ - template<class Dest, class Assign> - void assign_to(Dest& dest, const Assign& assign_fn) const { - /* here is a way for caching, since each complex 'Node' - is of type XprMatrix. */ - do_assign(dispatch<use_meta>(), dest, *this, assign_fn); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprMatrix[" - << (use_meta ? "M" : "L") << ", O=" << ops << "]<" - << std::endl; - m_expr.print_xpr(os, l); - os << IndentLevel(l) - << "R=" << Rows << ", C=" << Cols << std::endl; - os << IndentLevel(--l) << ">" - << ((l != 0) ? "," : "") << std::endl; - } - -private: - const E m_expr; -}; - - -} // namespace tvmet - -#include <tvmet/Functional.h> - -#include <tvmet/xpr/BinOperator.h> -#include <tvmet/xpr/UnOperator.h> -#include <tvmet/xpr/Literal.h> - -#include <tvmet/xpr/Identity.h> - -#include <tvmet/xpr/MMProduct.h> -#include <tvmet/xpr/MMProductTransposed.h> -#include <tvmet/xpr/MMtProduct.h> -#include <tvmet/xpr/MtMProduct.h> -#include <tvmet/xpr/MVProduct.h> -#include <tvmet/xpr/MtVProduct.h> -#include <tvmet/xpr/MatrixTranspose.h> - -#include <tvmet/xpr/MatrixFunctions.h> -#include <tvmet/xpr/MatrixOperators.h> -#include <tvmet/xpr/Eval.h> - -#endif // TVMET_XPR_MATRIX_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MatrixCol.h b/tvmet-1.7.1/include/tvmet/xpr/MatrixCol.h deleted file mode 100644 index 47e2554b8..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MatrixCol.h +++ /dev/null @@ -1,97 +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: 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 - -namespace tvmet { - - -/** - * \class XprMatrixCol MatrixCol.h "tvmet/xpr/MatrixCol.h" - * \brief Expression on matrix used for access on the column vector. - */ -template<class E, int Rows, int Cols> -class XprMatrixCol - : public TvmetBase< XprMatrixCol<E, Rows, Cols> > -{ - XprMatrixCol(); - XprMatrixCol& operator=(const XprMatrixCol&); - -public: - typedef typename E::value_type value_type; - -public: - /** Complexity counter. */ - enum { - ops_expr = E::ops, - ops = ops_expr/Cols // equal Row accesses - }; - -public: - /** Constructor. */ - explicit XprMatrixCol(const E& e, int no) - : m_expr(e), m_col(no) - { - assert(no < Cols); - } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprMatrixCol(const XprMatrixCol& e) - : m_expr(e.m_expr), m_col(e.m_col) - { } -#endif - - value_type operator()(int i) const { - assert(i < Rows); - return m_expr(i, m_col); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprMatrixCol[O=" << ops << ", (O=" << ops_expr << ")]<" - << std::endl; - m_expr.print_xpr(os, l); - os << IndentLevel(l) - << "R=" << Rows << ", C=" << Cols << std::endl - << IndentLevel(--l) << ">" - << ((l != 0) ? "," : "") << std::endl; - } - -private: - const E m_expr; - const int m_col; -}; - - -} - -#endif // TVMET_XPR_MATRIX_COL_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MatrixDiag.h b/tvmet-1.7.1/include/tvmet/xpr/MatrixDiag.h deleted file mode 100644 index 4a8a080ac..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MatrixDiag.h +++ /dev/null @@ -1,95 +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: 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 - -namespace tvmet { - - -/** - * \class XprMatrixDiag MatrixDiag.h "tvmet/xpr/MatrixDiag.h" - * \brief Expression on matrix used for access on the diagonal vector. - */ -template<class E, int Sz> -class XprMatrixDiag - : public TvmetBase< XprMatrixDiag<E, Sz> > -{ - XprMatrixDiag(); - XprMatrixDiag& operator=(const XprMatrixDiag<E, Sz>&); - -public: - typedef typename E::value_type value_type; - -public: - /** Complexity counter. */ - enum { - ops_expr = E::ops, - ops = ops_expr/Sz - }; - -public: - /** Constructor. */ - explicit XprMatrixDiag(const E& e) - : m_expr(e) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprMatrixDiag(const XprMatrixDiag& e) - : m_expr(e.m_expr) - { } -#endif - - /** index operator for arrays/matrizes */ - value_type operator()(int i) const { - assert(i < Sz); - return m_expr(i, i); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprMatrixDiag[O=" << ops << ", (O=" << ops_expr << ")]<" - << std::endl; - m_expr.print_xpr(os, l); - os << IndentLevel(l) - << "Sz=" << Sz << std::endl - << IndentLevel(--l) << ">" - << ((l != 0) ? "," : "") << std::endl; - } - -private: - const E m_expr; -}; - - -} // namespace tvmet - -#endif // TVMET_XPR_MATRIX_DIAG_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MatrixFunctions.h b/tvmet-1.7.1/include/tvmet/xpr/MatrixFunctions.h deleted file mode 100644 index 54f02c08d..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MatrixFunctions.h +++ /dev/null @@ -1,736 +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: MatrixFunctions.h,v 1.39 2004/07/06 05:49:22 opetzold Exp $ - */ - -#ifndef TVMET_XPR_MATRIX_FUNCTIONS_H -#define TVMET_XPR_MATRIX_FUNCTIONS_H - -namespace tvmet { - - -/* forwards */ -template<class T, int Rows, int Cols> class Matrix; -template<class T, int Sz> class Vector; -template<class E, int Sz> class XprVector; -template<class E> class XprMatrixTranspose; -template<class E, int Sz> class XprMatrixDiag; -template<class E, int Rows, int Cols> class XprMatrixRow; -template<class E, int Rows, int Cols> class XprMatrixCol; - - -/********************************************************* - * PART I: DECLARATION - *********************************************************/ - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Matrix arithmetic functions add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * function(XprMatrix<E1, Rows, Cols>, XprMatrix<E2, Rows, Cols>) - */ -#define TVMET_DECLARE_MACRO(NAME) \ -template<class E1, class E2, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \ - XprMatrix<E1, Rows, Cols>, \ - XprMatrix<E2, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (const XprMatrix<E1, Rows, Cols>& lhs, \ - const XprMatrix<E2, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add) // per se element wise -TVMET_DECLARE_MACRO(sub) // per se element wise -namespace element_wise { - TVMET_DECLARE_MACRO(mul) // not defined for matrizes - TVMET_DECLARE_MACRO(div) // not defined for matrizes -} - -#undef TVMET_DECLARE_MACRO - - -/* - * function(XprMatrix<E, Rows, Cols>, POD) - * function(POD, XprMatrix<E, Rows, Cols>) - * Note: - operations +,-,*,/ are per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, POD) \ -template<class E, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, POD >, \ - XprMatrix<E, Rows, Cols>, \ - XprLiteral< POD > \ - >, \ - Rows, Cols \ -> \ -NAME (const XprMatrix<E, Rows, Cols>& lhs, \ - POD rhs) _tvmet_always_inline; \ - \ -template<class E, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< POD, typename E::value_type>, \ - XprLiteral< POD >, \ - XprMatrix<E, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (POD lhs, \ - const XprMatrix<E, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, int) -TVMET_DECLARE_MACRO(sub, int) -TVMET_DECLARE_MACRO(mul, int) -TVMET_DECLARE_MACRO(div, int) - -TVMET_DECLARE_MACRO(add, float) -TVMET_DECLARE_MACRO(sub, float) -TVMET_DECLARE_MACRO(mul, float) -TVMET_DECLARE_MACRO(div, float) - -TVMET_DECLARE_MACRO(add, double) -TVMET_DECLARE_MACRO(sub, double) -TVMET_DECLARE_MACRO(mul, double) -TVMET_DECLARE_MACRO(div, double) - -#undef TVMET_DECLARE_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * function(XprMatrix<E, Rows, Cols>, complex<T>) - * function(complex<T>, XprMatrix<E, Rows, Cols>) - * Note: - operations +,-,*,/ are per se element wise - * \todo type promotion - */ -#define TVMET_DECLARE_MACRO(NAME) \ -template<class E, class T, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, std::complex<T> >, \ - XprMatrix<E, Rows, Cols>, \ - XprLiteral< std::complex<T> > \ - >, \ - Rows, Cols \ -> \ -NAME (const XprMatrix<E, Rows, Cols>& lhs, \ - const std::complex<T>& rhs) _tvmet_always_inline; \ - \ -template<class T, class E, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, typename E::value_type>, \ - XprLiteral< std::complex<T> >, \ - XprMatrix<E, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (const std::complex<T>& lhs, \ - const XprMatrix<E, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add) -TVMET_DECLARE_MACRO(sub) -TVMET_DECLARE_MACRO(mul) -TVMET_DECLARE_MACRO(div) - -#undef TVMET_DECLARE_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix prod( ... ) functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -template<class E1, int Rows1, int Cols1, - class E2, int Cols2> -XprMatrix< - XprMMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - XprMatrix<E2, Cols1, Cols2>, Cols2 - >, - Rows1, Cols2 // return Dim -> -prod(const XprMatrix<E1, Rows1, Cols1>& lhs, - const XprMatrix<E2, Cols1, Cols2>& rhs) _tvmet_always_inline; - - -template<class E1, int Rows1, int Cols1, - class E2, int Cols2> -XprMatrix< - XprMMProductTransposed< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - XprMatrix<E2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) - >, - Cols2, Rows1 // return Dim -> -trans_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, - const XprMatrix<E2, Cols1, Cols2>& rhs) _tvmet_always_inline; - - -template<class E1, int Rows1, int Cols1, - class E2, int Cols2> // Rows2 = Rows1 -XprMatrix< - XprMtMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - XprMatrix<E2, Rows1, Cols2>, Cols2 // M2(Rows1, Cols2) - >, - Cols1, Cols2 // return Dim -> -MtM_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, - const XprMatrix<E2, Rows1, Cols2>& rhs) _tvmet_always_inline; - - -template<class E1, int Rows1, int Cols1, - class E2, int Rows2> // Cols2 = Cols1 -XprMatrix< - XprMMtProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - XprMatrix<E2, Rows2, Cols1>, Cols1 // M2(Rows2, Cols1) - >, - Rows1, Rows2 // return Dim -> -MMt_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, - const XprMatrix<E2, Rows2, Cols1>& rhs) _tvmet_always_inline; - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix-vector specific prod( ... ) functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -template<class E1, int Rows, int Cols, - class E2> -XprVector< - XprMVProduct< - XprMatrix<E1, Rows, Cols>, Rows, Cols, - XprVector<E2, Cols> - >, - Rows -> -prod(const XprMatrix<E1, Rows, Cols>& lhs, - const XprVector<E2, Cols>& rhs) _tvmet_always_inline; - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix specific functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -template<class E, int Rows, int Cols> -XprMatrix< - XprMatrixTranspose< - XprMatrix<E, Rows, Cols> - >, - Cols, Rows -> -trans(const XprMatrix<E, Rows, Cols>& rhs) _tvmet_always_inline; - - -#if 0 // XXX needs declaration of meta::Matrix<Sz, Sz, 0, 0>::trace -template<class E, int Sz> -typename Traits<typename E::value_type>::sum_type -trace(const XprMatrix<E, Sz, Sz>& m)_tvmet_always_inline; -#endif - - -template<class E, int Rows, int Cols> -XprVector< - XprMatrixRow< - XprMatrix<E, Rows, Cols>, - Rows, Cols - >, - Cols -> -row(const XprMatrix<E, Rows, Cols>& m, - int no) _tvmet_always_inline; - - -template<class E, int Rows, int Cols> -XprVector< - XprMatrixCol< - XprMatrix<E, Rows, Cols>, - Rows, Cols - >, - Rows -> -col(const XprMatrix<E, Rows, Cols>& m, int no) _tvmet_always_inline; - - -template<class E, int Sz> -XprVector< - XprMatrixDiag< - XprMatrix<E, Sz, Sz>, - Sz - >, - Sz -> -diag(const XprMatrix<E, Sz, Sz>& m) _tvmet_always_inline; - - -/********************************************************* - * PART II: IMPLEMENTATION - *********************************************************/ - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Matrix arithmetic functions add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * function(XprMatrix<E1, Rows, Cols>, XprMatrix<E2, Rows, Cols>) - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class E1, class E2, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \ - XprMatrix<E1, Rows, Cols>, \ - XprMatrix<E2, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (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)); \ -} - -TVMET_IMPLEMENT_MACRO(add) // per se element wise -TVMET_IMPLEMENT_MACRO(sub) // per se element wise -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mul) // not defined for matrizes - TVMET_IMPLEMENT_MACRO(div) // not defined for matrizes -} - -#undef TVMET_IMPLEMENT_MACRO - - -/* - * function(XprMatrix<E, Rows, Cols>, POD) - * function(POD, XprMatrix<E, Rows, Cols>) - * Note: - operations +,-,*,/ are per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, POD) \ -template<class E, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, POD >, \ - XprMatrix<E, Rows, Cols>, \ - XprLiteral< POD > \ - >, \ - Rows, Cols \ -> \ -NAME (const XprMatrix<E, Rows, Cols>& lhs, POD rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME<typename E::value_type, POD >, \ - XprMatrix<E, Rows, Cols>, \ - XprLiteral< POD > \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>( \ - expr_type(lhs, XprLiteral< POD >(rhs))); \ -} \ - \ -template<class E, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< POD, typename E::value_type>, \ - XprLiteral< POD >, \ - XprMatrix<E, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (POD lhs, const XprMatrix<E, Rows, Cols>& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< POD, typename E::value_type>, \ - XprLiteral< POD >, \ - XprMatrix<E, Rows, Cols> \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>( \ - expr_type(XprLiteral< POD >(lhs), rhs)); \ -} - -TVMET_IMPLEMENT_MACRO(add, int) -TVMET_IMPLEMENT_MACRO(sub, int) -TVMET_IMPLEMENT_MACRO(mul, int) -TVMET_IMPLEMENT_MACRO(div, int) - -TVMET_IMPLEMENT_MACRO(add, float) -TVMET_IMPLEMENT_MACRO(sub, float) -TVMET_IMPLEMENT_MACRO(mul, float) -TVMET_IMPLEMENT_MACRO(div, float) - -TVMET_IMPLEMENT_MACRO(add, double) -TVMET_IMPLEMENT_MACRO(sub, double) -TVMET_IMPLEMENT_MACRO(mul, double) -TVMET_IMPLEMENT_MACRO(div, double) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * function(XprMatrix<E, Rows, Cols>, complex<T>) - * function(complex<T>, XprMatrix<E, Rows, Cols>) - * Note: - operations +,-,*,/ are per se element wise - * \todo type promotion - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -template<class E, class T, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, std::complex<T> >, \ - XprMatrix<E, Rows, Cols>, \ - XprLiteral< std::complex<T> > \ - >, \ - Rows, Cols \ -> \ -NAME (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 T, class E, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, typename E::value_type>, \ - XprLiteral< std::complex<T> >, \ - XprMatrix<E, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -NAME (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)); \ -} - -TVMET_IMPLEMENT_MACRO(add) -TVMET_IMPLEMENT_MACRO(sub) -TVMET_IMPLEMENT_MACRO(mul) -TVMET_IMPLEMENT_MACRO(div) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix prod( ... ) functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) - * \brief Evaluate the product of two XprMatrix. - * Perform on given Matrix M1 and M2: - * \f[ - * M_1\,M_2 - * \f] - * \note The numer of Rows2 has to be equal to Cols1. - * \ingroup _binary_function - */ -template<class E1, int Rows1, int Cols1, - class E2, int Cols2> -inline -XprMatrix< - XprMMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - XprMatrix<E2, Cols1, Cols2>, Cols2 - >, - Rows1, Cols2 // return Dim -> -prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) { - typedef XprMMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, - XprMatrix<E2, Cols1, Cols2>, Cols2 - > expr_type; - return XprMatrix<expr_type, Rows1, Cols2>(expr_type(lhs, rhs)); -} - - -/** - * \fn trans_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) - * \brief Function for the trans(matrix-matrix-product) - * Perform on given Matrix M1 and M2: - * \f[ - * (M_1\,M_2)^T - * \f] - * \note The numer of Rows2 has to be equal to Cols1. - * \ingroup _binary_function - */ -template<class E1, int Rows1, int Cols1, - class E2, int Cols2> -inline -XprMatrix< - XprMMProductTransposed< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - XprMatrix<E2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) - >, - Cols2, Rows1 // return Dim -> -trans_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) { - typedef XprMMProductTransposed< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, - XprMatrix<E2, Cols1, Cols2>, Cols2 - > expr_type; - return XprMatrix<expr_type, Cols2, Rows1>(expr_type(lhs, rhs)); -} - - -/** - * \fn MtM_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Rows1, Cols2>& rhs) - * \brief Function for the trans(matrix)-matrix-product. - * using formula - * \f[ - * M_1^{T}\,M_2 - * \f] - * \note The number of cols of matrix 2 have to be equal to number of rows of - * matrix 1, since matrix 1 is trans - the result is a (Cols1 x Cols2) - * matrix. - * \ingroup _binary_function - */ -template<class E1, int Rows1, int Cols1, - class E2, int Cols2> // Rows2 = Rows1 -inline -XprMatrix< - XprMtMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - XprMatrix<E2, Rows1, Cols2>, Cols2 // M2(Rows1, Cols2) - >, - Cols1, Cols2 // return Dim -> -MtM_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Rows1, Cols2>& rhs) { - typedef XprMtMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, - XprMatrix<E2, Rows1, Cols2>, Cols2 - > expr_type; - return XprMatrix<expr_type, Cols1, Cols2>(expr_type(lhs, rhs)); -} - - -/** - * \fn MMt_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Rows2, Cols1>& rhs) - * \brief Function for the matrix-trans(matrix)-product. - * \ingroup _binary_function - * \note The cols2 has to be equal to cols1. - */ -template<class E1, int Rows1, int Cols1, - class E2, int Rows2> // Cols2 = Cols1 -inline -XprMatrix< - XprMMtProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - XprMatrix<E2, Rows2, Cols1>, Cols1 // M2(Rows2, Cols1) - >, - Rows1, Rows2 // return Dim -> -MMt_prod(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Rows2, Cols1>& rhs) { - typedef XprMMtProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, - XprMatrix<E2, Rows2, Cols1>, Cols1 - > expr_type; - return XprMatrix<expr_type, Rows1, Rows2>(expr_type(lhs, rhs)); -} - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix-vector specific prod( ... ) functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn prod(const XprMatrix<E1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs) - * \brief Evaluate the product of XprMatrix and XprVector. - * \ingroup _binary_function - */ -template<class E1, int Rows, int Cols, - class E2> -inline -XprVector< - XprMVProduct< - XprMatrix<E1, Rows, Cols>, Rows, Cols, - XprVector<E2, Cols> - >, - Rows -> -prod(const XprMatrix<E1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs) { - typedef XprMVProduct< - XprMatrix<E1, Rows, Cols>, Rows, Cols, - XprVector<E2, Cols> - > expr_type; - return XprVector<expr_type, Rows>(expr_type(lhs, rhs)); -} - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix specific functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn trans(const XprMatrix<E, Rows, Cols>& rhs) - * \brief Transpose an expression matrix. - * \ingroup _unary_function - */ -template<class E, int Rows, int Cols> -inline -XprMatrix< - XprMatrixTranspose< - XprMatrix<E, Rows, Cols> - >, - Cols, Rows -> -trans(const XprMatrix<E, Rows, Cols>& rhs) { - typedef XprMatrixTranspose< - XprMatrix<E, Rows, Cols> - > expr_type; - return XprMatrix<expr_type, Cols, Rows>(expr_type(rhs)); -} - - -#if 0 // XXX needs declaration of meta::Matrix<Sz, Sz, 0, 0>::trace -/* - * \fn trace(const XprMatrix<E, Sz, Sz>& m) - * \brief Compute the trace of a square matrix. - * \ingroup _unary_function - * - * Simply compute the trace of the given matrix as: - * \f[ - * \sum_{k = 0}^{Sz-1} m(k, k) - * \f] - */ -template<class E, int Sz> -inline -typename Traits<typename E::value_type>::sum_type -trace(const XprMatrix<E, Sz, Sz>& m) { - return meta::Matrix<Sz, Sz, 0, 0>::trace(m); -} -#endif - - -/** - * \fn row(const XprMatrix<E, Rows, Cols>& m, int no) - * \brief Returns a row vector of the given matrix. - * \ingroup _binary_function - */ -template<class E, int Rows, int Cols> -inline -XprVector< - XprMatrixRow< - XprMatrix<E, Rows, Cols>, - Rows, Cols - >, - Cols -> -row(const XprMatrix<E, Rows, Cols>& m, int no) { - typedef XprMatrixRow< - XprMatrix<E, Rows, Cols>, - Rows, Cols - > expr_type; - - return XprVector<expr_type, Cols>(expr_type(m, no)); -} - - -/** - * \fn col(const XprMatrix<E, Rows, Cols>& m, int no) - * \brief Returns a column vector of the given matrix. - * \ingroup _binary_function - */ -template<class E, int Rows, int Cols> -inline -XprVector< - XprMatrixCol< - XprMatrix<E, Rows, Cols>, - Rows, Cols - >, - Rows -> -col(const XprMatrix<E, Rows, Cols>& m, int no) { - typedef XprMatrixCol< - XprMatrix<E, Rows, Cols>, - Rows, Cols - > expr_type; - - return XprVector<expr_type, Cols>(expr_type(m, no)); -} - - -/** - * \fn diag(const XprMatrix<E, Sz, Sz>& m) - * \brief Returns the diagonal vector of the given square matrix. - * \ingroup _unary_function - */ -template<class E, int Sz> -inline -XprVector< - XprMatrixDiag< - XprMatrix<E, Sz, Sz>, - Sz - >, - Sz -> -diag(const XprMatrix<E, Sz, Sz>& m) { - typedef XprMatrixDiag< - XprMatrix<E, Sz, Sz>, - Sz> expr_type; - - return XprVector<expr_type, Sz>(expr_type(m)); -} - - -} // namespace tvmet - -#endif // TVMET_XPR_MATRIX_FUNCTIONS_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MatrixOperators.h b/tvmet-1.7.1/include/tvmet/xpr/MatrixOperators.h deleted file mode 100644 index 6f31d88f4..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MatrixOperators.h +++ /dev/null @@ -1,471 +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: MatrixOperators.h,v 1.19 2005/03/09 09:48:03 opetzold Exp $ - */ - -#ifndef TVMET_XPR_MATRIX_OPERATORS_H -#define TVMET_XPR_MATRIX_OPERATORS_H - -namespace tvmet { - - -/********************************************************* - * PART I: DECLARATION - *********************************************************/ - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Matrix arithmetic operators implemented by functions - * add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1,Cols2>& rhs) - * - * Note: operations +,-,*,/ are per se element wise. Further more, - * element wise operations make sense only for matrices of the same - * size [varg]. - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template<class E1, int Rows1, int Cols1, \ - class E2> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \ - XprMatrix<E1, Rows1, Cols1>, \ - XprMatrix<E2, Rows1, Cols1> \ - >, \ - Rows1, Cols1 \ -> \ -operator OP (const XprMatrix<E1, Rows1, Cols1>& lhs, \ - const XprMatrix<E2, Rows1, Cols1>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, +) // per se element wise -TVMET_DECLARE_MACRO(sub, -) // per se element wise -namespace element_wise { - TVMET_DECLARE_MACRO(mul, *) // see as prod() - TVMET_DECLARE_MACRO(div, /) // not defined for matrizes, must be element_wise -} -#undef TVMET_DECLARE_MACRO - - -/* - * 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, POD) \ -template<class E, int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, POD >, \ - XprMatrix<E, Rows, Cols>, \ - XprLiteral< POD > \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix<E, Rows, Cols>& lhs, \ - POD rhs) _tvmet_always_inline; \ - \ -template<class E,int Rows, int Cols> \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<POD, typename E::value_type>, \ - XprLiteral< POD >, \ - XprMatrix<E, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (POD lhs, \ - const XprMatrix<E, Rows, Cols>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, +, int) -TVMET_DECLARE_MACRO(sub, -, int) -TVMET_DECLARE_MACRO(mul, *, int) -TVMET_DECLARE_MACRO(div, /, int) - -TVMET_DECLARE_MACRO(add, +, float) -TVMET_DECLARE_MACRO(sub, -, float) -TVMET_DECLARE_MACRO(mul, *, float) -TVMET_DECLARE_MACRO(div, /, float) - -TVMET_DECLARE_MACRO(add, +, double) -TVMET_DECLARE_MACRO(sub, -, double) -TVMET_DECLARE_MACRO(mul, *, double) -TVMET_DECLARE_MACRO(div, /, double) - -#undef TVMET_DECLARE_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * operator(XprMatrix<E, Rows, Cols>, complex<>) - * operator(complex<>, XprMatrix<E, Rows, Cols>) - * Note: operations +,-,*,/ are per se element wise - * \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_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_always_inline; - -TVMET_DECLARE_MACRO(add, +) -TVMET_DECLARE_MACRO(sub, -) -TVMET_DECLARE_MACRO(mul, *) -TVMET_DECLARE_MACRO(div, /) - -#undef TVMET_DECLARE_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix specific operator*() = prod() operations - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn operator*(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) - * \brief Evaluate the product of two XprMatrix. - * \ingroup _binary_operator - * \sa prod(XprMatrix<E1, Rows1, Cols1> lhs, XprMatrix<E2, Cols1, Cols2> rhs) - */ -template<class E1, int Rows1, int Cols1, - class E2, int Cols2> -XprMatrix< - XprMMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - XprMatrix<E2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) - >, - Rows1, Cols2 -> -operator*(const XprMatrix<E1, Rows1, Cols1>& lhs, - const XprMatrix<E2, Cols1, Cols2>& rhs) _tvmet_always_inline; - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix-vector specific prod( ... ) operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn operator*(const XprMatrix<E1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs) - * \brief Evaluate the product of XprMatrix and XprVector. - * \ingroup _binary_operator - * \sa prod(XprMatrix<E1, Rows, Cols> lhs, XprVector<E2, Cols> rhs) - */ -template<class E1, int Rows, int Cols, - class E2> -XprVector< - XprMVProduct< - XprMatrix<E1, Rows, Cols>, Rows, Cols, - XprVector<E2, Cols> - >, - Rows -> -operator*(const XprMatrix<E1, Rows, Cols>& lhs, - const XprVector<E2, Cols>& rhs) _tvmet_always_inline; - - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * global unary operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * unary_operator(const XprMatrix<E, Rows, Cols>& m) - * Note: per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template <class E, int Rows, int Cols> \ -XprMatrix< \ - XprUnOp< \ - Fcnl_##NAME<typename E::value_type>, \ - XprMatrix<E, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix<E, Rows, Cols>& m) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(neg, -) - -#undef TVMET_DECLARE_MACRO - - -/********************************************************* - * PART II: IMPLEMENTATION - *********************************************************/ - - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Matrix arithmetic operators implemented by functions - * add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1,Cols2>& rhs) - * - * Note: operations +,-,*,/ are per se element wise. Further more, - * element wise operations make sense only for matrices of the same - * size [varg]. - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template<class E1, int Rows1, int Cols1, \ - class E2> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \ - XprMatrix<E1, Rows1, Cols1>, \ - XprMatrix<E2, Rows1, Cols1> \ - >, \ - Rows1, Cols1 \ -> \ -operator OP (const XprMatrix<E1, Rows1, Cols1>& lhs, \ - const XprMatrix<E2, Rows1, Cols1>& rhs) { \ - return NAME (lhs, rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add, +) // per se element wise -TVMET_IMPLEMENT_MACRO(sub, -) // per se element wise -namespace element_wise { - TVMET_IMPLEMENT_MACRO(mul, *) // see as prod() - TVMET_IMPLEMENT_MACRO(div, /) // not defined for matrizes, must be element_wise -} -#undef TVMET_IMPLEMENT_MACRO - - -/* - * 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, POD) \ -template<class E, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, POD >, \ - XprMatrix<E, Rows, Cols>, \ - XprLiteral< POD > \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix<E, Rows, Cols>& lhs, POD rhs) { \ - return NAME (lhs, rhs); \ -} \ - \ -template<class E,int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprBinOp< \ - Fcnl_##NAME<POD, typename E::value_type>, \ - XprLiteral< POD >, \ - XprMatrix<E, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (POD lhs, const XprMatrix<E, Rows, Cols>& rhs) { \ - return NAME (lhs, rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add, +, int) -TVMET_IMPLEMENT_MACRO(sub, -, int) -TVMET_IMPLEMENT_MACRO(mul, *, int) -TVMET_IMPLEMENT_MACRO(div, /, int) - -TVMET_IMPLEMENT_MACRO(add, +, float) -TVMET_IMPLEMENT_MACRO(sub, -, float) -TVMET_IMPLEMENT_MACRO(mul, *, float) -TVMET_IMPLEMENT_MACRO(div, /, float) - -TVMET_IMPLEMENT_MACRO(add, +, double) -TVMET_IMPLEMENT_MACRO(sub, -, double) -TVMET_IMPLEMENT_MACRO(mul, *, double) -TVMET_IMPLEMENT_MACRO(div, /, double) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * operator(XprMatrix<E, Rows, Cols>, complex<>) - * operator(complex<>, XprMatrix<E, Rows, Cols>) - * Note: operations +,-,*,/ are per se element wise - * \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) { \ - return NAME (lhs, 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) { \ - return NAME (lhs, rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add, +) -TVMET_IMPLEMENT_MACRO(sub, -) -TVMET_IMPLEMENT_MACRO(mul, *) -TVMET_IMPLEMENT_MACRO(div, /) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix specific operator*() = prod() operations - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn operator*(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) - * \brief Evaluate the product of two XprMatrix. - * \ingroup _binary_operator - * \sa prod(XprMatrix<E1, Rows1, Cols1> lhs, XprMatrix<E2, Cols1, Cols2> rhs) - */ -template<class E1, int Rows1, int Cols1, - class E2, int Cols2> -inline -XprMatrix< - XprMMProduct< - XprMatrix<E1, Rows1, Cols1>, Rows1, Cols1, // M1(Rows1, Cols1) - XprMatrix<E2, Cols1, Cols2>, Cols2 // M2(Cols1, Cols2) - >, - Rows1, Cols2 -> -operator*(const XprMatrix<E1, Rows1, Cols1>& lhs, const XprMatrix<E2, Cols1, Cols2>& rhs) { - return prod(lhs, rhs); -} - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * matrix-vector specific prod( ... ) operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn operator*(const XprMatrix<E1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs) - * \brief Evaluate the product of XprMatrix and XprVector. - * \ingroup _binary_operator - * \sa prod(XprMatrix<E1, Rows, Cols> lhs, XprVector<E2, Cols> rhs) - */ -template<class E1, int Rows, int Cols, - class E2> -inline -XprVector< - XprMVProduct< - XprMatrix<E1, Rows, Cols>, Rows, Cols, - XprVector<E2, Cols> - >, - Rows -> -operator*(const XprMatrix<E1, Rows, Cols>& lhs, const XprVector<E2, Cols>& rhs) { - return prod(lhs, rhs); -} - - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * global unary operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * unary_operator(const XprMatrix<E, Rows, Cols>& m) - * Note: per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template <class E, int Rows, int Cols> \ -inline \ -XprMatrix< \ - XprUnOp< \ - Fcnl_##NAME<typename E::value_type>, \ - XprMatrix<E, Rows, Cols> \ - >, \ - Rows, Cols \ -> \ -operator OP (const XprMatrix<E, Rows, Cols>& m) { \ - typedef XprUnOp< \ - Fcnl_##NAME<typename E::value_type>, \ - XprMatrix<E, Rows, Cols> \ - > expr_type; \ - return XprMatrix<expr_type, Rows, Cols>(expr_type(m)); \ -} - -TVMET_IMPLEMENT_MACRO(neg, -) - -#undef TVMET_IMPLEMENT_MACRO - - -} // namespace tvmet - -#endif // TVMET_XPR_MATRIX_OPERATORS_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MatrixRow.h b/tvmet-1.7.1/include/tvmet/xpr/MatrixRow.h deleted file mode 100644 index d8a796858..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MatrixRow.h +++ /dev/null @@ -1,97 +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: 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 - -namespace tvmet { - - -/** - * \class XprMatrixRow MatrixRow.h "tvmet/xpr/MatrixRow.h" - * \brief Expression on matrix used for access on the row vector. - */ -template<class E, int Rows, int Cols> -class XprMatrixRow - : public TvmetBase< XprMatrixRow<E, Rows, Cols> > -{ - XprMatrixRow(); - XprMatrixRow& operator=(const XprMatrixRow&); - -public: - typedef typename E::value_type value_type; - -public: - /** Complexity counter. */ - enum { - ops_expr = E::ops, - ops = ops_expr/Rows // equal Col accesses - }; - -public: - /** Constructor. */ - explicit XprMatrixRow(const E& e, int no) - : m_expr(e), m_row(no) - { - assert(no < Rows); - } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprMatrixRow(const XprMatrixRow& rhs) - : m_expr(rhs.m_expr), m_row(rhs.m_row) - { } -#endif - - value_type operator()(int j) const { - assert(j < Cols); - return m_expr(m_row, j); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprMatrixRow[O=" << ops << ", (O=" << ops_expr << ")]<" - << std::endl; - m_expr.print_xpr(os, l); - os << IndentLevel(l) - << "R=" << Rows << ", C=" << Cols << std::endl - << IndentLevel(--l) << ">" - << ((l != 0) ? "," : "") << std::endl; - } - -private: - const E m_expr; - const int m_row; -}; - - -} - -#endif // TVMET_XPR_MATRIX_ROW_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MatrixTranspose.h b/tvmet-1.7.1/include/tvmet/xpr/MatrixTranspose.h deleted file mode 100644 index c51df513e..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MatrixTranspose.h +++ /dev/null @@ -1,88 +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: MatrixTranspose.h,v 1.11 2004/06/10 16:36:55 opetzold Exp $ - */ - -#ifndef TVMET_XPR_MATRIX_TRANSPOSE_H -#define TVMET_XPR_MATRIX_TRANSPOSE_H - -namespace tvmet { - - -/** - * \class XprMatrixTranspose MatrixTranspose.h "tvmet/xpr/MatrixTranspose.h" - * \brief Expression for transpose matrix - */ -template<class E> -class XprMatrixTranspose - : public TvmetBase< XprMatrixTranspose<E> > -{ - XprMatrixTranspose(); - XprMatrixTranspose& operator=(const XprMatrixTranspose&); - -public: - typedef typename E::value_type value_type; - - /** Complexity counter. */ - enum { - ops_expr = E::ops, - ops = 1 * ops_expr - }; - -public: - /** Constructor. */ - explicit XprMatrixTranspose(const E& e) - : m_expr(e) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprMatrixTranspose(const XprMatrixTranspose& e) - : m_expr(e.m_expr) - { } -#endif - - /** index operator for arrays/matrices. This simple swap the index - access for transpose. */ - value_type operator()(int i, int j) const { return m_expr(j, i); } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprMatrixTranspose[O=" << ops << ", (O=" << ops_expr << ")]<" - << std::endl; - m_expr.print_xpr(os, l); - os << IndentLevel(--l) - << ">," << std::endl; - } - -private: - const E m_expr; -}; - - -} // namespace tvmet - -#endif // TVMET_XPR_MATRIX_TRANSPOSE_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h deleted file mode 100644 index 6d657d086..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MtMProduct.h +++ /dev/null @@ -1,140 +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: MtMProduct.h,v 1.15 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_XPR_MTMPRODUCT_H -#define TVMET_XPR_MTMPRODUCT_H - -#include <cassert> - -#include <tvmet/meta/Gemtm.h> -#include <tvmet/loop/Gemtm.h> - -namespace tvmet { - - -/** - * \class XprMtMProduct MtMProduct.h "tvmet/xpr/MtMProduct.h" - * \brief Expression for product of transposed(matrix)-matrix product. - * using formula - * \f[ - * M_1^{T}\,M_2 - * \f] - * \note The number of rows of rhs matrix have to be equal rows of rhs matrix, - * since lhs matrix 1 is transposed. - * The result is a (Cols1 x Cols2) matrix. - */ -template<class E1, int Rows1, int Cols1, - class E2, int Cols2> -class XprMtMProduct - : public TvmetBase< XprMtMProduct<E1, Rows1, Cols1, E2, Cols2> > -{ -private: - XprMtMProduct(); - XprMtMProduct& operator=(const XprMtMProduct&); - -public: - typedef typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type value_type; - -public: - /** Complexity counter. */ - enum { - ops_lhs = E1::ops, - ops_rhs = E2::ops, - M = Rows1 * Cols1 * Cols2, - N = (Rows1-1) * Cols1 * Cols2, - ops_plus = M * Traits<value_type>::ops_plus, - ops_muls = N * Traits<value_type>::ops_muls, - ops = ops_plus + ops_muls, - use_meta = Cols1*Cols2 < TVMET_COMPLEXITY_MM_TRIGGER ? true : false - }; - -public: - /** Constructor. */ - explicit XprMtMProduct(const E1& lhs, const E2& rhs) - : m_lhs(lhs), m_rhs(rhs) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprMtMProduct(const XprMtMProduct& e) - : m_lhs(e.m_lhs), m_rhs(e.m_rhs) { } -#endif - -private: - /** Wrapper for meta gemm. */ - static inline - value_type do_gemtm(dispatch<true>, const E1& lhs, const E2& rhs, int i, int j) { - return meta::gemtm<Rows1, Cols1, - Cols2, - 0>::prod(lhs, rhs, i, j); - } - - /** Wrapper for loop gemm. */ - static inline - value_type do_gemtm(dispatch<false>, const E1& lhs, const E2& rhs, int i, int j) { - return loop::gemtm<Rows1, Cols1, - Cols2>::prod(lhs, rhs, i, j); - } - -public: - /** index operator for arrays/matrices */ - value_type operator()(int i, int j) const { - assert((i < Cols1) && (j < Cols2)); - return do_gemtm(dispatch<use_meta>(), m_lhs, m_rhs, i, j); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprMtMProduct[" - << (use_meta ? "M" : "L") << ", O=" << ops - << ", (O1=" << ops_lhs << ", O2=" << ops_rhs << ")]<" - << std::endl; - m_lhs.print_xpr(os, l); - os << IndentLevel(l) - << "R1=" << Rows1 << ", C1=" << Cols1 << ",\n"; - m_rhs.print_xpr(os, l); - os << IndentLevel(l) - << "C2=" << Cols2 << ",\n" - << IndentLevel(l) - << "\n" - << IndentLevel(--l) - << ">," << std::endl; - } - -private: - const E1 m_lhs; - const E2 m_rhs; -}; - - -} // namespace tvmet - -#endif // TVMET_XPR_MTMPRODUCT_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h b/tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h deleted file mode 100644 index a50bacc97..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/MtVProduct.h +++ /dev/null @@ -1,129 +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: MtVProduct.h,v 1.10 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_XPR_MTVPRODUCT_H -#define TVMET_XPR_MTVPRODUCT_H - -#include <cassert> - -#include <tvmet/meta/Gemtv.h> -#include <tvmet/loop/Gemtv.h> - -namespace tvmet { - - -/** - * \class XprMtVProduct MtVProduct.h "tvmet/xpr/MtVProduct.h" - * \brief Expression for matrix-transposed vector product - * using formula - * \f[ - * M^T\,v - * \f] - */ -template<class E1, int Rows, int Cols, - class E2> -class XprMtVProduct - : public TvmetBase< XprMtVProduct<E1, Rows, Cols, E2> > -{ - XprMtVProduct(); - XprMtVProduct& operator=(const XprMtVProduct&); - -public: - typedef typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type value_type; - -public: - /** Complexity counter. */ - enum { - ops_lhs = E1::ops, - ops_rhs = E2::ops, - M = Cols * Rows, - N = Cols * (Rows - 1), - ops_plus = M * Traits<value_type>::ops_plus, - ops_muls = N * Traits<value_type>::ops_muls, - ops = ops_plus + ops_muls, - use_meta = Rows*Cols < TVMET_COMPLEXITY_MV_TRIGGER ? true : false - }; - -public: - /** Constructor. */ - explicit XprMtVProduct(const E1& lhs, const E2& rhs) - : m_lhs(lhs), m_rhs(rhs) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprMtVProduct(const XprMtVProduct& e) - : m_lhs(e.m_lhs), m_rhs(e.m_rhs) - { } -#endif - -private: - /** Wrapper for meta gemm. */ - static inline - value_type do_gemtv(dispatch<true>, const E1& lhs, const E2& rhs, int i) { - return meta::gemtv<Rows, Cols, 0>::prod(lhs, rhs, i); - } - - /** Wrapper for loop gemm. */ - static inline - value_type do_gemtv(dispatch<false>, const E1& lhs, const E2& rhs, int i) { - return loop::gemtv<Rows, Cols>::prod(lhs, rhs, i); - } - -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 { - assert(j < Cols); - return do_gemtv(dispatch<use_meta>(), m_lhs, m_rhs, j); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprMtVProduct[O=" << ops << ", (O1=" << ops_lhs << ", O2=" << ops_rhs << ")]<" - << std::endl; - m_lhs.print_xpr(os, l); - os << IndentLevel(l) - << "R=" << Rows << ", C=" << Cols << ",\n"; - m_rhs.print_xpr(os, l); - os << IndentLevel(--l) - << ">," << std::endl; - } - -private: - const E1 m_lhs; - const E2 m_rhs; -}; - - -} // namespace tvmet - -#endif // TVMET_XPR_MTVPRODUCT_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/Null.h b/tvmet-1.7.1/include/tvmet/xpr/Null.h deleted file mode 100644 index 68396f445..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/Null.h +++ /dev/null @@ -1,68 +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: Null.h,v 1.7 2003/11/30 18:35:17 opetzold Exp $ - */ - -#ifndef TVMET_XPR_NULL_H -#define TVMET_XPR_NULL_H - -namespace tvmet { - - -/** - * \class XprNull Null.h "tvmet/xpr/Null.h" - * \brief Null object design pattern - */ -class XprNull - : public TvmetBase< XprNull > -{ - XprNull& operator=(const XprNull&); - -public: - explicit XprNull() { } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l) << "XprNull[O=0]" << std::endl; - } -}; - - -#define TVMET_BINARY_OPERATOR(OP) \ -template< class T > \ -inline \ -T operator OP (const T& lhs, XprNull) { return lhs; } - -TVMET_BINARY_OPERATOR(+) -TVMET_BINARY_OPERATOR(-) -TVMET_BINARY_OPERATOR(*) -TVMET_BINARY_OPERATOR(/) - -#undef TVMET_BINARY_OPERATOR - - -} // namespace tvmet - -#endif // TVMET_XPR_NULL_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/UnOperator.h b/tvmet-1.7.1/include/tvmet/xpr/UnOperator.h deleted file mode 100644 index 3c4b87f49..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/UnOperator.h +++ /dev/null @@ -1,98 +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: UnOperator.h,v 1.13 2003/11/30 18:35:17 opetzold Exp $ - */ - -#ifndef TVMET_XPR_UNOPERATOR_H -#define TVMET_XPR_UNOPERATOR_H - -namespace tvmet { - - -/** - * \class XprUnOp UnOperator.h "tvmet/xpr/UnOperator.h" - * \brief Unary operator working on one subexpression. - * - * Using the access operator() the unary operation will be evaluated. - */ -template<class UnOp, class E> -class XprUnOp - : public TvmetBase< XprUnOp<UnOp, E> > -{ - XprUnOp(); - XprUnOp& operator=(const XprUnOp&); - -public: - typedef typename UnOp::value_type value_type; - -public: - /** Complexity counter. */ - enum { - ops_expr = E::ops, - ops = 1 * ops_expr - }; - -public: - /** Constructor for an expressions. */ - explicit XprUnOp(const E& e) - : m_expr(e) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprUnOp(const XprUnOp& e) - : m_expr(e.m_expr) - { } -#endif - - /** Index operator, evaluates the expression inside. */ - value_type operator()(int i) const { - return UnOp::apply_on(m_expr(i)); - } - - /** index operator for arrays/matrices. */ - value_type operator()(int i, int j) const { - return UnOp::apply_on(m_expr(i, j)); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprUnOp[O="<< ops << ", (O=" << ops_expr << ")]<" - << std::endl; - UnOp::print_xpr(os, l); - m_expr.print_xpr(os, l); - os << IndentLevel(--l) - << ">," << std::endl; - } - -private: - const E m_expr; -}; - - -} // namespace tvmet - -#endif // TVMET_XPR_UNOPERATOR_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/Vector.h b/tvmet-1.7.1/include/tvmet/xpr/Vector.h deleted file mode 100644 index 65db2a1f1..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/Vector.h +++ /dev/null @@ -1,154 +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: Vector.h,v 1.24 2004/09/16 09:14:18 opetzold Exp $ - */ - -#ifndef TVMET_XPR_VECTOR_H -#define TVMET_XPR_VECTOR_H - -#include <tvmet/meta/Vector.h> -#include <tvmet/loop/Vector.h> - -namespace tvmet { - - -/* forwards */ -template <class T, int Sz> class Vector; - -/** - * \class XprVector Vector.h "tvmet/xpr/Vector.h" - * \brief Represents the expression for vectors at any node in the parse tree. - * - * Specifically, XprVector is the class that wraps the expression, and the - * expression itself is represented by the template parameter E. The - * class XprVector is known as an anonymizing expression wrapper because - * it can hold any subexpression of arbitrary complexity, allowing - * clients to work with any expression by holding on to it via the - * wrapper, without having to know the name of the type object that - * actually implements the expression. - * \note leave the Ctors non-explicit to allow implicit type conversation. - */ -template<class E, int Sz> -class XprVector : public TvmetBase< XprVector<E, Sz> > -{ - XprVector(); - XprVector& operator=(const XprVector&); - -public: - typedef typename E::value_type value_type; - -public: - /** Dimensions. */ - enum { - Size = Sz /**< The size of the vector. */ - }; - -public: - /** Complexity counter */ - enum { - ops_assign = Size, - ops = E::ops, - use_meta = ops_assign < TVMET_COMPLEXITY_V_ASSIGN_TRIGGER ? true : false - }; - -public: - /** Constructor. */ - explicit XprVector(const E& e) - : m_expr(e) - { } - - /** Copy Constructor. Not explicit! */ -#if defined(TVMET_OPTIMIZE_XPR_MANUAL_CCTOR) - XprVector(const XprVector& e) - : m_expr(e.m_expr) - { } -#endif - - /** const index operator for vectors. */ - value_type operator()(int i) const { - assert(i < Size); - return m_expr(i); - } - - /** const index operator for vectors. */ - value_type operator[](int i) const { - return this->operator()(i); - } - -private: - /** Wrapper for meta assign. */ - template<class Dest, class Src, class Assign> - static inline - void do_assign(dispatch<true>, Dest& dest, const Src& src, const Assign& assign_fn) { - meta::Vector<Size, 0>::assign(dest, src, assign_fn); - } - - /** Wrapper for loop assign. */ - template<class Dest, class Src, class Assign> - static inline - void do_assign(dispatch<false>, Dest& dest, const Src& src, const Assign& assign_fn) { - loop::Vector<Size>::assign(dest, src, assign_fn); - } - -public: - /** assign this expression to Vector dest. */ - template<class Dest, class Assign> - void assign_to(Dest& dest, const Assign& assign_fn) const { - /* here is a way for caching, since each complex 'Node' - is of type XprVector. */ - do_assign(dispatch<use_meta>(), dest, *this, assign_fn); - } - -public: // debugging Xpr parse tree - void print_xpr(std::ostream& os, int l=0) const { - os << IndentLevel(l++) - << "XprVector[" - << (use_meta ? "M" : "L") << ", O=" << ops << "]<" - << std::endl; - m_expr.print_xpr(os, l); - os << IndentLevel(l) - << "Sz=" << Size << std::endl; - os << IndentLevel(--l) << ">" - << ((l != 0) ? "," : "") << std::endl; - } - -private: - const E m_expr; -}; - - -} // namespace tvmet - -#include <tvmet/Functional.h> - -#include <tvmet/xpr/BinOperator.h> -#include <tvmet/xpr/UnOperator.h> -#include <tvmet/xpr/Literal.h> - -#include <tvmet/xpr/VectorFunctions.h> -#include <tvmet/xpr/VectorOperators.h> -#include <tvmet/xpr/Eval.h> - -#endif // TVMET_XPR_VECTOR_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/VectorFunctions.h b/tvmet-1.7.1/include/tvmet/xpr/VectorFunctions.h deleted file mode 100644 index 172ed7ab2..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/VectorFunctions.h +++ /dev/null @@ -1,655 +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: VectorFunctions.h,v 1.17 2005/03/25 07:11:29 opetzold Exp $ - */ - -#ifndef TVMET_XPR_VECTOR_FUNCTIONS_H -#define TVMET_XPR_VECTOR_FUNCTIONS_H - -namespace tvmet { - - -/* forwards */ -template<class T, int Sz> class Vector; - - -/********************************************************* - * PART I: DECLARATION - *********************************************************/ - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector arithmetic functions add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * function(XprVector<E1, Sz>, XprVector<E2, Sz>) - */ -#define TVMET_DECLARE_MACRO(NAME) \ -template<class E1, class E2, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<typename E1::value_type, typename E2::value_type>, \ - XprVector<E1, Sz>, \ - XprVector<E2, Sz> \ - >, \ - Sz \ -> \ -NAME (const XprVector<E1, Sz>& lhs, \ - const XprVector<E2, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add) // per se element wise -TVMET_DECLARE_MACRO(sub) // per se element wise -TVMET_DECLARE_MACRO(mul) // per se element wise -namespace element_wise { - TVMET_DECLARE_MACRO(div) // not defined for vectors -} - -#undef TVMET_DECLARE_MACRO - - -/* - * function(XprVector<E, Sz>, POD) - * function(POD, XprVector<E, Sz>) - * Note: - operations +,-,*,/ are per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, POD) \ -template<class E, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< typename E::value_type, POD >, \ - XprVector<E, Sz>, \ - XprLiteral< POD > \ - >, \ - Sz \ -> \ -NAME (const XprVector<E, Sz>& lhs, \ - POD rhs) _tvmet_always_inline; \ - \ -template<class E, int Sz> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< POD, typename E::value_type>, \ - XprLiteral< POD >, \ - XprVector<E, Sz> \ - >, \ - Sz \ -> \ -NAME (POD lhs, \ - const XprVector<E, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, int) -TVMET_DECLARE_MACRO(sub, int) -TVMET_DECLARE_MACRO(mul, int) -TVMET_DECLARE_MACRO(div, int) - -TVMET_DECLARE_MACRO(add, float) -TVMET_DECLARE_MACRO(sub, float) -TVMET_DECLARE_MACRO(mul, float) -TVMET_DECLARE_MACRO(div, float) - -TVMET_DECLARE_MACRO(add, double) -TVMET_DECLARE_MACRO(sub, double) -TVMET_DECLARE_MACRO(mul, double) -TVMET_DECLARE_MACRO(div, double) - -#undef TVMET_DECLARE_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * function(XprMatrix<E, Rows, Cols>, complex<T>) - * function(complex<T>, XprMatrix<E, Rows, Cols>) - * Note: - operations +,-,*,/ are per se element wise - * \todo type promotion - */ -#define TVMET_DECLARE_MACRO(NAME) \ -template<class E, int Sz, class T> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< typename E::value_type, std::complex<T> >, \ - XprVector<E, Sz>, \ - XprLiteral< std::complex<T> > \ - >, \ - Sz \ -> \ -NAME (const XprVector<E, Sz>& lhs, \ - const std::complex<T>& rhs) _tvmet_always_inline; \ - \ -template<class E, int Sz, class T> \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< std::complex<T>, typename E::value_type>, \ - XprLiteral< std::complex<T> >, \ - XprVector<E, Sz> \ - >, \ - Sz \ -> \ -NAME (const std::complex<T>& lhs, \ - const XprVector<E, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add) -TVMET_DECLARE_MACRO(sub) -TVMET_DECLARE_MACRO(mul) -TVMET_DECLARE_MACRO(div) - -#undef TVMET_DECLARE_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * vector specific functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -template<class E, int Sz> -typename Traits<typename E::value_type>::sum_type -sum(const XprVector<E, Sz>& v) _tvmet_always_inline; - - -template<class E, int Sz> -typename Traits<typename E::value_type>::sum_type -product(const XprVector<E, Sz>& v) _tvmet_always_inline; - - -template<class E1, class E2, int Sz> -typename PromoteTraits< - typename E1::value_type, - typename E2::value_type ->::value_type -dot(const XprVector<E1, Sz>& lhs, - const XprVector<E2, Sz>& rhs) _tvmet_always_inline; - - -template<class T, class E, int Sz> -typename PromoteTraits<T, typename E::value_type>::value_type -dot(const Vector<T, Sz>& lhs, - const XprVector<E, Sz>& rhs) _tvmet_always_inline; - - -template<class E, class T, int Sz> -typename PromoteTraits<T, typename E::value_type>::value_type -dot(const XprVector<E, Sz>& lhs, - const Vector<T, Sz>& rhs) _tvmet_always_inline; - - -template<class E1, class E2> -Vector< - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type, - 3 -> -cross(const XprVector<E1, 3>& lhs, - const XprVector<E2, 3>& rhs) _tvmet_always_inline; - - -template<class T, class E> -Vector< - typename PromoteTraits<T, typename E::value_type>::value_type, 3> -cross(const Vector<T, 3>& lhs, - const XprVector<E, 3>& rhs) _tvmet_always_inline; - - -template<class E, class T> -Vector< - typename PromoteTraits<T, typename E::value_type>::value_type, 3> -cross(const XprVector<E, 3>& lhs, - const Vector<T, 3>& rhs) _tvmet_always_inline; - - -template<class E, int Sz> -typename Traits<typename E::value_type>::sum_type -norm1(const XprVector<E, Sz>& v) _tvmet_always_inline; - - -template<class E, int Sz> -typename Traits<typename E::value_type>::sum_type -norm2(const XprVector<E, Sz>& v) _tvmet_always_inline; - - -template<class E, int Sz> -XprVector< - XprBinOp< - Fcnl_div<typename E::value_type, typename E::value_type>, - XprVector<E, Sz>, - XprLiteral<typename E::value_type> - >, - Sz -> -normalize(const XprVector<E, Sz>& v) _tvmet_always_inline; - - -/********************************************************* - * PART II: IMPLEMENTATION - *********************************************************/ - - -/* - * function(XprVector<E1, Sz>, XprVector<E2, Sz>) - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -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 \ -> \ -NAME (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)); \ -} - -TVMET_IMPLEMENT_MACRO(add) // per se element wise -TVMET_IMPLEMENT_MACRO(sub) // per se element wise -TVMET_IMPLEMENT_MACRO(mul) // per se element wise -namespace element_wise { - TVMET_IMPLEMENT_MACRO(div) // not defined for vectors -} - -#undef TVMET_IMPLEMENT_MACRO - - -/* - * function(XprVector<E, Sz>, POD) - * function(POD, XprVector<E, Sz>) - * Note: - operations +,-,*,/ are per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, POD) \ -template<class E, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< typename E::value_type, POD >, \ - XprVector<E, Sz>, \ - XprLiteral< POD > \ - >, \ - Sz \ -> \ -NAME (const XprVector<E, Sz>& lhs, POD rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< typename E::value_type, POD >, \ - XprVector<E, Sz>, \ - XprLiteral< POD > \ - > expr_type; \ - return XprVector<expr_type, Sz>( \ - expr_type(lhs, XprLiteral< POD >(rhs))); \ -} \ - \ -template<class E, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< POD, typename E::value_type>, \ - XprLiteral< POD >, \ - XprVector<E, Sz> \ - >, \ - Sz \ -> \ -NAME (POD lhs, const XprVector<E, Sz>& rhs) { \ - typedef XprBinOp< \ - Fcnl_##NAME< POD, typename E::value_type>, \ - XprLiteral< POD >, \ - XprVector<E, Sz> \ - > expr_type; \ - return XprVector<expr_type, Sz>( \ - expr_type(XprLiteral< POD >(lhs), rhs)); \ -} - -TVMET_IMPLEMENT_MACRO(add, int) -TVMET_IMPLEMENT_MACRO(sub, int) -TVMET_IMPLEMENT_MACRO(mul, int) -TVMET_IMPLEMENT_MACRO(div, int) - -TVMET_IMPLEMENT_MACRO(add, float) -TVMET_IMPLEMENT_MACRO(sub, float) -TVMET_IMPLEMENT_MACRO(mul, float) -TVMET_IMPLEMENT_MACRO(div, float) - -TVMET_IMPLEMENT_MACRO(add, double) -TVMET_IMPLEMENT_MACRO(sub, double) -TVMET_IMPLEMENT_MACRO(mul, double) -TVMET_IMPLEMENT_MACRO(div, double) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * function(XprMatrix<E, Rows, Cols>, complex<T>) - * function(complex<T>, XprMatrix<E, Rows, Cols>) - * Note: - operations +,-,*,/ are per se element wise - * \todo type promotion - */ -#define TVMET_IMPLEMENT_MACRO(NAME) \ -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 \ -> \ -NAME (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 \ -> \ -NAME (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)); \ -} - -TVMET_IMPLEMENT_MACRO(add) -TVMET_IMPLEMENT_MACRO(sub) -TVMET_IMPLEMENT_MACRO(mul) -TVMET_IMPLEMENT_MACRO(div) - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * vector specific functions - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/** - * \fn sum(const XprVector<E, Sz>& v) - * \brief Compute the sum of the vector expression. - * \ingroup _unary_function - * - * Simply compute the sum of the given vector as: - * \f[ - * \sum_{i = 0}^{Sz-1} v[i] - * \f] - */ -template<class E, int Sz> -inline -typename Traits<typename E::value_type>::sum_type -sum(const XprVector<E, Sz>& v) { - return meta::Vector<Sz>::sum(v); -} - - -/** - * \fn product(const XprVector<E, Sz>& v) - * \brief Compute the product of the vector elements. - * \ingroup _unary_function - * - * Simply computer the product of the given vector expression as: - * \f[ - * \prod_{i = 0}^{Sz - 1} v[i] - * \f] - */ -template<class E, int Sz> -inline -typename Traits<typename E::value_type>::sum_type -product(const XprVector<E, Sz>& v) { - return meta::Vector<Sz>::product(v); -} - - -/** - * \fn dot(const XprVector<E1, Sz>& lhs, const XprVector<E2, Sz>& rhs) - * \brief Compute the dot/inner product - * \ingroup _binary_function - * - * Compute the dot product as: - * \f[ - * \sum_{i = 0}^{Sz - 1} ( lhs[i] * rhs[i] ) - * \f] - * where lhs is a column vector and rhs is a row vector, both vectors - * have the same dimension. - */ -template<class E1, class E2, int Sz> -inline -typename PromoteTraits< - typename E1::value_type, - typename E2::value_type ->::value_type -dot(const XprVector<E1, Sz>& lhs, const XprVector<E2, Sz>& rhs) { - return meta::Vector<Sz>::dot(lhs, rhs); -} - - -/** - * \fn dot(const Vector<T, Sz>& lhs, const XprVector<E, Sz>& rhs) - * \brief Compute the dot/inner product - * \ingroup _binary_function - * - * Compute the dot product as: - * \f[ - * \sum_{i = 0}^{Sz - 1} ( lhs[i] * rhs[i] ) - * \f] - * where lhs is a column vector and rhs is a row vector, both vectors - * have the same dimension. - */ -template<class T, class E, int Sz> -inline -typename PromoteTraits<T, typename E::value_type>::value_type -dot(const Vector<T, Sz>& lhs, const XprVector<E, Sz>& rhs) { - return meta::Vector<Sz>::dot(lhs, rhs); -} - - -/** - * \fn dot(const XprVector<E, Sz>& lhs, const Vector<T, Sz>& rhs) - * \brief Compute the dot/inner product - * \ingroup _binary_function - * - * Compute the dot product as: - * \f[ - * \sum_{i = 0}^{Sz - 1} ( lhs[i] * rhs[i] ) - * \f] - * where lhs is a column vector and rhs is a row vector, both vectors - * have the same dimension. - */ -template<class E, class T, int Sz> -inline -typename PromoteTraits<T, typename E::value_type>::value_type -dot(const XprVector<E, Sz>& lhs, const Vector<T, Sz>& rhs) { - return meta::Vector<Sz>::dot(lhs, rhs); -} - - -/** - * \fn cross(const XprVector<E1, 3>& lhs, const XprVector<E2, 3>& rhs) - * \brief Compute the cross/outer product - * \ingroup _binary_function - * \note working only for vectors of size = 3 - * \todo Implement vector outer product as ET and MT, returning a XprVector - */ -template<class E1, class E2> -inline -Vector< - typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type, - 3 -> -cross(const XprVector<E1, 3>& lhs, const XprVector<E2, 3>& rhs) { - typedef typename PromoteTraits< - typename E1::value_type, - typename E2::value_type - >::value_type value_type; - return Vector<value_type, 3>(lhs(1)*rhs(2) - rhs(1)*lhs(2), - rhs(0)*lhs(2) - lhs(0)*rhs(2), - lhs(0)*rhs(1) - rhs(0)*lhs(1)); -} - - -/** - * \fn cross(const XprVector<E, 3>& lhs, const Vector<T, 3>& rhs) - * \brief Compute the cross/outer product - * \ingroup _binary_function - * \note working only for vectors of size = 3 - * \todo Implement vector outer product as ET and MT, returning a XprVector - */ -template<class E, class T> -inline -Vector< - typename PromoteTraits<T, typename E::value_type>::value_type, 3> -cross(const XprVector<E, 3>& lhs, const Vector<T, 3>& rhs) { - typedef typename PromoteTraits< - typename E::value_type, T>::value_type value_type; - return Vector<value_type, 3>(lhs(1)*rhs(2) - rhs(1)*lhs(2), - rhs(0)*lhs(2) - lhs(0)*rhs(2), - lhs(0)*rhs(1) - rhs(0)*lhs(1)); -} - - -/** - * \fn cross(const Vector<T, 3>& lhs, const XprVector<E, 3>& rhs) - * \brief Compute the cross/outer product - * \ingroup _binary_function - * \note working only for vectors of size = 3 - * \todo Implement vector outer product as ET and MT, returning a XprVector - */ -template<class T1, class E2> -inline -Vector< - typename PromoteTraits<T1, typename E2::value_type>::value_type, 3> -cross(const Vector<T1, 3>& lhs, const XprVector<E2, 3>& rhs) { - typedef typename PromoteTraits< - typename E2::value_type, T1>::value_type value_type; - return Vector<value_type, 3>(lhs(1)*rhs(2) - rhs(1)*lhs(2), - rhs(0)*lhs(2) - lhs(0)*rhs(2), - lhs(0)*rhs(1) - rhs(0)*lhs(1)); -} - - -/** - * \fn norm1(const XprVector<E, Sz>& v) - * \brief The \f$l_1\f$ norm of a vector expression. - * \ingroup _unary_function - * The norm of any vector is just the square root of the dot product of - * a vector with itself, or - * - * \f[ - * |Vector<T, Sz> v| = |v| = \sum_{i=0}^{Sz-1}\,|v[i]| - * \f] - */ -template<class E, int Sz> -inline -typename Traits<typename E::value_type>::sum_type -norm1(const XprVector<E, Sz>& v) { - return sum(abs(v)); -} - - -/** - * \fn norm2(const XprVector<E, Sz>& v) - * \brief The euklidian norm (or \f$l_2\f$ norm) of a vector expression. - * \ingroup _unary_function - * The norm of any vector is just the square root of the dot product of - * a vector with itself, or - * - * \f[ - * |Vector<T, Sz> v| = |v| = \sqrt{ \sum_{i=0}^{Sz-1}\,v[i]^2 } - * \f] - * - * \note The internal cast for Vector<int> avoids warnings on sqrt. - */ -template<class E, int Sz> -inline -typename Traits<typename E::value_type>::sum_type -norm2(const XprVector<E, Sz>& v) { - typedef typename E::value_type value_type; - return static_cast<value_type>( std::sqrt(static_cast<value_type>(dot(v, v))) ); -} - - -/** - * \fn normalize(const XprVector<E, Sz>& v) - * \brief Normalize the given vector expression. - * \ingroup _unary_function - * \sa norm2 - * - * using the equation: - * \f[ - * \frac{Vector<T, Sz> v}{\sqrt{ \sum_{i=0}^{Sz-1}\,v[i]^2 }} - * \f] - */ -template<class E, int Sz> -inline -XprVector< - XprBinOp< - Fcnl_div<typename E::value_type, typename E::value_type>, - XprVector<E, Sz>, - XprLiteral<typename E::value_type> - >, - Sz -> -normalize(const XprVector<E, Sz>& v) { - typedef typename E::value_type value_type; - typedef XprBinOp< - Fcnl_div<value_type, value_type>, - XprVector<E, Sz>, - XprLiteral<value_type> - > expr_type; - return XprVector<expr_type, Sz>( - expr_type(v, XprLiteral< value_type >(norm2(v)))); -} - - -} // namespace tvmet - -#endif // TVMET_XPR_VECTOR_FUNCTIONS_H - -// Local Variables: -// mode:C++ -// End: diff --git a/tvmet-1.7.1/include/tvmet/xpr/VectorOperators.h b/tvmet-1.7.1/include/tvmet/xpr/VectorOperators.h deleted file mode 100644 index 5f5bf6803..000000000 --- a/tvmet-1.7.1/include/tvmet/xpr/VectorOperators.h +++ /dev/null @@ -1,362 +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: VectorOperators.h,v 1.13 2004/06/10 16:36:55 opetzold Exp $ - */ - -#ifndef TVMET_XPR_VECTOR_OPERATORS_H -#define TVMET_XPR_VECTOR_OPERATORS_H - -namespace tvmet { - - -/********************************************************* - * PART I: DECLARATION - *********************************************************/ - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector arithmetic operators implemented by functions - * add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(XprVector<E1, Sz>, XprVector<E2, Sz>) - */ -#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_always_inline; - -TVMET_DECLARE_MACRO(add, +) // per se element wise -TVMET_DECLARE_MACRO(sub, -) // per se element wise -TVMET_DECLARE_MACRO(mul, *) // per se element wise -namespace element_wise { - TVMET_DECLARE_MACRO(div, /) // not defined for vectors -} - -#undef TVMET_DECLARE_MACRO - - -/* - * operator(XprVector<E, Sz>, POD) - * operator(POD, XprVector<E, Sz>) - * Note: operations +,-,*,/ are per se element wise - */ -#define TVMET_DECLARE_MACRO(NAME, OP, POD) \ -template<class E, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, POD >, \ - XprVector<E, Sz>, \ - XprLiteral< POD > \ - >, \ - Sz \ -> \ -operator OP (const XprVector<E, Sz>& lhs, \ - POD rhs) _tvmet_always_inline; \ - \ -template<class E, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< POD, typename E::value_type >, \ - XprLiteral< POD >, \ - XprVector< E, Sz> \ - >, \ - Sz \ -> \ -operator OP (POD lhs, \ - const XprVector<E, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(add, +, int) -TVMET_DECLARE_MACRO(sub, -, int) -TVMET_DECLARE_MACRO(mul, *, int) -TVMET_DECLARE_MACRO(div, /, int) - -TVMET_DECLARE_MACRO(add, +, float) -TVMET_DECLARE_MACRO(sub, -, float) -TVMET_DECLARE_MACRO(mul, *, float) -TVMET_DECLARE_MACRO(div, /, float) - -TVMET_DECLARE_MACRO(add, +, double) -TVMET_DECLARE_MACRO(sub, -, double) -TVMET_DECLARE_MACRO(mul, *, double) -TVMET_DECLARE_MACRO(div, /, double) - -#undef TVMET_DECLARE_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * operator(XprVector<E, Sz>, complex<T>) - * operator(complex<T>, XprVector<E, Sz>) - * Note: operations +,-,*,/ are per se element wise - */ -#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_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_always_inline; - -TVMET_DECLARE_MACRO(add, +) // per se element wise -TVMET_DECLARE_MACRO(sub, -) // per se element wise -TVMET_DECLARE_MACRO(mul, *) // per se element wise -TVMET_DECLARE_MACRO(div, /) // per se element wise - -#undef TVMET_DECLARE_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * global unary operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * Unary Operator on XprVector<E, Sz> - */ -#define TVMET_DECLARE_MACRO(NAME, OP) \ -template <class E, int Sz> \ -inline \ -XprVector< \ - XprUnOp< \ - Fcnl_##NAME<typename E::value_type>, \ - XprVector<E, Sz> \ - >, \ - Sz \ -> \ -operator OP (const XprVector<E, Sz>& rhs) _tvmet_always_inline; - -TVMET_DECLARE_MACRO(neg, -) - -#undef TVMET_DECLARE_MACRO - - -/********************************************************* - * PART II: IMPLEMENTATION - *********************************************************/ - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Vector arithmetic operators implemented by functions - * add, sub, mul and div - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * operator(XprVector<E1, Sz>, XprVector<E2, Sz>) - */ -#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) { \ - return NAME (lhs, rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add, +) // per se element wise -TVMET_IMPLEMENT_MACRO(sub, -) // per se element wise -TVMET_IMPLEMENT_MACRO(mul, *) // per se element wise -namespace element_wise { - TVMET_IMPLEMENT_MACRO(div, /) // not defined for vectors -} - -#undef TVMET_IMPLEMENT_MACRO - - -/* - * operator(XprVector<E, Sz>, POD) - * operator(POD, XprVector<E, Sz>) - * Note: operations +,-,*,/ are per se element wise - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP, POD) \ -template<class E, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME<typename E::value_type, POD >, \ - XprVector<E, Sz>, \ - XprLiteral< POD > \ - >, \ - Sz \ -> \ -operator OP (const XprVector<E, Sz>& lhs, POD rhs) { \ - return NAME (lhs, rhs); \ -} \ - \ -template<class E, int Sz> \ -inline \ -XprVector< \ - XprBinOp< \ - Fcnl_##NAME< POD, typename E::value_type >, \ - XprLiteral< POD >, \ - XprVector< E, Sz> \ - >, \ - Sz \ -> \ -operator OP (POD lhs, const XprVector<E, Sz>& rhs) { \ - return NAME (lhs, rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add, +, int) -TVMET_IMPLEMENT_MACRO(sub, -, int) -TVMET_IMPLEMENT_MACRO(mul, *, int) -TVMET_IMPLEMENT_MACRO(div, /, int) - -TVMET_IMPLEMENT_MACRO(add, +, float) -TVMET_IMPLEMENT_MACRO(sub, -, float) -TVMET_IMPLEMENT_MACRO(mul, *, float) -TVMET_IMPLEMENT_MACRO(div, /, float) - -TVMET_IMPLEMENT_MACRO(add, +, double) -TVMET_IMPLEMENT_MACRO(sub, -, double) -TVMET_IMPLEMENT_MACRO(mul, *, double) -TVMET_IMPLEMENT_MACRO(div, /, double) - -#undef TVMET_IMPLEMENT_MACRO - - -#if defined(EIGEN_USE_COMPLEX) -/* - * operator(XprVector<E, Sz>, complex<T>) - * operator(complex<T>, XprVector<E, Sz>) - * Note: operations +,-,*,/ are per se element wise - */ -#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) { \ - return NAME (lhs, 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) { \ - return NAME (lhs, rhs); \ -} - -TVMET_IMPLEMENT_MACRO(add, +) // per se element wise -TVMET_IMPLEMENT_MACRO(sub, -) // per se element wise -TVMET_IMPLEMENT_MACRO(mul, *) // per se element wise -TVMET_IMPLEMENT_MACRO(div, /) // per se element wise - -#undef TVMET_IMPLEMENT_MACRO - -#endif // defined(EIGEN_USE_COMPLEX) - - -/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * global unary operators - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - - -/* - * Unary Operator on XprVector<E, Sz> - */ -#define TVMET_IMPLEMENT_MACRO(NAME, OP) \ -template <class E, int Sz> \ -inline \ -XprVector< \ - XprUnOp< \ - Fcnl_##NAME<typename E::value_type>, \ - XprVector<E, Sz> \ - >, \ - Sz \ -> \ -operator OP (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(neg, -) - -#undef TVMET_IMPLEMENT_MACRO - - -} // namespace tvmet - -#endif // TVMET_XPR_VECTOR_OPERATORS_H - -// Local Variables: -// mode:C++ -// End: |