Hello community, here is the log from the commit of package libeigen checked in at Mon Feb 26 19:04:04 CET 2007. -------- --- libeigen/libeigen.changes 2007-02-09 11:36:57.000000000 +0100 +++ /mounts/work_src_done/STABLE/libeigen/libeigen.changes 2007-02-26 16:38:46.000000000 +0100 @@ -1,0 +2,6 @@ +Mon Feb 26 16:38:21 CET 2007 - dmueller@suse.de + +- update to 1.0.4: + * improved vector handling, new matrix operations + +------------------------------------------------------------------- Old: ---- eigen-1.0.3.tar.bz2 New: ---- eigen-1.0.4.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libeigen.spec ++++++ --- /var/tmp/diff_new_pack.u26261/_old 2007-02-26 19:03:51.000000000 +0100 +++ /var/tmp/diff_new_pack.u26261/_new 2007-02-26 19:03:51.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package libeigen (Version 1.0.3) +# spec file for package libeigen (Version 1.0.4) # # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -17,7 +17,7 @@ Summary: lightweight linear algebra C++ template library BuildRoot: %{_tmppath}/%{name}-%{version}-build URL: http://eigen.tuxfamily.org/ -Version: 1.0.3 +Version: 1.0.4 Release: 1 Source: eigen-%{version}.tar.bz2 @@ -53,6 +53,9 @@ %doc README LICENSE TODO /usr/include/eigen -%changelog -n libeigen +%changelog +* Mon Feb 26 2007 - dmueller@suse.de +- update to 1.0.4: + * improved vector handling, new matrix operations * Fri Feb 09 2007 - dmueller@suse.de - Initial package (1.0.3) ++++++ eigen-1.0.3.tar.bz2 -> eigen-1.0.4.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/CMakeLists.txt new/eigen/CMakeLists.txt --- old/eigen/CMakeLists.txt 2007-02-02 22:17:39.000000000 +0100 +++ new/eigen/CMakeLists.txt 2007-02-05 09:18:20.000000000 +0100 @@ -15,10 +15,5 @@ include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ) add_subdirectory(src) - -if(EXISTS ${CMAKE_SOURCE_DIR}/gmm) - add_subdirectory(gmm) -endif(EXISTS ${CMAKE_SOURCE_DIR}/gmm) - add_subdirectory(tests) add_subdirectory(examples) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/Doxyfile new/eigen/Doxyfile --- old/eigen/Doxyfile 2007-02-03 17:58:26.000000000 +0100 +++ new/eigen/Doxyfile 2007-02-26 10:43:46.000000000 +0100 @@ -4,7 +4,7 @@ # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = Eigen -PROJECT_NUMBER = 1.0.3 +PROJECT_NUMBER = 1.0.4 OUTPUT_DIRECTORY = ./ CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English @@ -37,7 +37,8 @@ ALIASES = \ "ludecomp_remark=If you perform other \ operations that use a LU decomposition, it's better for performance to \ -compute the LU decomposition once and then do the computations from it." \ +compute the LU decomposition once and then do the computations from it. \ +See class LUDecomposition and class LUDecompositionX." \ "return_by_value=This method returns an object by value, \ which is inefficient." \ "perf_use=For better performance, use " @@ -54,7 +55,7 @@ EXTRACT_STATIC = YES EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_METHODS = NO -HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO HIDE_FRIEND_COMPOUNDS = YES HIDE_IN_BODY_DOCS = NO @@ -259,7 +260,7 @@ COLLABORATION_GRAPH = YES GROUP_GRAPHS = YES UML_LOOK = NO -TEMPLATE_RELATIONS = YES +TEMPLATE_RELATIONS = NO INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO @@ -277,6 +278,6 @@ GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- -# Configuration::additions related to the search engine +# Configuration::additions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/eigen.patch new/eigen/eigen.patch --- old/eigen/eigen.patch 2007-01-30 10:17:45.000000000 +0100 +++ new/eigen/eigen.patch 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -diff -Naur -x .svn eigen.bk/CMakeLists.txt eigen/CMakeLists.txt ---- eigen.bk/CMakeLists.txt 2007-01-28 20:11:41.000000000 +0200 -+++ eigen/CMakeLists.txt 2007-01-29 17:56:00.000000000 +0200 -@@ -15,5 +15,6 @@ - include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ) - - add_subdirectory(src) -+add_subdirectory(gmm) - add_subdirectory(tests) - add_subdirectory(examples) -diff -Naur -x .svn eigen.bk/gmm/CMakeLists.txt eigen/gmm/CMakeLists.txt ---- eigen.bk/gmm/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200 -+++ eigen/gmm/CMakeLists.txt 2007-01-29 18:21:36.000000000 +0200 -@@ -0,0 +1,10 @@ -+# the following are directories where stuff will be installed to -+set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The subdirectory to the header prefix" FORCE) -+ -+FILE(GLOB gmm_header_SRCS "*.h") -+ -+install(FILES -+ ${gmm_header_SRCS} -+ DESTINATION ${INCLUDE_INSTALL_DIR}/gmm -+ ) -+ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/README new/eigen/README --- old/eigen/README 2007-02-03 17:49:59.000000000 +0100 +++ new/eigen/README 2007-02-26 10:27:26.000000000 +0100 @@ -1,4 +1,4 @@ -Eigen version 1.0.3 February 3, 2007 +Eigen version 1.0.4 February 26, 2007 *** WHAT IS EIGEN ************************************************************ @@ -33,6 +33,8 @@ Contributors: Casper Boemann <cbr@boemann.dk> project co-founder, initial code contributions +David Faure <faure@kde.org> + Portability fixes Franz Keferboeck <franz.keferboeck@gmail.com> contributions in matrixbase.h Carsten Niehaus <cniehaus@gmx.de> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/src/linearsolver.h new/eigen/src/linearsolver.h --- old/eigen/src/linearsolver.h 2007-01-28 17:26:48.000000000 +0100 +++ new/eigen/src/linearsolver.h 2007-02-26 10:49:16.000000000 +0100 @@ -158,9 +158,7 @@ } }; -EIGEN_MAKE_FIXEDSIZE_TYPEDEFS(LinearSolver) - -/** @ingroup dynamicsize +/** \ingroup dynamicsize * * \ingroup solving * @@ -275,7 +273,8 @@ } }; -EIGEN_MAKE_DYNAMICSIZE_TYPEDEFS(LinearSolverX) +EIGEN_MAKE_FIXEDSIZE_TYPEDEFS(LinearSolver); +EIGEN_MAKE_DYNAMICSIZE_TYPEDEFS(LinearSolverX); } // namespace Eigen diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/src/ludecompositionbase.h new/eigen/src/ludecompositionbase.h --- old/eigen/src/ludecompositionbase.h 2007-01-28 17:26:48.000000000 +0100 +++ new/eigen/src/ludecompositionbase.h 2007-02-26 11:26:18.000000000 +0100 @@ -37,6 +37,8 @@ /** \ingroup internalbases * + * \ingroup ludecomp + * * \brief internal base class * * This class template is only internally used in Eigen. @@ -139,7 +141,26 @@ * \returns true if A is invertible, false otherwise. * */ - bool computeInverse( MatrixType * result ); + bool computeInverse( MatrixType * result ) const; + + /** + * This methods returns the inverse matrix of A, where A + * is the matrix of which *this is the LU decomposition. If A is + * non-invertible, the returned value is undefined. + * + * This method calls computeInverse(), so the same remarks as for + * computeInverse() apply here. + * + * \return_by_value + * + * \sa computeInverse() + */ + MatrixType inverse() const + { + MatrixType m( m_LU.size() ); + computeInverse( &m ); + return m; + } /** * Returns the member m_LU, which stores the matrices L and U. @@ -148,7 +169,6 @@ MatrixType & LU() { return m_LU; } const MatrixType & LU() const { return m_LU; } - /** * Returns the member m_P, which stores the permutation P. * See member m_P and the class's comment. @@ -539,7 +559,7 @@ typename VectorType, typename IntVecType> bool LUDecompositionBase<T, MatrixType, VectorType, IntVecType> - ::computeInverse( MatrixType * result ) + ::computeInverse( MatrixType * result ) const { assert( result->size() == dim() ); if( ! isInvertible() ) return false; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/src/ludecomposition.h new/eigen/src/ludecomposition.h --- old/eigen/src/ludecomposition.h 2007-01-28 17:26:48.000000000 +0100 +++ new/eigen/src/ludecomposition.h 2007-02-26 10:49:16.000000000 +0100 @@ -44,6 +44,8 @@ /** \ingroup fixedsize * + * \ingroup ludecomp + * * \brief LU decomposition of a fixed-size matrix * * The template parameter T is the type of the entries of the matrix to be @@ -85,21 +87,19 @@ /** Performs the LU Decomposition of mat. Use this constructor. */ LUDecomposition( const Matrix<T, Size> & mat ) { perform( mat ); } - /** Default constructor. Does nothing. Never use this constructor. - * It is only public for internal reasons (namely: friendship is - * not transitive. Well, probably that could - * be fixed somehow). +protected: + /** Default constructor. Does nothing. \internal */ LUDecomposition() {} }; -EIGEN_MAKE_FIXEDSIZE_TYPEDEFS(LUDecomposition) - template<typename T> class MatrixX; template<typename T> class VectorX; /** \ingroup dynamicsize * + * \ingroup ludecomp + * * \brief LU decomposition of a dynamic-size matrix * * The template parameter T is the type of the entries of the matrix to be @@ -130,15 +130,14 @@ /** Performs the LU Decomposition of mat. Use this constructor. */ LUDecompositionX( const MatrixX<T> & mat ) { perform( mat ); } - /** Default constructor. Does nothing. Never use this constructor. - * It is only public for internal reasons (namely: friendship is - * not transitive. Well, probably that could - * be fixed somehow). +protected: + /** Default constructor. Does nothing. \internal */ LUDecompositionX() {} }; -EIGEN_MAKE_DYNAMICSIZE_TYPEDEFS(LUDecompositionX) +EIGEN_MAKE_FIXEDSIZE_TYPEDEFS(LUDecomposition); +EIGEN_MAKE_DYNAMICSIZE_TYPEDEFS(LUDecompositionX); } // namespace Eigen diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/src/Mainpage.dox new/eigen/src/Mainpage.dox --- old/eigen/src/Mainpage.dox 2007-02-03 17:49:59.000000000 +0100 +++ new/eigen/src/Mainpage.dox 2007-02-26 10:55:21.000000000 +0100 @@ -4,8 +4,9 @@ <a href="#overview">Overview</a><br/> <a href="#license">License</a><br/> <a href="#features">Features</a><br/> -<a href="#kde">Relation to KDE</a><br/> +<a href="#news">News</a><br/> <a href="#download">Download</a><br/> +<a href="#kde">Relation to KDE</a><br/> <a href="#examples">Examples</a><br/> <a href="#applications">Applications using Eigen</a><br/> <a href="#authors">Authors</a><br/> @@ -31,6 +32,8 @@ Eigen is distributed under the GPL, but with an <a href="#exception">exception allowing any software to use it</a>. Thus, to the question "Can my own project use Eigen?", the answer is a definite <b>yes</b>. +This is similar to the LGPL in spirit. The reason why we don't use the LGPL is that it doesn't make sense for a pure template library like Eigen, where all the code is in headers. + <a name="features"></a> <h2>Features</h2> @@ -67,6 +70,21 @@ <li>Uses standard asserts, controlled as usual by NDEBUG. To achieve optimal performance, turn them off by defining NDEBUG, e.g.</li> <pre align="center">g++ -O3 -DNDEBUG myprogram.cpp</pre> </ul> +<a name="news"></a> +<h2>News</h2> + +If you want to stay informed of Eigen news and releases, please subscribe to our <a href="#mailinglist">mailing list</a>. You can also browse the <a href="http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/">archive</a>. + + +<a name="download"></a> +<h2>Download</h2> +The source code of the latest release is here: <a href="http://download.tuxfamily.org/eigen/eigen-1.0.4.tar.gz">eigen-1.0.4.tar.gz</a><br/> + +Alternatively, you can checkout the development tree by anonymous svn, by doing: +<pre>svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/eigen</pre> +or view it online at this address: +<a href="http://websvn.kde.org/trunk/kdesupport/eigen/">http://websvn.kde.org/trunk/kdesupport/eigen/</a> + <a name="kde"></a> <h2>Relation to KDE</h2> @@ -82,15 +100,6 @@ Although Eigen itself doesn't have any dependency, the unit-tests and the example program require Qt 4. -<a name="download"></a> -<h2>Download</h2> -The source code of the latest release is here: <a href="http://download.tuxfamily.org/eigen/eigen-1.0.3.tar.gz">eigen-1.0.3.tar.gz</a><br/> - -Alternatively, you can checkout the development tree by anonymous svn, by doing: -<pre>svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/eigen</pre> -or view it online at this address: -<a href="http://websvn.kde.org/trunk/kdesupport/eigen/">http://websvn.kde.org/trunk/kdesupport/eigen/</a> - <a name="examples"></a> <h2>Examples</h2> In <a href="http://websvn.kde.org/trunk/kdesupport/eigen/examples/qt/">examples/qt</a> is an example program demonstrating how Eigen's <a href="group__projective.html">projective-geometry</a> features can help writing OpenGL apps. See also <a href="http://bjacob.livejournal.com/2055.html">this blog entry</a>. @@ -98,8 +107,12 @@ <a name="applications"></a> <h2>Applications using Eigen</h2> -Currently, we know of one popular application using Eigen: <a href="http://edu.kde.org/kalzium">Kalzium</a>, as of -the current development version that'll ship with KDE4 in 2007. Eigen already allowed to add <a href="http://bjacob.livejournal.com/1762.html">some cool stuff</a> to Kalzium. +<ul> + <li> <a href="http://edu.kde.org/kalzium">Kalzium</a>, as of + the current development version that'll ship with KDE 4 in 2007. Eigen already allowed to add <a href="http://bjacob.livejournal.com/1762.html">some cool stuff</a> to Kalzium.</li> + <li> <a href="http://www.koffice.org/kspread/">KSpread</a>, as of + the current development version that'll ship with KOffice 2 in 2007. Eigen seems to cover well KSpread's linear algebra needs.</li> +</ul> Please tell us if you know of other interesting projects using Eigen! @@ -111,6 +124,7 @@ <b>Contributors:</b> <ul> <li>Casper Boemann (cbr at boemann dk) : project co-founder, initial development</li> + <li>David Faure (faure at kde dot org) : portability fixes</li> <li>Franz Keferboeck (franz keferboeck at gmail com) : contributions in matrixbase.h</li> <li>Carsten Niehaus (cniehaus at gmx de) : helped with QTestLib, Doxygen, CMake</li> <li>Inge Wallin (inge at lysator liu se) : project co-founder, initial development</li> @@ -134,6 +148,8 @@ To subscribe, send a mail with subject "subscribe" to eigen-request at lists tuxfamily org.<br/> To unsubscribe, send a mail with subject "unsubscribe" to eigen-request at lists tuxfamily org.<br/> +You can also browse the <a href="http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/">archive</a>. + <a name="exception"></a> <h2>Exception to the GPL</h2> Eigen is licensed under the GNU GPL, version 2 or later, plus the following exception, which is replicated into each of the source files of Eigen: diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/src/matrixbase.h new/eigen/src/matrixbase.h --- old/eigen/src/matrixbase.h 2007-02-03 17:42:04.000000000 +0100 +++ new/eigen/src/matrixbase.h 2007-02-26 09:44:05.000000000 +0100 @@ -33,6 +33,7 @@ #define EIGEN_MATRIXBASE_H #include "util.h" +#undef _T namespace Eigen { @@ -1049,7 +1050,7 @@ * non-invertible, the returned value is undefined. * * This method calls computeInverse(), so the same remarks as for - * computeInverse() apply here. + * computeInverse() apply here. \ludecomp_remark * * \return_by_value * @@ -1919,7 +1920,7 @@ { resize(3); T _cos = cos( angle ), _sin = sin( angle ); - T one_minus_cos = static_cast<T>( 1 - _cos ); + T one_minus_cos = static_cast<T>(1) - _cos; T coord_times_one_minus_cos = axis.x() * one_minus_cos; (*this)( 0, 0 ) = axis.x() * coord_times_one_minus_cos + _cos; T coord_times_coord_times_one_minus_cos = axis.y() diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/src/matrix.h new/eigen/src/matrix.h --- old/eigen/src/matrix.h 2007-01-28 17:26:48.000000000 +0100 +++ new/eigen/src/matrix.h 2007-02-26 10:49:16.000000000 +0100 @@ -192,21 +192,27 @@ assert( unused_size == Size ); } + /** \internal \latexonly */ Matrix & operator = ( const Matrix & other ) { return Base::operator = ( other ); } + /** \internal \latexonly */ Matrix & operator += ( const Matrix & other ) { return Base::operator += ( other ); } + /** \internal \latexonly */ Matrix & operator -= ( const Matrix & other ) { return Base::operator -= ( other ); } + /** \internal \latexonly */ Matrix& operator *=( const T & factor ) { return Base::operator *= ( factor ); } + /** \internal \latexonly */ Matrix& operator /=( const T & factor ) { return Base::operator /= ( factor ); } + /** \internal \latexonly */ Matrix& operator *=( const Matrix & other ) { return Base::operator *= ( other ); } @@ -219,8 +225,6 @@ }; -EIGEN_MAKE_FIXEDSIZE_TYPEDEFS(Matrix) - /** \ingroup dynamicsize * * \ingroup matrices @@ -341,21 +345,27 @@ ~MatrixX() { delete[] m_array; } + /** \internal \latexonly */ MatrixX & operator = ( const MatrixX & other ) { return Base::operator = ( other ); } + /** \internal \latexonly */ MatrixX & operator += ( const MatrixX & other ) { return Base::operator += ( other ); } + /** \internal \latexonly */ MatrixX & operator -= ( const MatrixX & other ) { return Base::operator -= ( other ); } + /** \internal \latexonly */ MatrixX& operator *=( const T & factor ) { return Base::operator *= ( factor ); } + /** \internal \latexonly */ MatrixX& operator /=( const T & factor ) { return Base::operator /= ( factor ); } + /** \internal \latexonly */ MatrixX& operator *=( const MatrixX & other ) { return Base::operator *= ( other ); } @@ -381,13 +391,13 @@ private: - /** \internal + /** \internal \latexonly * @returns the matrix size (number of rows) */ int _size() const { return m_size; } - /** \internal + /** \internal \latexonly * Returns true. A MatrixX has dynamic size. */ static bool _hasDynamicSize() @@ -414,7 +424,8 @@ m_size = size; } -EIGEN_MAKE_DYNAMICSIZE_TYPEDEFS(MatrixX) +EIGEN_MAKE_FIXEDSIZE_TYPEDEFS(Matrix); +EIGEN_MAKE_DYNAMICSIZE_TYPEDEFS(MatrixX); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/src/projective.h new/eigen/src/projective.h --- old/eigen/src/projective.h 2007-01-28 17:26:48.000000000 +0100 +++ new/eigen/src/projective.h 2007-02-26 10:49:16.000000000 +0100 @@ -544,7 +544,6 @@ } } - template< typename T, int Size > void MatrixP<T, Size>::resetLastRow() { diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/src/util.h new/eigen/src/util.h --- old/eigen/src/util.h 2007-01-28 17:26:48.000000000 +0100 +++ new/eigen/src/util.h 2007-02-26 10:37:53.000000000 +0100 @@ -36,6 +36,12 @@ #include <iostream> #include <cassert> +#ifdef __GNUC__ +# if __GNUC__>=4 +# define EIGEN_WITH_GCC_4_OR_LATER +# endif +#endif + namespace Eigen { @@ -58,8 +64,16 @@ * 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 } template<typename T> inline T epsilon() { return static_cast<T>(0); } @@ -165,6 +179,7 @@ /** @defgroup dynamicsize Dynamic-size classes*/ /** @defgroup solving Solving systems of equations*/ /** @defgroup regression Linear regression analysis*/ +/** @defgroup ludecomp LU Decomposition*/ /** @defgroup projective Projective geometry*/ /** @defgroup internalbases Internal stuff*/ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/src/vectorbase.h new/eigen/src/vectorbase.h --- old/eigen/src/vectorbase.h 2007-02-03 17:38:22.000000000 +0100 +++ new/eigen/src/vectorbase.h 2007-02-08 08:40:55.000000000 +0100 @@ -286,7 +286,7 @@ /** * Normalizes *this, that is, divides *this by norm(). * - * \sa norm() + * \sa norm(), normalized() */ Derived & normalize() { @@ -295,6 +295,36 @@ } /** + * Returns a normalized copy of *this. In other words, + * returns (*this) / norm(). + * + * \return_by_value + * + * \sa normalize() + */ + Derived normalized() + { + Derived ret( *static_cast<Derived *>(this) ); + return(ret.normalize()); + } + + /** + * Loads into *this a unit vector that is orthogonal to \a other. + * + * The size of \a other must be at least 2. + * *this gets resized to have the same size, if it has dynamic size. + * + * If the size is exactly 2, then other points toward the left, \ie + * other.x() = -y() and other.y() = x(). For dimensions at least 3, it + * is of course impossible to speak of "pointing toward the left". + * + * @returns a reference to *this. + * + * \sa ortho(), MatrixBase::loadOrthoBasis() + */ + Derived & loadOrtho( const Derived & other ); + + /** * Constructs a unit vector that is orthogonal to *this, * and stores it into *res. * @@ -303,9 +333,27 @@ * * @returns a reference to *res. * - * \sa MatrixBase::loadOrthoBasis() + * \deprecated use loadOrtho() or ortho() instead. + * + * \sa loadOrtho(), ortho(), MatrixBase::loadOrthoBasis() */ - Derived & makeOrthoVector( Derived * res ) const; + Derived & makeOrthoVector( Derived * res ) const + { + return res->loadOrtho( *static_cast<const Derived*>(this) ); + } + + /** + * Returns a unit vector that is orthogonal to *this. + * + * \return_by_value \perf_use loadOrtho() instead. + * + * \sa loadOrtho(), makeOrthoVectorMatrixBase::loadOrthoBasis() + */ + Derived ortho() const + { + Derived res( size() ); + return res.loadOrtho( *static_cast<const Derived*>(this) ); + } /** * Sets all coords of *this to zero. @@ -741,33 +789,33 @@ } template<typename T, typename Derived> -Derived & VectorBase<T, Derived>::makeOrthoVector( Derived * res ) const +Derived & VectorBase<T, Derived>::loadOrtho( const Derived & other ) { - assert( size() >= 2 ); - res->resize( size() ); + assert( other.size() >= 2 ); + resize( other.size() ); if( size() == 2 ) { - res->x() = Util::conj( y() ); - res->y() = - Util::conj( x() ); - res->normalize(); + x() = - Util::conj( other.y() ); + y() = Util::conj( other.x() ); + normalize(); } else { /* Let us compute the crossed product of *this with a vector that is not too close to being colinear to *this. */ - + /* unless the x and y coords are both close to zero, we can - * simply take ( -_vy, _vx, 0 ) and normalize it. + * simply take ( -y, x, 0 ) and normalize it. */ - if( ! Util::isNegligible( x(), z() ) - || ! Util::isNegligible( y(), z() ) ) + if( ! Util::isNegligible( other.x(), other.z() ) + || ! Util::isNegligible( other.y(), other.z() ) ) { - T nm = sqrt( x()*Util::conj(x()) + y()*Util::conj(y()) ); - res->loadZero(); - res->x() = - Util::conj(y()) / nm; - res->y() = Util::conj(x()) / nm; + T nm = sqrt( Util::abs2( other.x() ) + Util::abs2( other.y() ) ); + x() = - Util::conj(other.y()) / nm; + y() = Util::conj(other.x()) / nm; + z() = static_cast<T>(0); } /* if both x and y are close to zero, then the vector is close * to the z-axis, so it's far from colinear to the x-axis for instance. @@ -775,13 +823,14 @@ */ else { - T nm = sqrt( y()*Util::conj(y()) + z()*Util::conj(z()) ); - res->loadZero(); - res->y() = - Util::conj(z()) / nm; - res->z() = Util::conj(y()) / nm; + T nm = sqrt( Util::abs2( other.y() ) + Util::abs2( other.z() ) ); + x() = static_cast<T>(0); + y() = - Util::conj(other.z()) / nm; + z() = Util::conj(other.y()) / nm; } + for( int i = 3; i < size(); i++ ) (*this)(i) = static_cast<T>(0); } - return *res; + return *static_cast<Derived*>(this); } /** diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/src/vector.h new/eigen/src/vector.h --- old/eigen/src/vector.h 2007-01-28 17:26:48.000000000 +0100 +++ new/eigen/src/vector.h 2007-02-26 10:49:16.000000000 +0100 @@ -219,8 +219,6 @@ T m_array[Size]; }; -EIGEN_MAKE_FIXEDSIZE_TYPEDEFS(Vector) - /** \ingroup dynamicsize * * \ingroup vectors @@ -378,7 +376,8 @@ m_size = size; } -EIGEN_MAKE_DYNAMICSIZE_TYPEDEFS(VectorX) +EIGEN_MAKE_FIXEDSIZE_TYPEDEFS(Vector); +EIGEN_MAKE_DYNAMICSIZE_TYPEDEFS(VectorX); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/tests/euclidean.cpp new/eigen/tests/euclidean.cpp --- old/eigen/tests/euclidean.cpp 2007-01-28 17:26:47.000000000 +0100 +++ new/eigen/tests/euclidean.cpp 2007-02-06 11:13:45.000000000 +0100 @@ -40,10 +40,19 @@ do v1.loadRandom(); while( v1.norm() == static_cast<T>(0) ); v2.loadRandom(); QVERIFY( test_isApprox( Util::conj( dot( v1, v2 ) ), dot( v2, v1 ) ) ); + v1.loadRandom(); + v3 = v1.ortho(); + QVERIFY( test_isNegligible( dot( v1, v3 ), static_cast<T>(1) ) ); + QVERIFY( test_isApprox( v3.norm(), static_cast<T>(1) ) ); + QVERIFY( test_isApprox( ( v1 + v3).norm2(), v1.norm2() + v3.norm2() ) ); v1.makeOrthoVector( & v3 ); QVERIFY( test_isNegligible( dot( v1, v3 ), static_cast<T>(1) ) ); QVERIFY( test_isApprox( v3.norm(), static_cast<T>(1) ) ); QVERIFY( test_isApprox( ( v1 + v3).norm2(), v1.norm2() + v3.norm2() ) ); + v3.loadOrtho( v1 ); + QVERIFY( test_isNegligible( dot( v1, v3 ), static_cast<T>(1) ) ); + QVERIFY( test_isApprox( v3.norm(), static_cast<T>(1) ) ); + QVERIFY( test_isApprox( ( v1 + v3).norm2(), v1.norm2() + v3.norm2() ) ); m1.loadOrthoBasis(v1); QVERIFY( compareVectors( v1, m1.column(0), strType ) ); for( i = 0; i < Size; i++ ) @@ -57,6 +66,9 @@ m2 = m1 * m1.adjoint(); m3.loadIdentity(); QVERIFY( compareMatrices( m2, m3, strType ) ); + v1.loadRandomUnit(); + v2 = v1.normalized(); + QVERIFY( compareVectors( v1, v2, strType ) ); } template< typename T, typename MatrixType, typename VectorType > diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/eigen/TODO new/eigen/TODO --- old/eigen/TODO 2007-01-28 17:26:48.000000000 +0100 +++ new/eigen/TODO 2007-02-05 19:15:40.000000000 +0100 @@ -11,6 +11,4 @@ - make sure that people without Qt4 can compile at least the examples that don't use Qt4. - make a pkgconfig file (suggested by jbrefort) -- sparse matrices and solver (bensch is working on it) -- evaluate a more sophisticated error-reporting system (only if doable without - permanent overhead). \ No newline at end of file +- evaluate throwing exceptions when __EXCEPTIONS is defined \ No newline at end of file ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de