This bugzilla service is closed. All entries have been migrated to

Bug 626

Summary: No range check for sparse matrix
Product: Eigen Reporter: Kolja Brix <brix>
Component: SparseAssignee: Nobody <eigen.nobody>
Severity: Unknown CC: alexander.werner, chtz, gael.guennebaud
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 387    
Description Flags
Test for sparse matrix range check none

Description Kolja Brix 2013-06-28 13:19:25 UTC
Created attachment 361 [details]
Test for sparse matrix range check

There is no range check for sparse matrices:

For a standard SparseMatrix<double, Dynamic> (row major format?), elements above the upper column limit can be inserted, e.g. an element in column 11 in a 10 x 10 sparse matrix. There is no error or exception thrown.

Inserting an entry above the row limit usually leads to a segmentation fault.

Both behaviors are demonstrated in the example code attached.
Comment 1 Christoph Hertzberg 2013-06-28 13:36:42 UTC
Indeed, this is not checked.
Another thing: Dynamic should not be a allowed as template parameter. Sparse matrices are always dynamic sized. 
Only valid options at the moment are ColMajor (default) and RowMajor.
Comment 2 Gael Guennebaud 2013-06-28 16:16:56 UTC
Both fixed for both matrices and vectors:
Changeset:   d3495e9a1994
User:        ggael
Date:        2013-06-28 15:56:43
Summary:     Bug 626: add compiletime check of the Options template parameter of SparseMatrix and SparseVector. Fix eval and plain_object for sparse objects.
Changeset:   9998c8a1b9c0
User:        ggael
Date:        2013-06-28 16:16:02
Summary:     Fix bug 626: add assertion on input ranges for coeff* and insert members for sparse objects
Comment 3 Alexander Werner 2013-08-08 09:06:43 UTC
*** Bug 641 has been marked as a duplicate of this bug. ***
Comment 4 Nobody 2019-12-04 12:27:36 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: