<?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 cblas usage question in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779232#M1310</link>
    <description>The matrix arguments must be rectangular arrays; &lt;SPAN style="text-decoration: underline;"&gt;there is no provision for passing triangular arrays&lt;/SPAN&gt;, as you can see from the documentation for ?symm. &lt;BR /&gt;&lt;BR /&gt;However, &lt;SPAN style="text-decoration: underline;"&gt;it is sufficient to fill in, i.e., define, only the upper triangle&lt;/SPAN&gt;(s) of the input matrix(matrices) when you specify 'U' for &lt;B&gt;uplo&lt;/B&gt;. To see this, replace&lt;BR /&gt;&lt;BR /&gt; double a[] = {1,2,6,2,3,1,6,1,4};&lt;BR /&gt;&lt;BR /&gt;by&lt;BR /&gt;&lt;BR /&gt; double a[] = {1,2,6,0,3,1,0,0,4};&lt;BR /&gt;&lt;BR /&gt;and you should see no change in the output. In fact, replacing the '0' values in this line by any other values should not affect the output, either.&lt;BR /&gt;</description>
    <pubDate>Fri, 09 Dec 2011 11:58:24 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2011-12-09T11:58:24Z</dc:date>
    <item>
      <title>cblas usage question</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779229#M1307</link>
      <description>Dear all,&lt;BR /&gt;&lt;BR /&gt;I would like to multiply&lt;BR /&gt;&lt;BR /&gt;A = [ 1 2 6 &lt;BR /&gt;  2 3 1&lt;BR /&gt; 6 1 4 ]&lt;BR /&gt;a symmetrix matrix with a dense matrix&lt;BR /&gt;B =[ 2 3&lt;BR /&gt; 4 5&lt;BR /&gt; 6 7 ];&lt;BR /&gt;&lt;BR /&gt;and here is the code, but the results are wrong, what could be the problem?&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; double a[] = {1,2,6,3,1,4};&lt;BR /&gt; double b[] = {2,3,4,5,6,7};&lt;BR /&gt; double c[] = {0,0,0,0,0,0};&lt;BR /&gt; MKL_INT r = 3;&lt;BR /&gt; MKL_INT cc= 3;&lt;BR /&gt; MKL_INT k = 2;&lt;BR /&gt; double alpha = 1.0;&lt;BR /&gt; double beta = 0.0;&lt;BR /&gt; //&lt;BR /&gt; CBLAS_ORDER ord = CblasRowMajor;&lt;BR /&gt; CBLAS_SIDE side = CblasLeft;&lt;BR /&gt; CBLAS_UPLO uplo = CblasUpper;&lt;BR /&gt; cblas_dsymm( ord, side, uplo,&lt;BR /&gt; r, cc, alpha,&lt;BR /&gt; a, r, b, r,&lt;BR /&gt; beta, c, cc );&lt;BR /&gt; //&lt;BR /&gt; for(int z=0;z&amp;lt;6;z++)&lt;BR /&gt; std::cout &amp;lt;&amp;lt; c&lt;Z&gt; &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Umut&lt;BR /&gt;&lt;/Z&gt;</description>
      <pubDate>Thu, 08 Dec 2011 17:26:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779229#M1307</guid>
      <dc:creator>utab</dc:creator>
      <dc:date>2011-12-08T17:26:04Z</dc:date>
    </item>
    <item>
      <title>cblas usage question</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779230#M1308</link>
      <description>&lt;P&gt;Umut,&lt;/P&gt;&lt;P&gt;could you have a check on the code bellow? The parameters do not look correct. The output for the following code is: 46 55 22 28 40 51&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Chao&lt;/P&gt;&lt;P&gt;int main()&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;//double a[] = {1,2,6,3,1,4};&lt;BR /&gt;double a[] = {1,2,6,&lt;BR /&gt; 2,3,1,&lt;BR /&gt; 6,1,4};&lt;/P&gt;&lt;P&gt;double b[] = {2,3,4,5,6,7};&lt;BR /&gt;double c[] = {0,0,0,0,0,0};&lt;/P&gt;&lt;P&gt;MKL_INT r = 3;&lt;BR /&gt;//MKL_INT cc= 3;&lt;BR /&gt;MKL_INT cc= 2;&lt;BR /&gt;//MKL_INT k = 2;&lt;/P&gt;&lt;P&gt;double alpha = 1.0;&lt;BR /&gt;double beta = 0.0;&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;CBLAS_ORDER ord = CblasRowMajor;&lt;BR /&gt;CBLAS_SIDE side = CblasLeft;&lt;BR /&gt;CBLAS_UPLO uplo = CblasUpper;&lt;/P&gt;&lt;P&gt;/*cblas_dsymm( ord, side, uplo,&lt;BR /&gt; r, cc, alpha,&lt;BR /&gt; a, r, b, r,beta, c, cc );*/&lt;/P&gt;&lt;P&gt;cblas_dsymm( ord, side, uplo,&lt;BR /&gt; r, cc, alpha,&lt;BR /&gt; a, r, b, cc,beta, c, cc );&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;for(int z=0;z&amp;lt;6;z++)&lt;BR /&gt; std::cout &amp;lt;&amp;lt; c&lt;Z&gt; &amp;lt;&amp;lt; std::endl;&lt;/Z&gt;&lt;/P&gt;&lt;P&gt;return 0;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2011 09:15:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779230#M1308</guid>
      <dc:creator>Chao_Y_Intel</dc:creator>
      <dc:date>2011-12-09T09:15:53Z</dc:date>
    </item>
    <item>
      <title>cblas usage question</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779231#M1309</link>
      <description>Dear Chao, &lt;BR /&gt;&lt;BR /&gt;Thanks for the reply. The documentation is a bit confusing how the matrix is input was not clear to me. I mean understood to only input the upper triangular part of the A and then I was thinking it is ok, however it gets the whole matrix and internally does the operations I guess, &lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;Umut</description>
      <pubDate>Fri, 09 Dec 2011 09:50:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779231#M1309</guid>
      <dc:creator>utab</dc:creator>
      <dc:date>2011-12-09T09:50:53Z</dc:date>
    </item>
    <item>
      <title>cblas usage question</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779232#M1310</link>
      <description>The matrix arguments must be rectangular arrays; &lt;SPAN style="text-decoration: underline;"&gt;there is no provision for passing triangular arrays&lt;/SPAN&gt;, as you can see from the documentation for ?symm. &lt;BR /&gt;&lt;BR /&gt;However, &lt;SPAN style="text-decoration: underline;"&gt;it is sufficient to fill in, i.e., define, only the upper triangle&lt;/SPAN&gt;(s) of the input matrix(matrices) when you specify 'U' for &lt;B&gt;uplo&lt;/B&gt;. To see this, replace&lt;BR /&gt;&lt;BR /&gt; double a[] = {1,2,6,2,3,1,6,1,4};&lt;BR /&gt;&lt;BR /&gt;by&lt;BR /&gt;&lt;BR /&gt; double a[] = {1,2,6,0,3,1,0,0,4};&lt;BR /&gt;&lt;BR /&gt;and you should see no change in the output. In fact, replacing the '0' values in this line by any other values should not affect the output, either.&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Dec 2011 11:58:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779232#M1310</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2011-12-09T11:58:24Z</dc:date>
    </item>
    <item>
      <title>cblas usage question</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779233#M1311</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;yes, it is right that the input A needs to rectangular arrays. but the low triangle in the matrix does not impact the computation. &lt;/P&gt;&lt;P&gt;thanks,&lt;BR /&gt;Chao&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2011 02:41:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779233#M1311</guid>
      <dc:creator>Chao_Y_Intel</dc:creator>
      <dc:date>2011-12-14T02:41:46Z</dc:date>
    </item>
    <item>
      <title>cblas usage question</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779234#M1312</link>
      <description>Hello Umut,&lt;BR /&gt;&lt;BR /&gt;As meje and Chao mentioned, we need to allocate memory large enough to store a 3x3 matrix for symmetric A matrix. However, you only need to set lower or upper triangular elements of Adepending on the uplo symm parameter. &lt;BR /&gt;&lt;BR /&gt;In your example code the input paramaters to cblas_dsymm are in error. For symm, m and n are number of rows and number of columns for C matrix respectively. Also, the leading dimensions for A and B matrices should be set considering that we are using the row-major ordering. Please find the code with the required modifications below. Comments describe the paramaters. &lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[cpp]#include &lt;IOSTREAM&gt;
