mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
Make innerVector() and innerVectors() methods available to all expressions supported by Block.
Before, only SparseBase exposed such methods.
This commit is contained in:
parent
e116f6847e
commit
368dd4cd9d
@ -326,46 +326,6 @@ private:
|
||||
|
||||
//----------
|
||||
|
||||
/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
|
||||
* is col-major (resp. row-major).
|
||||
*/
|
||||
template<typename Derived>
|
||||
typename SparseMatrixBase<Derived>::InnerVectorReturnType SparseMatrixBase<Derived>::innerVector(Index outer)
|
||||
{ return InnerVectorReturnType(derived(), outer); }
|
||||
|
||||
/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
|
||||
* is col-major (resp. row-major). Read-only.
|
||||
*/
|
||||
template<typename Derived>
|
||||
const typename SparseMatrixBase<Derived>::ConstInnerVectorReturnType SparseMatrixBase<Derived>::innerVector(Index outer) const
|
||||
{ return ConstInnerVectorReturnType(derived(), outer); }
|
||||
|
||||
/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
|
||||
* is col-major (resp. row-major).
|
||||
*/
|
||||
template<typename Derived>
|
||||
typename SparseMatrixBase<Derived>::InnerVectorsReturnType
|
||||
SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize)
|
||||
{
|
||||
return Block<Derived,Dynamic,Dynamic,true>(derived(),
|
||||
IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
|
||||
IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);
|
||||
|
||||
}
|
||||
|
||||
/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
|
||||
* is col-major (resp. row-major). Read-only.
|
||||
*/
|
||||
template<typename Derived>
|
||||
const typename SparseMatrixBase<Derived>::ConstInnerVectorsReturnType
|
||||
SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize) const
|
||||
{
|
||||
return Block<const Derived,Dynamic,Dynamic,true>(derived(),
|
||||
IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
|
||||
IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);
|
||||
|
||||
}
|
||||
|
||||
/** Generic implementation of sparse Block expression.
|
||||
* Real-only.
|
||||
*/
|
||||
|
@ -350,18 +350,6 @@ template<typename Derived> class SparseMatrixBase
|
||||
const ConstTransposeReturnType transpose() const { return ConstTransposeReturnType(derived()); }
|
||||
const AdjointReturnType adjoint() const { return AdjointReturnType(transpose()); }
|
||||
|
||||
// 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;
|
||||
|
||||
// set of inner-vectors
|
||||
typedef Block<Derived,Dynamic,Dynamic,true> InnerVectorsReturnType;
|
||||
typedef Block<const Derived,Dynamic,Dynamic,true> ConstInnerVectorsReturnType;
|
||||
InnerVectorsReturnType innerVectors(Index outerStart, Index outerSize);
|
||||
const ConstInnerVectorsReturnType innerVectors(Index outerStart, Index outerSize) const;
|
||||
|
||||
DenseMatrixType toDense() const
|
||||
{
|
||||
return DenseMatrixType(derived());
|
||||
|
@ -40,6 +40,14 @@ typedef const VectorBlock<const Derived> ConstSegmentReturnType;
|
||||
template<int Size> struct FixedSegmentReturnType { typedef VectorBlock<Derived, Size> Type; };
|
||||
template<int Size> struct ConstFixedSegmentReturnType { typedef const VectorBlock<const Derived, Size> Type; };
|
||||
|
||||
/// \internal 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;
|
||||
|
||||
/// \internal set of inner-vectors
|
||||
typedef Block<Derived,Dynamic,Dynamic,true> InnerVectorsReturnType;
|
||||
typedef Block<const Derived,Dynamic,Dynamic,true> ConstInnerVectorsReturnType;
|
||||
|
||||
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
||||
|
||||
/// \returns an expression of a block in \c *this with either dynamic or fixed sizes.
|
||||
@ -1354,3 +1362,39 @@ inline typename ConstFixedSegmentReturnType<N>::Type tail(Index n = N) const
|
||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
|
||||
return typename ConstFixedSegmentReturnType<N>::Type(derived(), size() - n);
|
||||
}
|
||||
|
||||
/// \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
|
||||
/// is col-major (resp. row-major).
|
||||
///
|
||||
InnerVectorReturnType innerVector(Index outer)
|
||||
{ return InnerVectorReturnType(derived(), outer); }
|
||||
|
||||
/// \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
|
||||
/// is col-major (resp. row-major). Read-only.
|
||||
///
|
||||
const ConstInnerVectorReturnType innerVector(Index outer) const
|
||||
{ return ConstInnerVectorReturnType(derived(), outer); }
|
||||
|
||||
/// \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
|
||||
/// is col-major (resp. row-major).
|
||||
///
|
||||
InnerVectorsReturnType
|
||||
innerVectors(Index outerStart, Index outerSize)
|
||||
{
|
||||
return Block<Derived,Dynamic,Dynamic,true>(derived(),
|
||||
IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
|
||||
IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);
|
||||
|
||||
}
|
||||
|
||||
/// \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this
|
||||
/// is col-major (resp. row-major). Read-only.
|
||||
///
|
||||
const ConstInnerVectorsReturnType
|
||||
innerVectors(Index outerStart, Index outerSize) const
|
||||
{
|
||||
return Block<const Derived,Dynamic,Dynamic,true>(derived(),
|
||||
IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
|
||||
IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user