<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Many thanks for taking a look in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092674#M23337</link>
    <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Many thanks for taking a look at this. &amp;nbsp;I guess there is some issue with my call somewhere. &amp;nbsp;One question though, &amp;nbsp;why can you use&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;MKL_DSS_NON_SYMMETRIC rather than&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;MKL_DSS_NON_SYMMETRIC_COMPLEX in the call to define_structure? &amp;nbsp;Isn't that for real problems only?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Best,&lt;/P&gt;

&lt;P&gt;Paul&lt;/P&gt;</description>
    <pubDate>Mon, 18 Apr 2016 02:35:02 GMT</pubDate>
    <dc:creator>Paul_N_2</dc:creator>
    <dc:date>2016-04-18T02:35:02Z</dc:date>
    <item>
      <title>Every other call to dss_solve_complex gives incorrect answer</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092672#M23335</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;I am trying to call the DSS solver in MKL from the Intel Python distribution 2017 beta via the ctypes library. &amp;nbsp;I have everything working properly except for repeated calls to dss_solve_complex. &amp;nbsp;The first, third, fifth, ... calls yields the correct solution, yet the second, forth,... and so on give the wrong answer. &amp;nbsp;Moreoever, the output is not the same for repeated runs. &amp;nbsp;In addition, the solver returns success as the output even though the answer is incorrect. &amp;nbsp;This same issue does not occur when calling dss_solve_real. &amp;nbsp;A minimal example that can be used in both the real and complex solvers is below:&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;A&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;===&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;[[ 1 &amp;nbsp;0 &amp;nbsp;2]&lt;/SPAN&gt;&lt;BR style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;" /&gt;
	&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;&amp;nbsp;[ 0 &amp;nbsp;0 &amp;nbsp;3]&lt;/SPAN&gt;&lt;BR style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;" /&gt;
	&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;&amp;nbsp;[-4 &amp;nbsp;5 &amp;nbsp;6]]&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;b&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;===&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;[0 &amp;nbsp;2 &amp;nbsp;0]&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;The correct solution should be:&amp;nbsp;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;[-1.33333333 &amp;nbsp;-1.86666667 &amp;nbsp;0.66666667]&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Trying to repeatedly solve five times yields, for example:&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;[-1.33333333+0.j -1.86666667+0.j &amp;nbsp;0.66666667+0.j]&lt;/SPAN&gt;&lt;BR style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;" /&gt;
	&lt;BR style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;" /&gt;
	&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;[ &amp;nbsp;3.13043594e-04 +3.08799744e-03j &amp;nbsp;&amp;nbsp;1.50203705e-05 +1.60000000e+01j&lt;/SPAN&gt;&lt;BR style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;" /&gt;
	&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;1.60000000e+01 +1.00000000e+00j]&lt;/SPAN&gt;&lt;BR style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;" /&gt;
	&lt;BR style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;" /&gt;
	&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;[-1.33333333+0.j -1.86666667+0.j &amp;nbsp;0.66666667+0.j]&lt;/SPAN&gt;&lt;BR style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;" /&gt;
	&lt;BR style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;" /&gt;
	&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;[ &amp;nbsp;3.13043594e-04 +3.08799744e-03j &amp;nbsp;&amp;nbsp;1.19209290e-05 +1.60000000e+01j&lt;/SPAN&gt;&lt;BR style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;" /&gt;
	&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;1.60000000e+01 +1.00000000e+00j]&lt;/SPAN&gt;&lt;BR style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;" /&gt;
	&lt;BR style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;" /&gt;
	&lt;SPAN style="color: rgb(0, 0, 0); font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 12px;"&gt;[-1.33333333+0.j -1.86666667+0.j &amp;nbsp;0.66666667+0.j]&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT color="#000000" face="Menlo, Monaco, Courier New, monospace"&gt;&lt;SPAN style="font-size: 12px;"&gt;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. &amp;nbsp;The Python code that is used to call the DSS routines can be found here:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://github.com/nonhermitian/qutip/blob/mkl_enhancements/qutip/mkl/spsolve.py" target="_blank"&gt;https://github.com/nonhermitian/qutip/blob/mkl_enhancements/qutip/mkl/spsolve.py&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Best,&lt;/P&gt;

&lt;P&gt;Paul Nation&lt;/P&gt;</description>
      <pubDate>Sun, 17 Apr 2016 03:55:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092672#M23335</guid>
      <dc:creator>Paul_N_2</dc:creator>
      <dc:date>2016-04-17T03:55:34Z</dc:date>
    </item>
    <item>
      <title>Such incorrect results can</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092673#M23336</link>
      <description>&lt;P&gt;Such incorrect results can originate in (i) bugs in user code (ii) bugs in non-native language interface code (iii) bugs in the MKL library routines. I am not a Python user, nor am I up to looking at nearly 400 lines of Python code to find any errors.&lt;/P&gt;