#include &lt;MKL.H&gt;
using namespace std;

int main()
{
    /* 3x3 A matrix (symmetric) */
    double a[] = {1,2,6,2,3,1,6,1,4};
    /* 3x2 B Matrix */
    double b[] = {2,3,4,5,6,7};
    /* 3x2 C Matrix */
    double c[] = {0,0,0,0,0,0};

    /* Let's define the SYMM paramaters in terms
     * of row count and coloumn count of C */
    MKL_INT rows_c = 3;
    MKL_INT cols_c= 2;

    double alpha = 1.0;
    double beta  = 0.0;

    CBLAS_ORDER ord  = CblasRowMajor;
    CBLAS_SIDE  side = CblasLeft;
    CBLAS_UPLO  uplo = CblasUpper;

    /* The leading dimension for A, B and C are set considering
     * row-major format.
     *
     * For this particular example:
     * lda = # of columns A (or rows since A is symmetric)
     * ldb = # of columns B
     * ldc = # of columns C */
    cblas_dsymm( ord, side, uplo,
            rows_c, cols_c, alpha,
            a, rows_c, b, cols_c,
            beta, c, cols_c );

    /* This should print 46 55 22 28 40 51 */
    for(int z=0;z&amp;lt;6;z++)
        std::cout &amp;lt;&amp;lt; c&lt;Z&gt; &amp;lt;&amp;lt; std::endl;

    return 0;
}
[/cpp]&lt;/Z&gt;&lt;/MKL.H&gt;&lt;/IOSTREAM&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;The output is:&lt;BR /&gt;&lt;BR /&gt;46 55 22 28 40 51&lt;BR /&gt;&lt;BR /&gt;Best wishes,&lt;BR /&gt;Efe</description>
      <pubDate>Wed, 14 Dec 2011 03:25:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cblas-usage-question/m-p/779234#M1312</guid>
      <dc:creator>Murat_G_Intel</dc:creator>
      <dc:date>2011-12-14T03:25:15Z</dc:date>
    </item>
  </channel>
</rss>

