<?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 sparse matrix dense matrix multiplication question in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/sparse-matrix-dense-matrix-multiplication-question/m-p/786751#M1894</link>
    <description>Dear all,&lt;BR /&gt;&lt;BR /&gt;I am trying to do a sparse matrix - dense matrix multiplication operation, however the below code does not give me what I want, &lt;BR /&gt;I use the sparse matrix that is used in the intel manual and examples and a dense matrix of&lt;BR /&gt;1 5 &lt;BR /&gt;1 4 &lt;BR /&gt;1 3 &lt;BR /&gt;1 2&lt;BR /&gt;1 1&lt;BR /&gt;I guess my representation is correct in the code, however there is still sth wrong since I can not find the right answer. Could you please help me?&lt;BR /&gt;&lt;BR /&gt;Best regards, &lt;BR /&gt;Umut &lt;BR /&gt;&lt;BR /&gt;My code&lt;BR /&gt;&lt;BR /&gt;#include &lt;IOSTREAM&gt;&lt;BR /&gt;&lt;BR /&gt;#include "mkl_types.h"&lt;BR /&gt;#include "mkl_spblas.h"&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; MKL_INT M = 5;&lt;BR /&gt; double values[] = {1.0, -1.0, -3.0, -2.0, 5.0, 4.0, 6.0, 4.0, -4.0, 2.0, 7.0, 8.0, -5.0}; &lt;BR /&gt; MKL_INT columns[] = {0, 1, 3, 0, 1, 2, 3, 4, 0, 2, 3, 1, 4}; &lt;BR /&gt; MKL_INT rowIndex[] = {0, 3, 5, 8, 11, 13};&lt;BR /&gt; MKL_INT pntrb[] = {0, 3, 5, 8, 11};&lt;BR /&gt; MKL_INT pntre[] = {3, 5, 8, 11, 13;&lt;BR /&gt; MKL_INT N = 2; &lt;BR /&gt; double b[] = {1.0, 5.0, 1.0, 4.0, 1.0, 3.0, 1.0, 2.0, 1.0,1.0};&lt;BR /&gt; double c[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,0.0};&lt;BR /&gt; char transa = 'N';&lt;BR /&gt; double alpha = 1.0;&lt;BR /&gt; double beta = 0.0;&lt;BR /&gt; char matdescra[6] = {'G','U','N','C',' ',' '};&lt;BR /&gt; mkl_dcsrmm(&amp;amp;transa, &amp;amp;M, &amp;amp;N, &amp;amp;M, α, matdescra, values, columns, pntrb, pntre, b, &amp;amp;N, β, c, &amp;amp;N);&lt;BR /&gt;// can not get the right result however.&lt;BR /&gt; for (int j = 0; j &amp;lt; M*N; j++) {&lt;BR /&gt;   std::cout &amp;lt;&amp;lt; c&lt;J&gt; &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; }&lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/J&gt;&lt;/IOSTREAM&gt;</description>
    <pubDate>Fri, 25 Nov 2011 10:18:12 GMT</pubDate>
    <dc:creator>utab</dc:creator>
    <dc:date>2011-11-25T10:18:12Z</dc:date>
    <item>
      <title>sparse matrix dense matrix multiplication question</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/sparse-matrix-dense-matrix-multiplication-question/m-p/786751#M1894</link>
      <description>Dear all,&lt;BR /&gt;&lt;BR /&gt;I am trying to do a sparse matrix - dense matrix multiplication operation, however the below code does not give me what I want, &lt;BR /&gt;I use the sparse matrix that is used in the intel manual and examples and a dense matrix of&lt;BR /&gt;1 5 &lt;BR /&gt;1 4 &lt;BR /&gt;1 3 &lt;BR /&gt;1 2&lt;BR /&gt;1 1&lt;BR /&gt;I guess my representation is correct in the code, however there is still sth wrong since I can not find the right answer. Could you please help me?&lt;BR /&gt;&lt;BR /&gt;Best regards, &lt;BR /&gt;Umut &lt;BR /&gt;&lt;BR /&gt;My code&lt;BR /&gt;&lt;BR /&gt;#include &lt;IOSTREAM&gt;&lt;BR /&gt;&lt;BR /&gt;#include "mkl_types.h"&lt;BR /&gt;#include "mkl_spblas.h"&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; MKL_INT M = 5;&lt;BR /&gt; double values[] = {1.0, -1.0, -3.0, -2.0, 5.0, 4.0, 6.0, 4.0, -4.0, 2.0, 7.0, 8.0, -5.0}; &lt;BR /&gt; MKL_INT columns[] = {0, 1, 3, 0, 1, 2, 3, 4, 0, 2, 3, 1, 4}; &lt;BR /&gt; MKL_INT rowIndex[] = {0, 3, 5, 8, 11, 13};&lt;BR /&gt; MKL_INT pntrb[] = {0, 3, 5, 8, 11};&lt;BR /&gt; MKL_INT pntre[] = {3, 5, 8, 11, 13;&lt;BR /&gt; MKL_INT N = 2; &lt;BR /&gt; double b[] = {1.0, 5.0, 1.0, 4.0, 1.0, 3.0, 1.0, 2.0, 1.0,1.0};&lt;BR /&gt; double c[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,0.0};&lt;BR /&gt; char transa = 'N';&lt;BR /&gt; double alpha = 1.0;&lt;BR /&gt; double beta = 0.0;&lt;BR /&gt; char matdescra[6] = {'G','U','N','C',' ',' '};&lt;BR /&gt; mkl_dcsrmm(&amp;amp;transa, &amp;amp;M, &amp;amp;N, &amp;amp;M, α, matdescra, values, columns, pntrb, pntre, b, &amp;amp;N, β, c, &amp;amp;N);&lt;BR /&gt;// can not get the right result however.&lt;BR /&gt; for (int j = 0; j &amp;lt; M*N; j++) {&lt;BR /&gt;   std::cout &amp;lt;&amp;lt; c&lt;J&gt; &amp;lt;&amp;lt; std::endl;&lt;BR /&gt; }&lt;BR /&gt; return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/J&gt;&lt;/IOSTREAM&gt;</description>
      <pubDate>Fri, 25 Nov 2011 10:18:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/sparse-matrix-dense-matrix-multiplication-question/m-p/786751#M1894</guid>
      <dc:creator>utab</dc:creator>
      <dc:date>2011-11-25T10:18:12Z</dc:date>
    </item>
  </channel>
</rss>

