Error at dlib/matrix/matrix_eigenvalue.h, line 629

  • ouch!

    ouch! - 2013-05-21

    Hi, Davis.

    Your dlib is definitely a very good library.
    But, unfortunately, I got an error as following when I use solve_least_squares_lm().

    Error detected at line 1177.
    Error detected in file /usr/local/lib/cpp/dlib18_0/dlib/matrix/matrix.h.
    Error detected in function T& dlib::matrix<T, num_rows,="" num_cols,="" mem_manager,="" layout="">::operator()(long int) [with T = double, long int num_rows = 0l, long int num_cols = 1l, mem_manager = dlib::memory_manager_stateless_kernel_1<char>, layout = dlib::row_major_layout].

    Failing expression was 0 <= i && i < size().
    const type matrix::operator(i)
    You must give a valid row/column number
    i: 11
    size(): 11
    this: 0xbfffe58c

    I traced it on gdb and found that it occurs at line 629 of dlib/matrix/matrix_eigenvalue.h.
    It seems not to care the case m==n, which causes overrunning on vector d.

    Would you tell me how should I fix?
    Sooner is better because the program is for business.

    • Davis

      Davis - 2013-05-21

      Hmm, that's no good.

      Does changing line 588 in matrix_eigenvalue.h from this:
      while (m < n)
      while(m < n+1)
      fix the problem?

  • ouch!

    ouch! - 2013-05-21

    Sorry Davis, I found it was my fault.
    I gave NaN derivative value to the LM method.
    Your implementation is correct.

    Sorry again for annoying you.

    P.S. NaN-Check of gradient (and hessian if the cost is acceptable) in LM method can help debugging.
    You can prevent foolish post like this one :P

    • Davis

      Davis - 2013-05-21

      No worries :)

      That's a good idea. I'll add some debug mode only NaN checks.


      Last edit: Davis 2013-05-21

Log in to post a comment.