[eigen] Weird Problem in Splines Module

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


Hello,

I hope people don’t mind me asking a question about something that is in /unsupported. I have a set of (X,Y) values and I’m trying to use splines to get values for Y in between my X values.

This (simplified) code:

    typedef Eigen::Spline<float, 1, 3> TSpline;
    Eigen::ArrayXf ctrls(41); for (int i = 0; i < 41; i++) ctrls[i] = -200 + (i *10);
    Eigen::ArrayXf vals = Eigen::ArrayXf::Ones(41);
    std::cout << "ctrls " << ctrls.transpose() << std::endl;
    std::cout << "vals " << vals.transpose() << std::endl;
    TSpline spline(ctrls, vals);

    Eigen::ArrayXf vals2 = Eigen::ArrayXf::Zero(41);
    for (int i = 0; i < 41; i++) {
        std::cout << "i " << i << " ctrl " << ctrls[i] << std::endl;
        vals2[i] = spline(ctrls[i])[0];
        std::cout << "vals2 " << vals2[i] << std::endl; 
    }
    std::cout << "vals2 " << vals2.transpose() << std::endl;

fails inside the loop on the second iteration on my machine. It produces the following output:

ctrls -200 -190 -180 -170 -160 -150 -140 -130 -120 -110 -100  -90  -80  -70  -60  -50  -40  -30  -20  -10    0   10   20   30   40   50   60   70   80   90  100  110  120  130  140  150  160  170  180  190  200
vals 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
i 0 ctrl -200
vals2 1
i 1 ctrl -190
Assertion failed: (startRow >= 0 && blockRows >= 0 && startRow <= xpr.rows() - blockRows && startCol >= 0 && blockCols >= 0 && startCol <= xpr.cols() - blockCols), function Block, file /Users/Tobias/Code/eigen_repo/Eigen/src/Core/Block.h, line 147.

This is with a Debug compile against an update repo version of Eigen, compiled with Apple LLVM version 7.0.2 (clang-700.1.81).

I am very confused as the call to spline() succeeds the first time. In my actual code, it gets through 5 or 6 iterations before failing.

Thanks in advance,
Toby



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