Cleanup EIGEN_SPARSE_PUBLIC_INTERFACE, it is now a simple alias to EIGEN_GENERIC_PUBLIC_INTERFACE

This commit is contained in:
Gael Guennebaud 2015-10-08 22:06:49 +02:00
parent c9718514f5
commit 186ec1437c
12 changed files with 34 additions and 37 deletions

View File

@ -761,16 +761,17 @@ namespace Eigen {
Flags = Eigen::internal::traits<Derived>::Flags, \
SizeAtCompileTime = Base::SizeAtCompileTime, \
MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
using Base::derived; \
using Base::const_cast_derived;
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
typedef typename Base::PacketScalar PacketScalar; \
enum { MaxRowsAtCompileTime = Eigen::internal::traits<Derived>::MaxRowsAtCompileTime, \
MaxColsAtCompileTime = Eigen::internal::traits<Derived>::MaxColsAtCompileTime}; \
using Base::derived; \
using Base::const_cast_derived;
MaxColsAtCompileTime = Eigen::internal::traits<Derived>::MaxColsAtCompileTime};
#define EIGEN_PLAIN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
#define EIGEN_PLAIN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b)

View File

@ -23,6 +23,8 @@ public:
enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
protected:
enum { OuterSize = IsRowMajor ? BlockRows : BlockCols };
typedef SparseMatrixBase<BlockType> Base;
using Base::convert_index;
public:
EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
@ -88,10 +90,11 @@ class sparse_matrix_block_impl
{
typedef typename internal::remove_all<typename SparseMatrixType::Nested>::type _MatrixTypeNested;
typedef Block<SparseMatrixType, BlockRows, BlockCols, true> BlockType;
typedef SparseCompressedBase<Block<SparseMatrixType,BlockRows,BlockCols,true> > Base;
using Base::convert_index;
public:
enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
typedef SparseCompressedBase<Block<SparseMatrixType,BlockRows,BlockCols,true> > Base;
_EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
protected:
typedef typename Base::IndexVector IndexVector;
enum { OuterSize = IsRowMajor ? BlockRows : BlockCols };
@ -359,7 +362,9 @@ template<typename XprType, int BlockRows, int BlockCols, bool InnerPanel>
class BlockImpl<XprType,BlockRows,BlockCols,InnerPanel,Sparse>
: public SparseMatrixBase<Block<XprType,BlockRows,BlockCols,InnerPanel> >, internal::no_assignment_operator
{
typedef Block<XprType, BlockRows, BlockCols, InnerPanel> BlockType;
typedef Block<XprType, BlockRows, BlockCols, InnerPanel> BlockType;
typedef SparseMatrixBase<BlockType> Base;
using Base::convert_index;
public:
enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)

View File

@ -28,7 +28,7 @@ class SparseCompressedBase
{
public:
typedef SparseMatrixBase<Derived> Base;
_EIGEN_SPARSE_PUBLIC_INTERFACE(SparseCompressedBase)
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseCompressedBase)
using Base::operator=;
using Base::IsRowMajor;

View File

@ -35,6 +35,7 @@ class CwiseBinaryOpImpl<BinaryOp, Lhs, Rhs, Sparse>
{
public:
typedef CwiseBinaryOp<BinaryOp, Lhs, Rhs> Derived;
typedef SparseMatrixBase<Derived> Base;
EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
CwiseBinaryOpImpl()
{

View File

@ -191,7 +191,7 @@ class Map<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType>
{
public:
typedef SparseMapBase<Map> Base;
_EIGEN_SPARSE_PUBLIC_INTERFACE(Map)
EIGEN_SPARSE_PUBLIC_INTERFACE(Map)
enum { IsRowMajor = Base::IsRowMajor };
public:
@ -211,7 +211,7 @@ class Map<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType
{
public:
typedef SparseMapBase<Map> Base;
_EIGEN_SPARSE_PUBLIC_INTERFACE(Map)
EIGEN_SPARSE_PUBLIC_INTERFACE(Map)
enum { IsRowMajor = Base::IsRowMajor };
public:

View File

@ -92,11 +92,12 @@ template<typename _Scalar, int _Options, typename _Index>
class SparseMatrix
: public SparseCompressedBase<SparseMatrix<_Scalar, _Options, _Index> >
{
public:
typedef SparseCompressedBase<SparseMatrix> Base;
using Base::convert_index;
public:
using Base::isCompressed;
using Base::nonZeros;
_EIGEN_SPARSE_PUBLIC_INTERFACE(SparseMatrix)
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseMatrix)
using Base::operator+=;
using Base::operator-=;

View File

@ -58,7 +58,7 @@ template<typename Derived> class SparseRefBase
public:
typedef SparseMapBase<Derived> Base;
_EIGEN_SPARSE_PUBLIC_INTERFACE(SparseRefBase)
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseRefBase)
SparseRefBase()
: Base(RowsAtCompileTime==Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==Dynamic?0:ColsAtCompileTime, 0, 0, 0, 0, 0)
@ -104,7 +104,7 @@ class Ref<SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType >
public:
typedef internal::SparseRefBase<Ref> Base;
_EIGEN_SPARSE_PUBLIC_INTERFACE(Ref)
EIGEN_SPARSE_PUBLIC_INTERFACE(Ref)
#ifndef EIGEN_PARSED_BY_DOXYGEN
@ -148,7 +148,7 @@ class Ref<const SparseMatrix<MatScalar,MatOptions,MatIndex>, Options, StrideType
public:
typedef internal::SparseRefBase<Ref> Base;
_EIGEN_SPARSE_PUBLIC_INTERFACE(Ref)
EIGEN_SPARSE_PUBLIC_INTERFACE(Ref)
template<typename Derived>
inline Ref(const SparseMatrixBase<Derived>& expr)

View File

@ -34,10 +34,11 @@ template<typename MatrixType, unsigned int Mode> class TriangularViewImpl<Matrix
typedef TriangularView<MatrixType,Mode> TriangularViewType;
protected:
protected:
// dummy solve function to make TriangularView happy.
void solve() const;
typedef SparseMatrixBase<TriangularViewType> Base;
public:
EIGEN_SPARSE_PUBLIC_INTERFACE(TriangularViewType)

View File

@ -39,26 +39,11 @@ EIGEN_STRONG_INLINE Derived& operator Op(const Other& scalar) \
#define EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(Derived, =)
// TODO this is mostly the same as EIGEN_GENERIC_PUBLIC_INTERFACE
#define _EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) \
typedef typename Eigen::internal::traits<Derived >::Scalar Scalar; \
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
typedef typename Eigen::internal::ref_selector<Derived >::type Nested; \
typedef typename Eigen::internal::traits<Derived >::StorageKind StorageKind; \
typedef typename Eigen::internal::traits<Derived >::StorageIndex StorageIndex; \
enum { RowsAtCompileTime = Eigen::internal::traits<Derived >::RowsAtCompileTime, \
ColsAtCompileTime = Eigen::internal::traits<Derived >::ColsAtCompileTime, \
Flags = Eigen::internal::traits<Derived>::Flags, \
SizeAtCompileTime = Base::SizeAtCompileTime, \
IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
using Base::derived; \
using Base::const_cast_derived; \
using Base::convert_index;
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) \
typedef Eigen::SparseMatrixBase<Derived > Base; \
_EIGEN_SPARSE_PUBLIC_INTERFACE(Derived)
#define EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) \
EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
const int CoherentAccessPattern = 0x1;
const int InnerRandomAccessPattern = 0x2 | CoherentAccessPattern;
const int OuterRandomAccessPattern = 0x4 | CoherentAccessPattern;

View File

@ -66,9 +66,9 @@ class SparseVector
: public SparseCompressedBase<SparseVector<_Scalar, _Options, _StorageIndex> >
{
typedef SparseCompressedBase<SparseVector> Base;
using Base::convert_index;
public:
_EIGEN_SPARSE_PUBLIC_INTERFACE(SparseVector)
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseVector)
EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseVector, +=)
EIGEN_SPARSE_INHERIT_ASSIGNMENT_OPERATOR(SparseVector, -=)

View File

@ -32,6 +32,7 @@ class SparseView : public SparseMatrixBase<SparseView<MatrixType> >
{
typedef typename MatrixType::Nested MatrixTypeNested;
typedef typename internal::remove_all<MatrixTypeNested>::type _MatrixTypeNested;
typedef SparseMatrixBase<SparseView > Base;
public:
EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView)
typedef typename internal::remove_all<MatrixType>::type NestedExpression;

View File

@ -56,6 +56,8 @@ template<typename _Scalar, int _Options, typename _StorageIndex>
class DynamicSparseMatrix
: public SparseMatrixBase<DynamicSparseMatrix<_Scalar, _Options, _StorageIndex> >
{
typedef SparseMatrixBase<DynamicSparseMatrix> Base;
using Base::convert_index;
public:
EIGEN_SPARSE_PUBLIC_INTERFACE(DynamicSparseMatrix)
// FIXME: why are these operator already alvailable ???