[eigen] Re: Compilation errors when assigning a block from a sparse matrix

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


Hello,

I am having problems when I try to assign a block of data to a sparse
matrix.  I think I am using the block() method as the documentation
says, but my compiler is reporting that I am using an incorrect number
of parameters.  What could be wrong?

| libeigen3-dev | 3.3~alpha1-2 |
| g++           |      5.2.1-4 |


Thank you,

--8<---------------cut here---------------start------------->8---
#include <Eigen/Sparse>

int main(int argc, char *argv[])
{
  Eigen::SparseMatrix<double> m(10, 10);

  m.block<3, 3>(0, 0) = Eigen::Matrix3d::Identity();

  return 0;
}
--8<---------------cut here---------------end--------------->8---

In file included from /usr/include/eigen3/Eigen/Core:379:0,
                 from /usr/include/eigen3/Eigen/SparseCore:4,
                 from /usr/include/eigen3/Eigen/Sparse:19,
                 from block_sparse.cpp:1:
/usr/include/eigen3/Eigen/src/Core/Block.h: In instantiation of ‘Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel>::Block(XprType&, Eigen::Index, Eigen::Index) [with XprType = Eigen::SparseMatrix<double>; int BlockRows = 3; int BlockCols = 3; bool InnerPanel = false; Eigen::Index = long int]’:
/usr/include/eigen3/Eigen/src/SparseCore/../plugins/BlockMethods.h:725:76:   required from ‘Eigen::Block<Derived, CRows, CCols> Eigen::SparseMatrixBase<Derived>::block(Eigen::Index, Eigen::Index) [with int BlockRows = 3; int BlockCols = 3; Derived = Eigen::SparseMatrix<double>; Eigen::Index = long int]’
block_sparse.cpp:7:21:   required from here
/usr/include/eigen3/Eigen/src/Core/Block.h:130:37: error: no matching function for call to ‘Eigen::BlockImpl<Eigen::SparseMatrix<double>, 3, 3, false, Eigen::Sparse>::BlockImpl(Eigen::SparseMatrix<double>&, Eigen::Index&, Eigen::Index&)’
       : Impl(xpr, startRow, startCol)
                                     ^
In file included from /usr/include/eigen3/Eigen/SparseCore:43:0,
                 from /usr/include/eigen3/Eigen/Sparse:19,
                 from block_sparse.cpp:1:
/usr/include/eigen3/Eigen/src/SparseCore/SparseBlock.h:361:12: note: candidate: Eigen::BlockImpl<XprType, BlockRows, BlockCols, InnerPanel, Eigen::Sparse>::BlockImpl(const XprType&, Eigen::Index, Eigen::Index, Eigen::Index, Eigen::Index) [with XprType = Eigen::SparseMatrix<double>; int BlockRows = 3; int BlockCols = 3; bool InnerPanel = false; Eigen::Index = long int]
     inline BlockImpl(const XprType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols)
            ^
/usr/include/eigen3/Eigen/src/SparseCore/SparseBlock.h:361:12: note:   candidate expects 5 arguments, 3 provided
/usr/include/eigen3/Eigen/src/SparseCore/SparseBlock.h:351:12: note: candidate: Eigen::BlockImpl<XprType, BlockRows, BlockCols, InnerPanel, Eigen::Sparse>::BlockImpl(const XprType&, Eigen::Index) [with XprType = Eigen::SparseMatrix<double>; int BlockRows = 3; int BlockCols = 3; bool InnerPanel = false; Eigen::Index = long int]
     inline BlockImpl(const XprType& xpr, Index i)
            ^
/usr/include/eigen3/Eigen/src/SparseCore/SparseBlock.h:351:12: note:   candidate expects 2 arguments, 3 provided
/usr/include/eigen3/Eigen/src/SparseCore/SparseBlock.h:339:7: note: candidate: Eigen::BlockImpl<Eigen::SparseMatrix<double>, 3, 3, false, Eigen::Sparse>::BlockImpl(const Eigen::BlockImpl<Eigen::SparseMatrix<double>, 3, 3, false, Eigen::Sparse>&)
 class BlockImpl<XprType,BlockRows,BlockCols,InnerPanel,Sparse>
       ^
/usr/include/eigen3/Eigen/src/SparseCore/SparseBlock.h:339:7: note:   candidate expects 1 argument, 3 provided
In file included from /usr/include/eigen3/Eigen/Core:349:0,
                 from /usr/include/eigen3/Eigen/SparseCore:4,
                 from /usr/include/eigen3/Eigen/Sparse:19,
                 from block_sparse.cpp:1:
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h: In instantiation of ‘void Eigen::internal::call_assignment_no_alias(Dst&, const Src&, const Func&) [with Dst = Eigen::Block<Eigen::SparseMatrix<double>, 3, 3, false>; Src = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, 3, 3> >; Func = Eigen::internal::assign_op<double>]’:
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:770:27:   required from ‘void Eigen::internal::call_assignment_no_alias(Dst&, const Src&) [with Dst = Eigen::Block<Eigen::SparseMatrix<double>, 3, 3, false>; Src = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, 3, 3> >]’
/usr/include/eigen3/Eigen/src/SparseCore/SparseAssign.h:19:37:   required from ‘Derived& Eigen::SparseMatrixBase<Derived>::operator=(const Eigen::EigenBase<OtherDerived>&) [with OtherDerived = Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<double>, Eigen::Matrix<double, 3, 3> >; Derived = Eigen::Block<Eigen::SparseMatrix<double>, 3, 3, false>]’
block_sparse.cpp:7:23:   required from here
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:750:5: error: ‘class Eigen::Block<Eigen::SparseMatrix<double>, 3, 3, false>’ has no member named ‘resize’
     dst.resize(dstRows, dstCols);
     ^
<builtin>: recipe for target 'block_sparse' failed



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