<?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 Hi Gianluca G,  in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003837#M18773</link>
    <description>&lt;P&gt;Hi Gianluca G,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I happened to review several C# issue, so saw your questions here.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;As the cblas_zgemm and cblas_cgemm ask address of alpha and beta, not value.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;void cblas_zgemm (const CBLAS_LAYOUT Layout, const CBLAS_TRANSPOSE transa, const&lt;BR /&gt;
	CBLAS_TRANSPOSE transb, const MKL_INT m, const MKL_INT n, const MKL_INT k,&lt;STRONG&gt; const void &amp;nbsp;*alpha&lt;/STRONG&gt;, const void *a, const MKL_INT lda, const void *b, const MKL_INT ldb,&lt;STRONG&gt; const void&amp;nbsp;*beta,&lt;/STRONG&gt; void *c, const MKL_INT ldc);&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;So you may change&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;[DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, SetLastError = false)]&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; internal static extern void cblas_zgemm(&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int matrix_layout,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int TransA,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int TransB,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int M,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int N,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int K,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt; ref Complex alpha,&lt;/STRONG&gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [In] Complex[] A,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int lda,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [In] Complex[] B,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int ldb,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;ref Complex beta,&lt;/STRONG&gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [In, Out] Complex[] C,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int ldc&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; );&lt;/P&gt;

&lt;P&gt;MKLWrapper.cblas_zgemm( LAPACK_ROW_MAJOR, &amp;nbsp;CBLAS_NO_TRANS, &amp;nbsp;CBLAS_NO_TRANS, &amp;nbsp;m, &amp;nbsp;n, &amp;nbsp;k,&lt;STRONG&gt; ref alpha&lt;/STRONG&gt;, a, &amp;nbsp;lda, b, &amp;nbsp;ldb, &lt;STRONG&gt;ref bet&lt;/STRONG&gt;a, c, &amp;nbsp;ldc)&lt;/P&gt;

&lt;P&gt;and try it out.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Ying&lt;/P&gt;</description>
    <pubDate>Mon, 26 Oct 2015 02:53:31 GMT</pubDate>
    <dc:creator>Ying_H_Intel</dc:creator>
    <dc:date>2015-10-26T02:53:31Z</dc:date>
    <item>
      <title>C# Multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003831#M18767</link>
      <description>&lt;P&gt;hello,&lt;BR /&gt;
	I am trying the MKL Library, in particular I am finding some problems with the multiplication.&lt;/P&gt;

&lt;P&gt;This is a simple example in C# where a multiply two squared Complex matrix, the result is very strange because the first row have very high values and the second row zero values.&lt;/P&gt;

&lt;P&gt;Some one can help me to understand the issue?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;        public static int LAPACK_ROW_MAJOR = 101;
        public static int LAPACK_COL_MAJOR = 102;

        //TRANSPOSE
        public static int CBLAS_NO_TRANS = 111; 
        public static int CBLAS_TRANS = 112;
        public static int CBLAS_CONJ_TRANS = 113;

        /** CBLAS native cblas_cgemm declaration */
        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, SetLastError = false)]
        internal static extern void cblas_cgemm(
            int matrix_layout, 
            int TransA, 
            int TransB, 
            int M, 
            int N, 
            int K,
            Complex alpha, 
            [In] Complex[] A, 
            int lda, 
            [In] Complex[] B, 
            int ldb,
            Complex beta, 
            [In, Out] Complex[] C, 
            int ldc
        );


        public static void MulTest()
        {
            Complex[] a = { 1, 2, 3, 4 };
            Complex[] b = { 5, 6, 7, 8 };

            int m = 2;
            int n = 2;
            int k = 2;

            Complex[] c = new Complex[m * n];

            Complex alpha = 1;
            Complex beta = 0;

            int lda = k;
            int ldb = n;
            int ldc = n;

            MKLWrapper.cblas_cgemm(LAPACK_ROW_MAJOR, CBLAS_NO_TRANS, CBLAS_NO_TRANS, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc);

        }&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thank You very much&lt;/P&gt;

&lt;P&gt;Gianluca&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2015 15:53:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003831#M18767</guid>
      <dc:creator>Gianluca_G_</dc:creator>
      <dc:date>2015-10-05T15:53:50Z</dc:date>
    </item>
    <item>
      <title>I'm unfamiliar with the C#</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003832#M18768</link>
      <description>&lt;P&gt;I'm unfamiliar with the C# implementation of the Complex data type being used here, but it looks like the intent is to create 2x2 Complex matrices A and B, yet only 4 values are used to initialize each. It should require a real and imaginary component for each element of each matrix. In this case are the imaginary parts of each entry of A and B initialized to 0? If this is the case then sgemm should suffice.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;After calling cgemm I'm not sure how you're reading off the elements of C, or what is meant by "&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px; line-height: 12px;"&gt;very high values" but the "very high values" might correspond to the real components of each entry in C (ie, calling sgemm on real matrices A,B) &amp;nbsp;and the "zeros" might correspond to the imaginary components of each entry of C, which would indeed be zero everywhere if A and B were initialized with imaginary part equal to 0. &lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Could you please include your entire source? It would helpful if I could see specifically how C is being read after cgemm is called, and implementation of the Complex type. &amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 12px;"&gt;Anthony&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 12px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2015 18:23:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003832#M18768</guid>
      <dc:creator>Anthony_H_Intel1</dc:creator>
      <dc:date>2015-10-07T18:23:00Z</dc:date>
    </item>
    <item>
      <title> </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003833#M18769</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;The matrices are both 2x2 . I also tried with more complex matrix, with real and imaginary values different than zero, but I had the same strange results. Then I have created a simple example to submit to you.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;As you understand the inizialization code set only the real part while the imaginary is set to zero.&lt;/P&gt;

