Search code examples
eigen

Eigen- Compile errors for Eigen::Map<const Eigen::SparseVector<float>>


I'm trying to use Eigen's map feature to map to a sparse vector in memory, but I seem to be unable to compile a declaration to this because 'InnerStrideAtCompileTime' is not a member of 'Eigen::SparseVector<_Scalar, 0, _StorageIndex>'.

Is this unsupported?

Example code:

    #include <Eigen/Core>
    #include <Eigen/SparseCore>

    void Foo()
    {
       int innerIndices[10];
       float values[10];
       Eigen::Map<const Eigen::SparseVector<float>> eigenRigOffsets(100, 10, &innerIndices[0], &values[0]);

    }

Solution

  • It would appear to not (yet) be supported. There is support for Eigen::Map<Eigen::SparseMatrix<float>> (as shown in the documentation), though that's not what you asked for. Possibly, ggael will have a better answer (or implementation).