Bug 607 - SparseVector assign to DenseVector causes segfault for DenseVector=RowVector
SparseVector assign to DenseVector causes segfault for DenseVector=RowVector
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Sparse
3.1
All All
: Normal Unknown
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-31 14:03 UTC by Alexander Werner
Modified: 2013-06-10 00:07 UTC (History)
1 user (show)



Attachments
Code to reproduce problem (627 bytes, text/x-c++src)
2013-05-31 14:03 UTC, Alexander Werner
no flags Details

Description Alexander Werner 2013-05-31 14:03:42 UTC
Created attachment 339 [details]
Code to reproduce problem

Assigning a SparseVector (which seems to be more a SparseColVector)
to a dense row-vector fails. The same works for dense to dense 
assignments.


Valgrind reports:
==29380== Invalid write of size 8
==29380==    at 0x804E5A0: void Eigen::SparseMatrixBase<Eigen::SparseVector<double, 0, int> >::evalTo<Eigen::Matrix<double, 1, -1, 1, 1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> >&) const (SparseMatrixBase.h:423)
==29380==    by 0x804EE53: Eigen::Matrix<double, 1, -1, 1, 1, -1>& Eigen::MatrixBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> >::operator=<Eigen::SparseVector<double, 0, int> >(Eigen::EigenBase<Eigen::SparseVector<double, 0, int> > const&) (Assign.h:569)
==29380==    by 0x804A4F4: main (test.cpp:21)
==29380==  Address 0x4339180 is 0 bytes after a block of size 32 alloc'd
==29380==    at 0x4027416: memalign (vg_replace_malloc.c:581)
==29380==    by 0x4027473: posix_memalign (vg_replace_malloc.c:709)
==29380==    by 0x804C6EF: Eigen::internal::aligned_malloc(unsigned int) (Memory.h:204)
==29380==    by 0x804D290: void* Eigen::internal::conditional_aligned_malloc<true>(unsigned int) (Memory.h:283)
==29380==    by 0x804E17D: double* Eigen::internal::conditional_aligned_new_auto<double, true>(unsigned int) (Memory.h:403)
==29380==    by 0x804C884: Eigen::DenseStorage<double, -1, 1, -1, 1>::DenseStorage(int, int, int) (DenseStorage.h:237)
==29380==    by 0x804F16A: Eigen::PlainObjectBase<Eigen::Matrix<double, 1, -1, 1, 1, -1> >::PlainObjectBase(int, int, int) (in /home/wern_al/a.out)
==29380==    by 0x80497CB: main (test.cpp:13)
==29380==
Comment 1 Gael Guennebaud 2013-06-10 00:07:48 UTC
thanks for the report.

https://bitbucket.org/eigen/eigen/commits/27bf0b24cf67/
Changeset:   27bf0b24cf67
User:        ggael
Date:        2013-06-10 00:06:40
Summary:     Fix bug 607: handle implicit transposition from sparse vector to dense vector

Note You need to log in before you can comment on or make changes to this bug.