<?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 I have a problem with MKL, results are wrong, why? in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-have-a-problem-with-MKL-results-are-wrong-why/m-p/816742#M4339</link>
    <description>alper,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;the causeof the problem you're experiencing is that this function ( dgemm ) uses ( expects) fortran notation but you are using C-notation.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Please usecblas_dgemm(....)instead of dgemm.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Rewrite your test, for example, like this:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;double a[2][4];&lt;/P&gt;&lt;P&gt;double b[4][3];&lt;/P&gt;

&lt;P&gt;double c[2][3];&lt;/P&gt;

&lt;P&gt;int lda=4; &lt;/P&gt;

&lt;P&gt;int ldb=3; &lt;/P&gt;

&lt;P&gt;int ldc=3; &lt;/P&gt;

&lt;P&gt;cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n,
k,alpha,(double*)a,lda,(double*)b,ldb,&lt;/P&gt;

&lt;P&gt;
beta,(double*)c,ldc);&lt;/P&gt;&lt;P&gt;and try the test again.&lt;/P&gt;&lt;P&gt;For example, with your data I have:&lt;/P&gt;&lt;DIV id="_mcePaste"&gt;a matrisi&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;1.20  1.20  1.20  1.20&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;1.20  2.20  3.20  4.20&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;b mmatrisi&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;0.50  0.50  0.50&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;0.50  1.50  2.50&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;0.50  2.50  4.50&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;0.50  3.50  6.50&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;a*b matrisi&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;2.400000    9.600000    16.800000&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;5.400000    26.600000    47.800000&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;Press any key to continue . . .&lt;/DIV&gt;a matrisi1.20  1.20  1.20  1.20&lt;BR /&gt;1.20  2.20  3.20  4.20&lt;BR /&gt;b mmatrisi0.50  0.50  0.50&lt;BR /&gt;0.50  1.50  2.50&lt;BR /&gt;0.50  2.50  4.50&lt;BR /&gt;0.50  3.50  6.50&lt;BR /&gt;a*b matrisi&lt;/DIV&gt;&lt;DIV&gt;2.400000    9.600000    16.800000&lt;/DIV&gt;&lt;DIV&gt;5.400000    26.600000    47.800000&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Press any key to continue . . .&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I hope it will help.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;--Gennady&lt;/DIV&gt;</description>
    <pubDate>Wed, 19 May 2010 15:44:15 GMT</pubDate>
    <dc:creator>Gennady_F_Intel</dc:creator>
    <dc:date>2010-05-19T15:44:15Z</dc:date>
    <item>
      <title>I have a problem with MKL, results are wrong, why?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-have-a-problem-with-MKL-results-are-wrong-why/m-p/816741#M4338</link>
      <description>Hi everybody,&lt;BR /&gt;&lt;BR /&gt;I am new on MKL. I try to make matrix product, but results are wrong, i can not solve the problem. Would you kindly help me, I will be pleased.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;Source Code #1:&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;//transa and transb are "n"&lt;/P&gt;&lt;P&gt;#include &lt;MKL.H&gt;&lt;/MKL.H&gt;&lt;/P&gt;&lt;P&gt;#include &lt;STDIO.H&gt;&lt;/STDIO.H&gt;&lt;/P&gt;&lt;P&gt;#include &lt;CONIO.H&gt;&lt;/CONIO.H&gt;&lt;/P&gt;&lt;P&gt;void main()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;char* trans="n"; &lt;/P&gt;&lt;P&gt;double alpha=1.0;&lt;/P&gt;&lt;P&gt;double beta=0.0;&lt;/P&gt;&lt;P&gt;int lda=2;&lt;/P&gt;&lt;P&gt;int ldb=4;&lt;/P&gt;&lt;P&gt;int ldc=2;&lt;/P&gt;&lt;P&gt;int m=2;&lt;/P&gt;&lt;P&gt;int n=3;&lt;/P&gt;&lt;P&gt;int k=4;&lt;/P&gt;&lt;P&gt;int i,j;&lt;/P&gt;&lt;P&gt;double a[2][4];&lt;/P&gt;&lt;P&gt;double b[4][3];&lt;/P&gt;&lt;P&gt;double c[2][3];&lt;/P&gt;&lt;P&gt;printf("a matrisi\\n");&lt;/P&gt;&lt;P&gt;for(i=0;i&lt;M&gt;&lt;/M&gt;&lt;/P&gt;&lt;P&gt;for(j=0;j&lt;K&gt;&lt;/K&gt;&lt;/P&gt;&lt;P&gt;a&lt;I&gt;&lt;J&gt;=i*j+1.2;&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;printf("%.02f\\t",a&lt;I&gt;&lt;J&gt;);&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;printf("\\n\\n");&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;printf("b mmatrisi\\n");&lt;/P&gt;&lt;P&gt;for(i=0;i&lt;K&gt;&lt;/K&gt;&lt;/P&gt;&lt;P&gt;for(j=0;j&lt;N&gt;&lt;/N&gt;&lt;/P&gt;&lt;P&gt;b&lt;I&gt;&lt;J&gt;=i*j+0.5;&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;printf("%.02f\\t",b&lt;I&gt;&lt;J&gt;);&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;printf("\\n\\n");&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;dgemm(trans,trans,&amp;amp;m,&amp;amp;n,&amp;amp;k,α,(double*)a,&amp;amp;lda,(double*)b,&amp;amp;ldb,β,(double*)c,&amp;amp;ldc);&lt;/P&gt;&lt;P&gt;printf("a*b matrisi\\n");&lt;/P&gt;&lt;P&gt;for(i=0;i&lt;M&gt;&lt;/M&gt;&lt;/P&gt;&lt;P&gt;for(j=0;j&lt;N&gt;&lt;/N&gt;&lt;/P&gt;&lt;P&gt;printf("%f\\t",c&lt;I&gt;&lt;J&gt;);&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;printf("\\n");&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;getch();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;----------------&lt;BR /&gt;&lt;BR /&gt;Source Code #2:&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;//transa and transb are "t"&lt;/P&gt;&lt;P&gt;#include &lt;MKL.H&gt;&lt;/MKL.H&gt;&lt;/P&gt;&lt;P&gt;#include &lt;STDIO.H&gt;&lt;/STDIO.H&gt;&lt;/P&gt;&lt;P&gt;#include &lt;CONIO.H&gt;&lt;/CONIO.H&gt;&lt;/P&gt;&lt;P&gt;void main()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;char* trans="t"; &lt;/P&gt;&lt;P&gt;double alpha=1.0;&lt;/P&gt;&lt;P&gt;double beta=0.0;&lt;/P&gt;&lt;P&gt;int lda=4;&lt;/P&gt;&lt;P&gt;int ldb=3;&lt;/P&gt;&lt;P&gt;int ldc=2;&lt;/P&gt;&lt;P&gt;int m=2;&lt;/P&gt;&lt;P&gt;int n=3;&lt;/P&gt;&lt;P&gt;int k=4;&lt;/P&gt;&lt;P&gt;int i,j;&lt;/P&gt;&lt;P&gt;double a[2][4];&lt;/P&gt;&lt;P&gt;double b[4][3];&lt;/P&gt;&lt;P&gt;double c[2][3];&lt;/P&gt;&lt;P&gt;printf("a matrisi\\n");&lt;/P&gt;&lt;P&gt;for(i=0;i&lt;M&gt;&lt;/M&gt;&lt;/P&gt;&lt;P&gt;for(j=0;j&lt;K&gt;&lt;/K&gt;&lt;/P&gt;&lt;P&gt;a&lt;I&gt;&lt;J&gt;=i*j+1.2;&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;printf("%.02f\\t",a&lt;I&gt;&lt;J&gt;);&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;printf("\\n\\n");&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;printf("b mmatrisi\\n");&lt;/P&gt;&lt;P&gt;for(i=0;i&lt;K&gt;&lt;/K&gt;&lt;/P&gt;&lt;P&gt;for(j=0;j&lt;N&gt;&lt;/N&gt;&lt;/P&gt;&lt;P&gt;b&lt;I&gt;&lt;J&gt;=i*j+0.5;&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;printf("%.02f\\t",b&lt;I&gt;&lt;J&gt;);&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;printf("\\n\\n");&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;dgemm(trans,trans,&amp;amp;m,&amp;amp;n,&amp;amp;k,α,(double*)a,&amp;amp;lda,(double*)b,&amp;amp;ldb,β,(double*)c,&amp;amp;ldc);&lt;/P&gt;&lt;P&gt;printf("a*b matrisi\\n");&lt;/P&gt;&lt;P&gt;for(i=0;i&lt;M&gt;&lt;/M&gt;&lt;/P&gt;&lt;P&gt;for(j=0;j&lt;N&gt;&lt;/N&gt;&lt;/P&gt;&lt;P&gt;printf("%f\\t",c&lt;I&gt;&lt;J&gt;);&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;printf("\\n");&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;getch();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;---------------&lt;BR /&gt;&lt;BR /&gt;and respected result is below&lt;BR /&gt;&lt;BR /&gt;2.4  9.6 16.8&lt;BR /&gt;5.4 26.6 47.8&lt;BR /&gt;&lt;BR /&gt;but i can notcalculate this result. Please run my source codes and then give your results, i think there is something wrong with my codes, but i can not find.&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;</description>
      <pubDate>Tue, 18 May 2010 20:14:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-have-a-problem-with-MKL-results-are-wrong-why/m-p/816741#M4338</guid>
      <dc:creator>Alper_Basturk</dc:creator>
      <dc:date>2010-05-18T20:14:42Z</dc:date>
    </item>
    <item>
      <title>I have a problem with MKL, results are wrong, why?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-have-a-problem-with-MKL-results-are-wrong-why/m-p/816742#M4339</link>
      <description>alper,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;the causeof the problem you're experiencing is that this function ( dgemm ) uses ( expects) fortran notation but you are using C-notation.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Please usecblas_dgemm(....)instead of dgemm.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Rewrite your test, for example, like this:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;double a[2][4];&lt;/P&gt;&lt;P&gt;double b[4][3];&lt;/P&gt;

