This forum has been archived. All content is frozen. Please use KDE Discuss instead.

SparseMatrix::ReverseInnerIterator in Eigen 3.3

Tags: None
(comma "," separated)
joaoruileal
Registered Member
Posts
18
Karma
0
OS
Hello!

The following code is given me an error:
Code: Select all
    Eigen::SparseMatrix<double> A;
    for (typename Eigen::SparseMatrix<double>::ReverseInnerIterator itA(A, 0); itA; --itA) {
    }

The error is:
(...)/eigen/Eigen/src/Core/util/XprHelper.h:118:23: error: ‘Eigen::internal::variable_if_dynamic<T, -1>::variable_if_dynamic() [with T = long int]’ is private
EIGEN_DEVICE_FUNC variable_if_dynamic() { eigen_assert(false); }

The ReverseInnerIterator is probably not fully implemented in 3.3 (from the post https://forum.kde.org/viewtopic.php?f=74&t=132629&hilit=ReverseInnerIterator).
Is there a way around this?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
joaoruileal
Registered Member
Posts
18
Karma
0
OS
Thank you! :)
joaoruileal
Registered Member
Posts
18
Karma
0
OS
I spotted a minor warning during compilation which might be related to the fix:

Eigen/src/SparseCore/SparseCompressedBase.h: In instantiation of ‘Eigen::SparseCompressedBase<Derived>::ReverseInnerIterator::ReverseInnerIterator(const Eigen::SparseCompressedBase<Derived>&) [with Derived = Eigen::SparseVector<double, 0, int>]’:
Eigen/src/SparseCore/SparseCompressedBase.h:265:11: warning: ‘Eigen::SparseCompressedBase<Eigen::SparseVector<double, 0, int> >::ReverseInnerIterator::m_start’ will be initialized after [-Wreorder]
Index m_start;
^
Eigen/src/SparseCore/SparseCompressedBase.h:264:11: warning: ‘Eigen::Index Eigen::SparseCompressedBase<Eigen::SparseVector<double, 0, int> >::ReverseInnerIterator::m_id’ [-Wreorder]
Index m_id;
^
Eigen/src/SparseCore/SparseCompressedBase.h:235:14: warning: when initialized here [-Wreorder]
explicit ReverseInnerIterator(const SparseCompressedBase& mat)
joaoruileal
Registered Member
Posts
18
Karma
0
OS
Spotted one more thing. It is possible to do:
Code: Select all
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> Ad;
Eigen::SparseMatrix<double> A = Ad.transpose().sparseView();

but not
Code: Select all
Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> Ad;
Eigen::SparseMatrix<double> A = Ad.sparseView().transpose();

It gives the following error:
Eigen/src/SparseCore/SparseTranspose.h:59:63: error: no type named ‘ReverseInnerIterator’ in ‘struct Eigen::internal::evaluator<const Eigen::SparseView<Eigen::Matrix<double, -1, -1> > >’
typedef typename evaluator<ArgType>::ReverseInnerIterator EvalReverseIterator;
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Both are fixed.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]