&lt;P&gt;However, a short Fortran program modeled after the example code provided with MKL enables me to discount (iii). The program works on your test matrix, repeating seven cycles of three different sets of right hand side vectors. The r.h.s. vectors for irep = 1, 4, 7, ..., 19 are the same as the one that you specified.&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;! ifort /Qmkl /nostand /warn:none dss_cmplx.f90
PROGRAM dss_test
   USE mkl_dss
   IMPLICIT NONE
   INTEGER, PARAMETER :: nrows = 3, ncols = 3, nnonzeros = 7, nrhs = 1
   INTEGER :: rowindex(nrows+1) = [ 1, 3, 5, 8 ]
   INTEGER :: columns(nnonzeros) = [ 1, 3, 2, 3, 1, 2, 3 ]
   DOUBLE COMPLEX :: values(nnonzeros) = [ (1.,0.), (2.,0.), (0.,0.), &amp;amp;
     (3.,0.), (-4.,0.), (5.,0.), (6.,0.) ], rhs0(nrows) = [ (0.,0.), (2., &amp;amp;
     0.), (0.,0.) ], rhs(nrows)
   DOUBLE COMPLEX solution(nrows)
   INTEGER *8 handle
   INTEGER i, error, buf, idum(1), irep

   error = dss_create(handle, mkl_dss_defaults)
   IF (error/=mkl_dss_success) GO TO 100

   error = dss_define_structure(handle, mkl_dss_non_symmetric, rowindex, &amp;amp;
     nrows, ncols, columns, nnonzeros)
   IF (error/=mkl_dss_success) GO TO 100
   error = dss_reorder(handle, mkl_dss_defaults, idum)
   IF (error/=mkl_dss_success) GO TO 100
   error = dss_factor_complex(handle, mkl_dss_indefinite, values)
   IF (error/=mkl_dss_success) GO TO 100
   DO irep = 1, 21
      rhs(1:3) = rhs0(1:3) + mod(irep-1, 3)* [ (0.3,0.0), (0.2,0.0),     &amp;amp;
        (-0.2, 0.) ]
      error = dss_solve_complex(handle, mkl_dss_defaults, rhs, nrhs,     &amp;amp;
        solution)
      IF (error/=mkl_dss_success) GO TO 100
      IF (mod(irep,3)==1) WRITE (*, *)
      WRITE (*, '(i2,3(2x,(F8.4,F8.4)))') irep, (solution(i), i=1, ncols)
   END DO
   error = dss_delete(handle, mkl_dss_defaults)
   IF (error/=mkl_dss_success) GO TO 100
   STOP
   100 WRITE (*, *) 'DSS error code ', error
   STOP 1
END PROGRAM dss_test&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 02:18:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092673#M23336</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2016-04-18T02:18:00Z</dc:date>
    </item>
    <item>
      <title>Many thanks for taking a look</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092674#M23337</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Many thanks for taking a look at this. &amp;nbsp;I guess there is some issue with my call somewhere. &amp;nbsp;One question though, &amp;nbsp;why can you use&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;MKL_DSS_NON_SYMMETRIC rather than&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;MKL_DSS_NON_SYMMETRIC_COMPLEX in the call to define_structure? &amp;nbsp;Isn't that for real problems only?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Best,&lt;/P&gt;

&lt;P&gt;Paul&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 02:35:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092674#M23337</guid>
      <dc:creator>Paul_N_2</dc:creator>
      <dc:date>2016-04-18T02:35:02Z</dc:date>
    </item>
    <item>
      <title>Ok, I found the error.  It</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092675#M23338</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;Ok, I found the error. &amp;nbsp;It turns out that asking for the statistics after each call to solve was some how messing up the next call. &amp;nbsp;Now everything works great! &amp;nbsp;Thanks again for taking a look at this. &amp;nbsp;It helped a lot.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Best,&lt;/P&gt;

&lt;P&gt;Paul&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 03:25:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092675#M23338</guid>
      <dc:creator>Paul_N_2</dc:creator>
      <dc:date>2016-04-18T03:25:19Z</dc:date>
    </item>
    <item>
      <title>Good question!</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092676#M23339</link>
      <description>&lt;P&gt;Good question!&lt;/P&gt;

&lt;P&gt;I was not aware that definitions with _COMPLEX at the end had been added! DSS has been in existence for over 15 years, and I had adapted code that came with Compaq/Digital Fortran (circa 2000). In the CVF manual there is no mention of&amp;nbsp;MKL_DSS_SYMMETRIC_STRUCTURE_COMPLEX.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Since the DSS in MKL is just a wrapper around Pardiso, I find it unsurprising that my error (writing&amp;nbsp;MKL_DSS_SYMMETRIC_STRUCTURE instead) did not cause problems. Pardiso uses the CSR representation of sparse matrices, and the matrix is described in terms of indices rather than C-pointers. Therefore, the size of each matrix element should have no effect on the CSR data.&lt;/P&gt;

&lt;P&gt;We may hope that one of the Intel-MKL personnel will clarify this point.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 03:29:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092676#M23339</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2016-04-18T03:29:13Z</dc:date>
    </item>
    <item>
      <title>Quote:Paul N. wrote:</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092677#M23340</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Paul N. wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;It turns out that asking for the statistics after each call to solve was some how messing up the next call. &amp;nbsp;Now everything works great!&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;That's actually bad news, because of the implication that the bug can go into hiding as a result of removing the statistics inquiry calls. It may be worth finding out if the same thing happens with the Fortran code.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 03:32:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Every-other-call-to-dss-solve-complex-gives-incorrect-answer/m-p/1092677#M23340</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2016-04-18T03:32:50Z</dc:date>
    </item>
  </channel>
</rss>