&lt;P&gt;The results values in this case correspond only to the real part. The result, with x64 dlls in this example is:&lt;/P&gt;

&lt;P&gt;-148096, 0&lt;BR /&gt;
	-219636, 0&lt;BR /&gt;
	0, 0&lt;BR /&gt;
	0, 0&lt;/P&gt;

&lt;P&gt;While with x86 every value is zero.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I am working with MKL 11.3.1 version and the dlls that &amp;nbsp;I found this in "C:\Program &amp;nbsp;Files &amp;nbsp;(x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\redist\" folder, after that "Intel Paralled Studio" was installed.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;The example I commited is the complete version, as you can see is extremely simple. The result is in c vector.&lt;/P&gt;

&lt;P&gt;Gianluca&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Gianluca&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 07:01:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003833#M18769</guid>
      <dc:creator>Gianluca_G_</dc:creator>
      <dc:date>2015-10-08T07:01:30Z</dc:date>
    </item>
    <item>
      <title>Thank you, in this case the</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003834#M18770</link>
      <description>&lt;P&gt;Thank you, in this case the System.Numerics implementation of Complex takes the form Complex(Double, Double), whereas cgemm takes as input single precision complex types. I was able to reproduce your results and found that replacing the call from cgemm to a call to zgemm gives the expected results. &amp;nbsp;Hope this helps.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 16:22:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003834#M18770</guid>
      <dc:creator>Anthony_H_Intel1</dc:creator>
      <dc:date>2015-10-08T16:22:33Z</dc:date>
    </item>
    <item>
      <title>Thank you very much </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003835#M18771</link>
      <description>&lt;P&gt;Thank you very much&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2015 16:34:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003835#M18771</guid>
      <dc:creator>Gianluca_G_</dc:creator>
      <dc:date>2015-10-08T16:34:11Z</dc:date>
    </item>
    <item>
      <title> </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003836#M18772</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I'm sorry to say that it works partially, because with x64 platform is ok, but with x86 returns all zero values. Any idea?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Oct 2015 08:41:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003836#M18772</guid>
      <dc:creator>Gianluca_G_</dc:creator>
      <dc:date>2015-10-09T08:41:51Z</dc:date>
    </item>
    <item>
      <title>Hi Gianluca G, </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003837#M18773</link>
      <description>&lt;P&gt;Hi Gianluca G,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I happened to review several C# issue, so saw your questions here.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 13.008px; line-height: 19.512px;"&gt;As the cblas_zgemm and cblas_cgemm ask address of alpha and beta, not value.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;void cblas_zgemm (const CBLAS_LAYOUT Layout, const CBLAS_TRANSPOSE transa, const&lt;BR /&gt;
	CBLAS_TRANSPOSE transb, const MKL_INT m, const MKL_INT n, const MKL_INT k,&lt;STRONG&gt; const void &amp;nbsp;*alpha&lt;/STRONG&gt;, const void *a, const MKL_INT lda, const void *b, const MKL_INT ldb,&lt;STRONG&gt; const void&amp;nbsp;*beta,&lt;/STRONG&gt; void *c, const MKL_INT ldc);&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;So you may change&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;[DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, SetLastError = false)]&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; internal static extern void cblas_zgemm(&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int matrix_layout,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int TransA,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int TransB,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int M,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int N,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int K,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt; ref Complex alpha,&lt;/STRONG&gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [In] Complex[] A,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int lda,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [In] Complex[] B,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int ldb,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;ref Complex beta,&lt;/STRONG&gt;&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [In, Out] Complex[] C,&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int ldc&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; );&lt;/P&gt;

&lt;P&gt;MKLWrapper.cblas_zgemm( LAPACK_ROW_MAJOR, &amp;nbsp;CBLAS_NO_TRANS, &amp;nbsp;CBLAS_NO_TRANS, &amp;nbsp;m, &amp;nbsp;n, &amp;nbsp;k,&lt;STRONG&gt; ref alpha&lt;/STRONG&gt;, a, &amp;nbsp;lda, b, &amp;nbsp;ldb, &lt;STRONG&gt;ref bet&lt;/STRONG&gt;a, c, &amp;nbsp;ldc)&lt;/P&gt;

&lt;P&gt;and try it out.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Ying&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2015 02:53:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003837#M18773</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2015-10-26T02:53:31Z</dc:date>
    </item>
    <item>
      <title>Hi Gianluca, </title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003838#M18774</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;Gianluca,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;It should be able to solve the problem of &amp;nbsp;x86 returns all zero values.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 12px; line-height: 18px;"&gt;Ying&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2015 08:39:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/C-Multiplication/m-p/1003838#M18774</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2015-10-29T08:39:47Z</dc:date>
    </item>
  </channel>
</rss>