&lt;P&gt;double c[2][3];&lt;/P&gt;

&lt;P&gt;int lda=4; &lt;/P&gt;

&lt;P&gt;int ldb=3; &lt;/P&gt;

&lt;P&gt;int ldc=3; &lt;/P&gt;

&lt;P&gt;cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n,
k,alpha,(double*)a,lda,(double*)b,ldb,&lt;/P&gt;

&lt;P&gt;
beta,(double*)c,ldc);&lt;/P&gt;&lt;P&gt;and try the test again.&lt;/P&gt;&lt;P&gt;For example, with your data I have:&lt;/P&gt;&lt;DIV id="_mcePaste"&gt;a matrisi&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;1.20  1.20  1.20  1.20&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;1.20  2.20  3.20  4.20&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;b mmatrisi&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;0.50  0.50  0.50&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;0.50  1.50  2.50&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;0.50  2.50  4.50&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;0.50  3.50  6.50&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;a*b matrisi&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;2.400000    9.600000    16.800000&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;5.400000    26.600000    47.800000&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;Press any key to continue . . .&lt;/DIV&gt;a matrisi1.20  1.20  1.20  1.20&lt;BR /&gt;1.20  2.20  3.20  4.20&lt;BR /&gt;b mmatrisi0.50  0.50  0.50&lt;BR /&gt;0.50  1.50  2.50&lt;BR /&gt;0.50  2.50  4.50&lt;BR /&gt;0.50  3.50  6.50&lt;BR /&gt;a*b matrisi&lt;/DIV&gt;&lt;DIV&gt;2.400000    9.600000    16.800000&lt;/DIV&gt;&lt;DIV&gt;5.400000    26.600000    47.800000&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Press any key to continue . . .&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I hope it will help.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;--Gennady&lt;/DIV&gt;</description>
      <pubDate>Wed, 19 May 2010 15:44:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-have-a-problem-with-MKL-results-are-wrong-why/m-p/816742#M4339</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2010-05-19T15:44:15Z</dc:date>
    </item>
    <item>
      <title>I have a problem with MKL, results are wrong, why?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-have-a-problem-with-MKL-results-are-wrong-why/m-p/816743#M4340</link>
      <description>Thanks for your kindly interest.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Alper Basturk</description>
      <pubDate>Thu, 20 May 2010 12:38:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-have-a-problem-with-MKL-results-are-wrong-why/m-p/816743#M4340</guid>
      <dc:creator>Alper_Basturk</dc:creator>
      <dc:date>2010-05-20T12:38:48Z</dc:date>
    </item>
    <item>
      <title>I have a problem with MKL, results are wrong, why?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-have-a-problem-with-MKL-results-are-wrong-why/m-p/816744#M4341</link>
      <description>excelent, I had the same problem but you saved me.&lt;BR /&gt;Petr</description>
      <pubDate>Thu, 20 May 2010 18:55:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/I-have-a-problem-with-MKL-results-are-wrong-why/m-p/816744#M4341</guid>
      <dc:creator>petr_gamov</dc:creator>
      <dc:date>2010-05-20T18:55:07Z</dc:date>
    </item>
  </channel>
</rss>

