Re: [eigen] Eigen::RandomSetter leads to assertion failure

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


bug fixed

gael

On Fri, May 15, 2009 at 10:04 AM, Moritz Lenz
<mlenz@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Hi,
>
> in trunk this piece of code (which I believed worked earlier, before Gael
> re-worked the sparse filling code) gives:
>
> t: /home/mlenz/tmp/eigen2-git/Eigen/src/Sparse/SparseMatrix.h:193: void
> Eigen::SparseMatrix<_Scalar, _Flags>::startVec(int) [with _Scalar = int, int
> _Flags = 1]: Assertion `m_outerIndex[outer]==int(m_data.size()) && "you must
> call startVec on each inner vec"' failed.
> Aborted
>
>
> #include <iostream>
> #include <complex>
> #include <Eigen/Core>
> #include <Eigen/Sparse>
> #include <stdlib.h>
> using namespace std;
>
> using namespace Eigen;
>
> typedef Eigen::SparseMatrix< int , Eigen::RowMajor> esm;
> typedef Eigen::RandomSetter< esm > ers;
>
> int main(int argc, char** argv) {
>    srand(1);
>    esm a(100, 100);
>    {
>        ers s(a);
>        for (int x = 0; x < 100; x++) {
>            for (int y = 0; y < 100; y++) {
>                if (rand() < RAND_MAX / 2)
>                    s(x, y) = 3;
>            }
>        }
>    }
> }
>  // vim: ts=4 sw=4 expandtab
>
>
> Cheers,
> Moritz
>
>
>



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