diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2008-09-15 15:45:41 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2008-09-15 15:45:41 +0000 |
commit | 247f2b0ffa734d2133db9bb81a48cb4b5620d145 (patch) | |
tree | 44610107cad4e0508177cad78d490c5dd6f427d2 /Eigen/src | |
parent | 0940ad7127474dc0b6e5e271502988cb7141843a (diff) |
* block() for vectors ---> segment()
* documentation improvements, especially in quickstart guide
Diffstat (limited to 'Eigen/src')
-rw-r--r-- | Eigen/src/Core/Block.h | 32 | ||||
-rw-r--r-- | Eigen/src/Core/MatrixBase.h | 8 | ||||
-rwxr-xr-x | Eigen/src/Core/SolveTriangular.h | 6 | ||||
-rw-r--r-- | Eigen/src/Core/util/Constants.h | 4 | ||||
-rw-r--r-- | Eigen/src/QR/SelfAdjointEigenSolver.h | 2 |
5 files changed, 28 insertions, 24 deletions
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index 71ad6d5f1..f1a095769 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -318,27 +318,27 @@ inline const typename BlockReturnType<Derived>::Type MatrixBase<Derived> return typename BlockReturnType<Derived>::Type(derived(), startRow, startCol, blockRows, blockCols); } -/** \returns a dynamic-size expression of a block in *this. +/** \returns a dynamic-size expression of a segment (i.e. a vector block) in *this. * * \only_for_vectors * - * \addexample BlockIntInt \label How to reference a sub-vector (dynamic size) + * \addexample SegmentIntInt \label How to reference a sub-vector (dynamic size) * - * \param start the first coefficient in the block - * \param size the number of coefficients in the block + * \param start the first coefficient in the segment + * \param size the number of coefficients in the segment * - * Example: \include MatrixBase_block_int_int.cpp - * Output: \verbinclude MatrixBase_block_int_int.out + * Example: \include MatrixBase_segment_int_int.cpp + * Output: \verbinclude MatrixBase_segment_int_int.out * * \note Even though the returned expression has dynamic size, in the case * when it is applied to a fixed-size vector, it inherits a fixed maximal size, * which means that evaluating it does not cause a dynamic memory allocation. * - * \sa class Block, block(int) + * \sa class Block, segment(int) */ template<typename Derived> inline typename BlockReturnType<Derived>::SubVectorType MatrixBase<Derived> - ::block(int start, int size) + ::segment(int start, int size) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); return typename BlockReturnType<Derived>::SubVectorType(derived(), RowsAtCompileTime == 1 ? 0 : start, @@ -347,10 +347,10 @@ inline typename BlockReturnType<Derived>::SubVectorType MatrixBase<Derived> ColsAtCompileTime == 1 ? 1 : size); } -/** This is the const version of block(int,int).*/ +/** This is the const version of segment(int,int).*/ template<typename Derived> inline const typename BlockReturnType<Derived>::SubVectorType -MatrixBase<Derived>::block(int start, int size) const +MatrixBase<Derived>::segment(int start, int size) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); return typename BlockReturnType<Derived>::SubVectorType(derived(), RowsAtCompileTime == 1 ? 0 : start, @@ -451,7 +451,7 @@ MatrixBase<Derived>::end(int size) const ColsAtCompileTime == 1 ? 1 : size); } -/** \returns a fixed-size expression of a sub-vector of \c *this +/** \returns a fixed-size expression of a segment (i.e. a vector block) in \c *this * * \only_for_vectors * @@ -459,15 +459,15 @@ MatrixBase<Derived>::end(int size) const * * \param start the index of the first element of the sub-vector * - * Example: \include MatrixBase_template_int.cpp - * Output: \verbinclude MatrixBase_template_int.out + * Example: \include MatrixBase_template_int_segment.cpp + * Output: \verbinclude MatrixBase_template_int_segment.out * * \sa class Block */ template<typename Derived> template<int Size> inline typename BlockReturnType<Derived,Size>::SubVectorType -MatrixBase<Derived>::block(int start) +MatrixBase<Derived>::segment(int start) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); return Block<Derived, (RowsAtCompileTime == 1 ? 1 : Size), @@ -476,11 +476,11 @@ MatrixBase<Derived>::block(int start) ColsAtCompileTime == 1 ? 0 : start); } -/** This is the const version of block<int>(int).*/ +/** This is the const version of segment<int>(int).*/ template<typename Derived> template<int Size> inline const typename BlockReturnType<Derived,Size>::SubVectorType -MatrixBase<Derived>::block(int start) const +MatrixBase<Derived>::segment(int start) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); return Block<Derived, (RowsAtCompileTime == 1 ? 1 : Size), diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 2b4926082..2e8355f77 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -351,8 +351,8 @@ template<typename Derived> class MatrixBase const typename BlockReturnType<Derived>::Type block(int startRow, int startCol, int blockRows, int blockCols) const; - typename BlockReturnType<Derived>::SubVectorType block(int start, int size); - const typename BlockReturnType<Derived>::SubVectorType block(int start, int size) const; + typename BlockReturnType<Derived>::SubVectorType segment(int start, int size); + const typename BlockReturnType<Derived>::SubVectorType segment(int start, int size) const; typename BlockReturnType<Derived,Dynamic>::SubVectorType start(int size); const typename BlockReturnType<Derived,Dynamic>::SubVectorType start(int size) const; @@ -379,8 +379,8 @@ template<typename Derived> class MatrixBase template<int Size> typename BlockReturnType<Derived,Size>::SubVectorType end(); template<int Size> const typename BlockReturnType<Derived,Size>::SubVectorType end() const; - template<int Size> typename BlockReturnType<Derived,Size>::SubVectorType block(int start); - template<int Size> const typename BlockReturnType<Derived,Size>::SubVectorType block(int start) const; + template<int Size> typename BlockReturnType<Derived,Size>::SubVectorType segment(int start); + template<int Size> const typename BlockReturnType<Derived,Size>::SubVectorType segment(int start) const; DiagonalCoeffs<Derived> diagonal(); const DiagonalCoeffs<Derived> diagonal() const; diff --git a/Eigen/src/Core/SolveTriangular.h b/Eigen/src/Core/SolveTriangular.h index aaebc5989..e77d9e238 100755 --- a/Eigen/src/Core/SolveTriangular.h +++ b/Eigen/src/Core/SolveTriangular.h @@ -119,8 +119,8 @@ struct ei_solve_triangular_selector<Lhs,Rhs,UpLo,RowMajor|IsDense> int remainingSize = IsLower ? i-startBlock : startBlock-i; Scalar tmp = other.coeff(i,c) - btmp.coeff(IsLower ? remainingSize : 3-remainingSize) - - ( lhs.row(i).block(IsLower ? startBlock : i+1, remainingSize) - * other.col(c).block(IsLower ? startBlock : i+1, remainingSize)).coeff(0,0); + - ( lhs.row(i).segment(IsLower ? startBlock : i+1, remainingSize) + * other.col(c).segment(IsLower ? startBlock : i+1, remainingSize)).coeff(0,0); if (Lhs::Flags & UnitDiagBit) other.coeffRef(i,c) = tmp; @@ -172,7 +172,7 @@ struct ei_solve_triangular_selector<Lhs,Rhs,UpLo,ColMajor|IsDense> other.coeffRef(i,c) /= lhs.coeff(i,i); int remainingSize = IsLower ? endBlock-i-1 : i-endBlock-1; if (remainingSize>0) - other.col(c).block((IsLower ? i : endBlock) + 1, remainingSize) -= + other.col(c).segment((IsLower ? i : endBlock) + 1, remainingSize) -= other.coeffRef(i,c) * Block<Lhs,Dynamic,1>(lhs, (IsLower ? i : endBlock) + 1, i, remainingSize, 1); btmp.coeffRef(IsLower ? i-startBlock : remainingSize) = -other.coeffRef(i,c); diff --git a/Eigen/src/Core/util/Constants.h b/Eigen/src/Core/util/Constants.h index e852fffa0..3fb5f918d 100644 --- a/Eigen/src/Core/util/Constants.h +++ b/Eigen/src/Core/util/Constants.h @@ -34,6 +34,10 @@ const int Dynamic = 10000; * These are the possible bits which can be OR'ed to constitute the flags of a matrix or * expression. * + * It is important to note that these flags are a purely compile-time notion. They are a compile-time property of + * an expression type, implemented as enum's. They are not stored in memory at runtime, and they do not incur any + * runtime overhead. + * * \sa MatrixBase::Flags */ diff --git a/Eigen/src/QR/SelfAdjointEigenSolver.h b/Eigen/src/QR/SelfAdjointEigenSolver.h index 765af7d21..9e929620c 100644 --- a/Eigen/src/QR/SelfAdjointEigenSolver.h +++ b/Eigen/src/QR/SelfAdjointEigenSolver.h @@ -204,7 +204,7 @@ void SelfAdjointEigenSolver<MatrixType>::compute(const MatrixType& matrix, bool for (int i = 0; i < n-1; i++) { int k; - m_eivalues.block(i,n-i).minCoeff(&k); + m_eivalues.segment(i,n-i).minCoeff(&k); if (k > 0) { std::swap(m_eivalues[i], m_eivalues[k+i]); |