[eigen] AnyMatrixBase

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


I've been looking for a common base class for MatrixXi and CwiseNullaryOp in oder to address both by a pointer. As I understood there doesn't exist any in order to avoid virtual classes.
In the forum I found a thread refering to a class AnyMatrixBase which I'm unable to find in the recent development tree. A different suggestion was using variant classes. 
How about an class exhibiting the most common methods of MatrixBase (Proxy Pattern)? This proxy could indeed be a virtual function allowing polymorphism.

template <typename Scalar>
AnyMatrixBase {
        virtual Scalar operator()(int,int) const = 0;

template<typename MatrixType>
class AnyMatrix : public AnyMatrixBase<typename ei_traits<MatrixType>::Scalar>  {
                typedef typename ei_traits<MatrixType>::Scalar Scalar; 
                AnyMatrix(MatrixType *m) : m_ref(m){};
                virtual Scalar operator()(int i,int j) const {
                boost::scoped_ptr<MatrixType> m_ref;

A completely different question: are there any attempts to serialize Eigen objects (e.g., like boost.serialize does)?

Best regards 

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/