diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-03-21 14:04:53 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-03-21 14:04:53 +0400 |
commit | 3411146984316c97f56543333a46f47aeb7f9d35 (patch) | |
tree | 5de608a3c18ff2a5459fd2191609dd882ad86213 /extern/Eigen3/Eigen/src/SparseCore/SparseMatrixBase.h | |
parent | 1781928f9d720fa1dc4811afb69935b35aa89878 (diff) |
Update Eigen to version 3.2.1
Main purpose of this is to have SparseLU solver which
we can use now as a replacement to opennl library.
Diffstat (limited to 'extern/Eigen3/Eigen/src/SparseCore/SparseMatrixBase.h')
-rw-r--r-- | extern/Eigen3/Eigen/src/SparseCore/SparseMatrixBase.h | 77 |
1 files changed, 35 insertions, 42 deletions
diff --git a/extern/Eigen3/Eigen/src/SparseCore/SparseMatrixBase.h b/extern/Eigen3/Eigen/src/SparseCore/SparseMatrixBase.h index 9a1258097fe..bbcf7fb1c62 100644 --- a/extern/Eigen3/Eigen/src/SparseCore/SparseMatrixBase.h +++ b/extern/Eigen3/Eigen/src/SparseCore/SparseMatrixBase.h @@ -89,6 +89,9 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived> */ IsRowMajor = Flags&RowMajorBit ? 1 : 0, + + InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime) + : int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime), #ifndef EIGEN_PARSED_BY_DOXYGEN _HasDirectAccess = (int(Flags)&DirectAccessBit) ? 1 : 0 // workaround sunCC @@ -102,7 +105,7 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived> >::type AdjointReturnType; - typedef SparseMatrix<Scalar, Flags&RowMajorBit ? RowMajor : ColMajor> PlainObject; + typedef SparseMatrix<Scalar, Flags&RowMajorBit ? RowMajor : ColMajor, Index> PlainObject; #ifndef EIGEN_PARSED_BY_DOXYGEN @@ -136,13 +139,13 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived> # include "../plugins/CommonCwiseBinaryOps.h" # include "../plugins/MatrixCwiseUnaryOps.h" # include "../plugins/MatrixCwiseBinaryOps.h" +# include "../plugins/BlockMethods.h" # ifdef EIGEN_SPARSEMATRIXBASE_PLUGIN # include EIGEN_SPARSEMATRIXBASE_PLUGIN # endif # undef EIGEN_CURRENT_STORAGE_BASE_CLASS #undef EIGEN_CURRENT_STORAGE_BASE_CLASS - /** \returns the number of rows. \sa cols() */ inline Index rows() const { return derived().rows(); } /** \returns the number of columns. \sa rows() */ @@ -299,8 +302,8 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived> } else { - SparseMatrix<Scalar, RowMajorBit> trans = m; - s << static_cast<const SparseMatrixBase<SparseMatrix<Scalar, RowMajorBit> >&>(trans); + SparseMatrix<Scalar, RowMajorBit, Index> trans = m; + s << static_cast<const SparseMatrixBase<SparseMatrix<Scalar, RowMajorBit, Index> >&>(trans); } } return s; @@ -322,8 +325,8 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived> typename internal::traits<OtherDerived>::Scalar \ >::ReturnType \ >, \ - Derived, \ - OtherDerived \ + const Derived, \ + const OtherDerived \ > template<typename OtherDerived> @@ -387,55 +390,45 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived> template<typename OtherDerived> Scalar dot(const SparseMatrixBase<OtherDerived>& other) const; RealScalar squaredNorm() const; RealScalar norm() const; + RealScalar blueNorm() const; Transpose<Derived> transpose() { return derived(); } const Transpose<const Derived> transpose() const { return derived(); } const AdjointReturnType adjoint() const { return transpose(); } - // sub-vector - SparseInnerVectorSet<Derived,1> row(Index i); - const SparseInnerVectorSet<Derived,1> row(Index i) const; - SparseInnerVectorSet<Derived,1> col(Index j); - const SparseInnerVectorSet<Derived,1> col(Index j) const; - SparseInnerVectorSet<Derived,1> innerVector(Index outer); - const SparseInnerVectorSet<Derived,1> innerVector(Index outer) const; - - // set of sub-vectors - SparseInnerVectorSet<Derived,Dynamic> subrows(Index start, Index size); - const SparseInnerVectorSet<Derived,Dynamic> subrows(Index start, Index size) const; - SparseInnerVectorSet<Derived,Dynamic> subcols(Index start, Index size); - const SparseInnerVectorSet<Derived,Dynamic> subcols(Index start, Index size) const; - - SparseInnerVectorSet<Derived,Dynamic> middleRows(Index start, Index size); - const SparseInnerVectorSet<Derived,Dynamic> middleRows(Index start, Index size) const; - SparseInnerVectorSet<Derived,Dynamic> middleCols(Index start, Index size); - const SparseInnerVectorSet<Derived,Dynamic> middleCols(Index start, Index size) const; - SparseInnerVectorSet<Derived,Dynamic> innerVectors(Index outerStart, Index outerSize); - const SparseInnerVectorSet<Derived,Dynamic> innerVectors(Index outerStart, Index outerSize) const; - - /** \internal use operator= */ - template<typename DenseDerived> - void evalTo(MatrixBase<DenseDerived>& dst) const - { - dst.setZero(); - for (Index j=0; j<outerSize(); ++j) - for (typename Derived::InnerIterator i(derived(),j); i; ++i) - dst.coeffRef(i.row(),i.col()) = i.value(); - } + // inner-vector + typedef Block<Derived,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true> InnerVectorReturnType; + typedef Block<const Derived,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true> ConstInnerVectorReturnType; + InnerVectorReturnType innerVector(Index outer); + const ConstInnerVectorReturnType innerVector(Index outer) const; - Matrix<Scalar,RowsAtCompileTime,ColsAtCompileTime> toDense() const - { - return derived(); - } + // set of inner-vectors + Block<Derived,Dynamic,Dynamic,true> innerVectors(Index outerStart, Index outerSize); + const Block<const Derived,Dynamic,Dynamic,true> innerVectors(Index outerStart, Index outerSize) const; + + /** \internal use operator= */ + template<typename DenseDerived> + void evalTo(MatrixBase<DenseDerived>& dst) const + { + dst.setZero(); + for (Index j=0; j<outerSize(); ++j) + for (typename Derived::InnerIterator i(derived(),j); i; ++i) + dst.coeffRef(i.row(),i.col()) = i.value(); + } + + Matrix<Scalar,RowsAtCompileTime,ColsAtCompileTime> toDense() const + { + return derived(); + } template<typename OtherDerived> bool isApprox(const SparseMatrixBase<OtherDerived>& other, - RealScalar prec = NumTraits<Scalar>::dummy_precision()) const + const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const { return toDense().isApprox(other.toDense(),prec); } template<typename OtherDerived> bool isApprox(const MatrixBase<OtherDerived>& other, - RealScalar prec = NumTraits<Scalar>::dummy_precision()) const + const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const { return toDense().isApprox(other,prec); } /** \returns the matrix or vector obtained by evaluating this expression. |