This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 705

Summary: Incorrect Choleskly (LLT) return code when MKL is enabled
Product: Eigen Reporter: richard.jw.roberts
Component: CholeskyAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: major CC: chtz, gael.guennebaud, mletombe, richard.jw.roberts
Priority: Normal    
Version: 3.2   
Hardware: All   
OS: All   
Whiteboard:

Description richard.jw.roberts 2013-11-19 17:59:01 UTC
When MKL is enabled, LLT returns the wrong error/success code.  This appears to be due to misinterpretation of the return code of an internal function:

For both MKL and non-MKL mode, LLT_Traits::inplace_decomposition() returns the value llt_inplace<...>::blocked(m) == -1.

The non-MKL llt_inplace<...>::blocked returns -1 on success and another number >=0 (?) on failure.

However, the MKL llt_inplace<...>::blocked calls mkl_llt::potrf, which returns Success (0) and NumericalIssue (1).

I think the fix is that mkl_llt::potrf should instead return -1 on success and some other number on failure.

In my tests, changing the line "info = (info==0) ? Success : NumericalIssue;" to "info = (info==0) ? -1 : 1;" in the file Eigen/src/Cholesky/LLT_MKL.h fixes the problem.  However, I'm not sure what the meaning of a failure return code is, so I'm not sure if 1 is the best value to return on error.
Comment 1 Christoph Hertzberg 2013-11-19 18:58:25 UTC
The return value seems to be the index where the decomposition failed. It looks as if this is ignored at the moment, so your fix should be ok.

I'm wondering, has anyone ever successfully ran the unit tests with MKL enabled?
Comment 2 mathieu Letombe 2015-05-22 08:45:30 UTC
Hi, 

We do use Eigen with MKL (good deal I think), and I confirm this bug. 
I think the fix of richard is good.

Thanks for your work!

Mathieu.
Comment 3 Gael Guennebaud 2015-06-05 14:00:44 UTC
Fixed:
https://bitbucket.org/eigen/eigen/commits/c54514875a7b/
https://bitbucket.org/eigen/eigen/commits/d379d6f59c0b/

(llt_inplace::blocked also returns the first failing row/column)
Comment 4 Nobody 2019-12-04 12:49:19 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com'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: https://gitlab.com/libeigen/eigen/issues/705.