[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: kdesupport/eigen2
From:       Benoit Jacob <jacob.benoit.1 () gmail ! com>
Date:       2009-02-03 2:02:08
Message-ID: d9f848520902021802x3f03bd22v35b6a9ec09df6eca () mail ! gmail ! com
[Download RAW message or body]

welcome!

Now if you're interested in receiving email notifications, head over
to http://commitfilter.kde.org/

Cheers,
Benoit

2009/2/3 Keir Mierle <mierle@gmail.com>:
> SVN commit 920498 by kmierle:
> 
> Add Matrix::resizeLike(other) convenience function and test.
> 
> M  +24 -12    Eigen/src/Core/Matrix.h
> M  +1 -0      test/CMakeLists.txt
> A             test/resize.cpp   [License: GPL (v3+) LGPL (v3+)]
> 
> 
> --- trunk/kdesupport/eigen2/Eigen/src/Core/Matrix.h #920497:920498
> @@ -248,6 +248,29 @@
> m_storage.resize(size, size, 1);
> }
> 
> +    /** Resizes *this to have the same dimensions as \a other.
> +      * Takes care of doing all the checking that's needed.
> +      *
> +      * Note that copying a row-vector into a vector (and conversely) is allowed.
> +      * The resizing, if any, is then done in the appropriate way so that \
> row-vectors +      * remain row-vectors and vectors remain vectors.
> +      */
> +    template<typename OtherDerived>
> +    EIGEN_STRONG_INLINE void resizeLike(const MatrixBase<OtherDerived>& other)
> +    {
> +      if(RowsAtCompileTime == 1)
> +      {
> +        ei_assert(other.isVector());
> +        resize(1, other.size());
> +      }
> +      else if(ColsAtCompileTime == 1)
> +      {
> +        ei_assert(other.isVector());
> +        resize(other.size(), 1);
> +      }
> +      else resize(other.rows(), other.cols());
> +    }
> +
> /** Copies the value of the expression \a other into \c *this with automatic \
>                 resizing.
> *
> * *this might be resized to match the dimensions of \a other. If *this was a null \
> matrix (not already initialized), @@ -468,18 +491,7 @@
> > (rows() == other.rows() && cols() == other.cols())))
> && "Size mismatch. Automatic resizing is disabled because \
> EIGEN_NO_AUTOMATIC_RESIZING is defined"); #endif
> -
> -      if(RowsAtCompileTime == 1)
> -      {
> -        ei_assert(other.isVector());
> -        resize(1, other.size());
> -      }
> -      else if(ColsAtCompileTime == 1)
> -      {
> -        ei_assert(other.isVector());
> -        resize(other.size(), 1);
> -      }
> -      else resize(other.rows(), other.cols());
> +      resizeLike(other);
> }
> 
> /** \internal Copies the value of the expression \a other into \c *this with \
>                 automatic resizing.
> --- trunk/kdesupport/eigen2/test/CMakeLists.txt #920497:920498
> @@ -211,6 +211,7 @@
> ei_add_test(alignedbox)
> ei_add_test(regression)
> ei_add_test(stdvector)
> +ei_add_test(resize)
> if(QT4_FOUND)
> ei_add_test(qtvector " " ${QT_QTCORE_LIBRARY})
> endif(QT4_FOUND)
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic