I am trying to call the DSS solver in MKL from the Intel Python distribution 2017 beta via the ctypes library. I have everything working properly except for repeated calls to dss_solve_complex. The first, third, fifth, ... calls yields the correct solution, yet the second, forth,... and so on give the wrong answer. Moreoever, the output is not the same for repeated runs. In addition, the solver returns success as the output even though the answer is incorrect. This same issue does not occur when calling dss_solve_real. A minimal example that can be used in both the real and complex solvers is below:
A
===
[[ 1 0 2]
[ 0 0 3]
[-4 5 6]]
b
===
[0 2 0]
The correct solution should be: [-1.33333333 -1.86666667 0.66666667]
Trying to repeatedly solve five times yields, for example:
[-1.33333333+0.j -1.86666667+0.j 0.66666667+0.j]
[ 3.13043594e-04 +3.08799744e-03j 1.50203705e-05 +1.60000000e+01j
1.60000000e+01 +1.00000000e+00j]
[-1.33333333+0.j -1.86666667+0.j 0.66666667+0.j]
[ 3.13043594e-04 +3.08799744e-03j 1.19209290e-05 +1.60000000e+01j
1.60000000e+01 +1.00000000e+00j]
[-1.33333333+0.j -1.86666667+0.j 0.66666667+0.j]
Again, I have tried to run this in the Intel Python Beta 2017, and also the latest Anaconda Python distro that uses MKL 11.3.1. The Python code that is used to call the DSS routines can be found here:
https://github.com/nonhermitian/qutip/blob/mkl_enhancements/qutip/mkl/sp...
Best,
Paul Nation