<?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 Re: Sparse CSR Matrix-Vector Multiplication in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901376#M11286</link>
    <description>&lt;P&gt;Dear Dario,&lt;/P&gt;
&lt;P&gt;It seems to be a bug of MKL 10. Try to use MKL 9.1 and you can get a correct result.&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Zhanghong Tang&lt;/P&gt;</description>
    <pubDate>Tue, 22 Apr 2008 15:01:54 GMT</pubDate>
    <dc:creator>Zhanghong_T_</dc:creator>
    <dc:date>2008-04-22T15:01:54Z</dc:date>
    <item>
      <title>Sparse CSR Matrix-Vector Multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901375#M11285</link>
      <description>Hello!
&lt;BR /&gt;
&lt;BR /&gt;I'm a new user of the MKL, and I have a "big" problem that I don't know how to solve...
&lt;BR /&gt;
&lt;BR /&gt;I'm trying to multiply a sparse matrix in the CSR format with a vector, and to do this I'm using the mkl_dcsrmv method.
&lt;BR /&gt;
&lt;BR /&gt;Unfortunately, the result is not correct. All the elements in the resulting vector are zero.
&lt;BR /&gt;Switching the 4th element of the matdescra parameter (in c++ matdescra[3] = ...) from 'C' to 'F' results in a "clamped" matrix-vector multiplication, where the first row and column are not considered anymore (that's not surprising since doing this the one-based indexing is enabled, as far as I know...).
&lt;BR /&gt;
&lt;BR /&gt;I was expecting that using 'C' instead of 'F' in the matdescra parameter enable the zero-based indexing but as I said all the elements in the resulting vector become zero.
&lt;BR /&gt;
&lt;BR /&gt;I'm using C++ and XCode on a Mac Pro 8-Cores. The version of my MKL is 10.0.2.018.
&lt;BR /&gt;
&lt;BR /&gt;I hope anyone can help me to solve this!
&lt;BR /&gt;Thank you in advance, best!!
&lt;BR /&gt;
&lt;BR /&gt;dario
&lt;BR /&gt;
&lt;BR /&gt;PS: sorry my english:-)
&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Apr 2008 13:10:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901375#M11285</guid>
      <dc:creator>dar_io</dc:creator>
      <dc:date>2008-04-22T13:10:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sparse CSR Matrix-Vector Multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901376#M11286</link>
      <description>&lt;P&gt;Dear Dario,&lt;/P&gt;
&lt;P&gt;It seems to be a bug of MKL 10. Try to use MKL 9.1 and you can get a correct result.&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Zhanghong Tang&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2008 15:01:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901376#M11286</guid>
      <dc:creator>Zhanghong_T_</dc:creator>
      <dc:date>2008-04-22T15:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sparse CSR Matrix-Vector Multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901377#M11287</link>
      <description>Hello,
&lt;BR /&gt;
&lt;BR /&gt;Thank you very much for your answer!! I will try the MKL 9.1!
&lt;BR /&gt;Best,
&lt;BR /&gt;
&lt;BR /&gt;dario</description>
      <pubDate>Tue, 22 Apr 2008 15:15:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901377#M11287</guid>
      <dc:creator>dar_io</dc:creator>
      <dc:date>2008-04-22T15:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sparse CSR Matrix-Vector Multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901378#M11288</link>
      <description>Dear Dario and Zhanghong,&lt;BR /&gt;&lt;BR /&gt;the m&lt;SPAN&gt;&lt;/SPAN&gt;k&lt;SPAN&gt;&lt;/SPAN&gt;l&lt;SPAN&gt;&lt;/SPAN&gt;_&lt;SPAN&gt;&lt;/SPAN&gt;d&lt;SPAN&gt;&lt;/SPAN&gt;c&lt;SPAN&gt;&lt;/SPAN&gt;s&lt;SPAN&gt;&lt;/SPAN&gt;r&lt;SPAN&gt;&lt;/SPAN&gt;m&lt;SPAN&gt;&lt;/SPAN&gt;v function seems to work with MKL 10 Update 1 (or maybe 9.1), but not with Update 4.&lt;BR /&gt;&lt;BR /&gt;I just updated my libraries and found my C program not working correct anymore. Having &lt;SPAN&gt;matdescra[5]="G F&lt;/SPAN&gt;" and added 1 to every indexing entry, everything is fine and the result is equal to the correct result. Having &lt;SPAN&gt;matdescra[5]="G C"&lt;/SPAN&gt;, the result is a zero-valued vector.&lt;BR /&gt;&lt;BR /&gt;This bug should be fixed asap, or not?&lt;BR /&gt;&lt;BR /&gt;Fabian&lt;BR /&gt;</description>
      <pubDate>Thu, 04 Sep 2008 12:37:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901378#M11288</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2008-09-04T12:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Sparse CSR Matrix-Vector Multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901379#M11289</link>
      <description>&lt;P&gt;Hi Fabian,&lt;/P&gt;
&lt;P&gt;This is unknown problem for us.Could you get us the test case? We will check the problem with the latest version. &lt;/P&gt;
&lt;P&gt;--Gennady&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Sep 2008 13:04:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901379#M11289</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2008-09-08T13:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sparse CSR Matrix-Vector Multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901380#M11290</link>
      <description>Hi Gennady,&lt;BR /&gt;&lt;BR /&gt;this is the code for a test case (identity matrix * (0, 1, ... 99)) where I get wrong results: &lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;  // initialize (dim == nonzeros)&lt;BR /&gt;  for (int i = 0; i &amp;lt; dim; i++) {&lt;BR /&gt;    x&lt;I&gt; = (double)i;&lt;BR /&gt;    mkl_c&lt;I&gt; = 1.;&lt;BR /&gt;    mkl_f&lt;I&gt; = 0.;&lt;BR /&gt;    loop&lt;I&gt; = 0.;&lt;BR /&gt;    values&lt;I&gt; = 1.;  // identity matrix&lt;BR /&gt;    columns&lt;I&gt; = i;&lt;BR /&gt;    pointerB&lt;I&gt; = i;&lt;BR /&gt;    pointerE&lt;I&gt; = i+1;&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;  // Zero-based multiplication&lt;BR /&gt;  char transa = 'n';&lt;BR /&gt;  char matdescra_c[6] = "G  C ";&lt;BR /&gt;  double alpha = 1.;&lt;BR /&gt;  double beta = 0.;&lt;BR /&gt;  mkl_dcsrmv(&amp;amp;transa, &amp;amp;dim, &amp;amp;dim, α, matdescra_c, values, columns, pointerB, pointerE, x, β, mkl_c);&lt;BR /&gt;&lt;BR /&gt;  // manual multiplication (loop)&lt;BR /&gt;  for (int i = 0; i&lt;DIM&gt;    int fromInd = pointerB&lt;I&gt;;&lt;BR /&gt;    int toInd = pointerE&lt;I&gt;;&lt;BR /&gt;    for (int j=fromInd; j&lt;TOIND&gt; += x[columns&lt;J&gt;] * values&lt;J&gt;;&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;  // One-based multiplication&lt;BR /&gt;  for (int i = 0; i &amp;lt; dim; i++) {&lt;BR /&gt;    columns&lt;I&gt; += 1;&lt;BR /&gt;    pointerB&lt;I&gt; += 1;&lt;BR /&gt;    pointerE&lt;I&gt; += 1;&lt;BR /&gt;  }&lt;BR /&gt;  &lt;BR /&gt;  char matdescra_f[6] = "G  F ";&lt;BR /&gt;  mkl_dcsrmv(&amp;amp;transa, &amp;amp;dim, &amp;amp;dim, α, matdescra_f, values, columns, pointerB, pointerE, x, β, mkl_f);&lt;BR /&gt;&lt;BR /&gt;  // output&lt;BR /&gt;  cout &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; "mkl_C: "; for (int i = 0; i &amp;lt; dim; i++) { cout &amp;lt;&amp;lt; mkl_c&lt;I&gt; &amp;lt;&amp;lt; " "; }&lt;BR /&gt;  cout &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; "mkl_F: "; for (int i = 0; i &amp;lt; dim; i++) { cout &amp;lt;&amp;lt; mkl_f&lt;I&gt; &amp;lt;&amp;lt; " "; }&lt;BR /&gt;  cout &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; "loop : "; for (int i = 0; i &amp;lt; dim; i++) { cout &amp;lt;&amp;lt; loop&lt;I&gt; &amp;lt;&amp;lt; " "; }&lt;BR /&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/J&gt;&lt;/J&gt;&lt;/TOIND&gt;&lt;/I&gt;&lt;/I&gt;&lt;/DIM&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;BR /&gt;I tried it with version 10.0.011 (icpc 10.1 20080602), and the arrays &lt;FONT face="Courier New"&gt;mkl_C&lt;/FONT&gt;, &lt;FONT face="Courier New"&gt;mkl_F&lt;/FONT&gt; and &lt;FONT face="Courier New"&gt;loop &lt;/FONT&gt;contain the correct result (0, 1, ..99).&lt;BR /&gt;&lt;BR /&gt;With version 10.0.4.023 (icpc 10.1 20080801), the array &lt;FONT face="Courier New"&gt;mkl_C &lt;/FONT&gt;is still zero (it is not changed, I tried other initial values). The other arrays contain the the correct result.&lt;BR /&gt;&lt;BR /&gt;I also played with &lt;FONT face="Courier New"&gt;matdescra&lt;FONT face="Times New Roman"&gt; length and content, also with &lt;FONT face="Courier New"&gt;alpha &lt;/FONT&gt;and &lt;FONT face="Courier New"&gt;beta&lt;/FONT&gt;. This is a minimal example, of course. I use a lot of other MKL routines, and they all seem to work in both versions.&lt;BR /&gt;&lt;BR /&gt;Thank you for your interest,&lt;BR /&gt;Fabian&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description>
      <pubDate>Thu, 11 Sep 2008 16:12:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901380#M11290</guid>
      <dc:creator>Fabian_K</dc:creator>
      <dc:date>2008-09-11T16:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sparse CSR Matrix-Vector Multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901381#M11291</link>
      <description>&lt;SPAN&gt;&lt;FONT face="Arial"&gt;
&lt;P class="MsoNormal"&gt;&lt;SPAN&gt;&lt;FONT color="#000000"&gt;Hi Fabian,&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="MsoNormal"&gt;&lt;SPAN&gt;&lt;FONT color="#000000"&gt;This problem has been fixed and the fix is available in our MKL 10.0 update 4 which is released recently.&lt;SPAN&gt; &lt;/SPAN&gt;Please download the same and verify the fix.&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="MsoNormal"&gt;&lt;SPAN&gt;&lt;FONT color="#000000"&gt;Thanks, Gennady&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="MsoNormal"&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2008 09:25:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901381#M11291</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2008-09-16T09:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sparse CSR Matrix-Vector Multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901382#M11292</link>
      <description>&lt;DIV class="ForumPostContentText" id="_ctl0__ctl1_bcr__ctl0___PostRepeater__ctl7_PostViewWrapper"&gt;&lt;SPAN&gt;&lt;FONT face="Arial"&gt;&lt;SPAN&gt;&lt;FONT color="#000000"&gt;
&lt;P class="MsoNormal"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN&gt;Fabian,&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN&gt;Sorry for my previous message - I misprinted the MKL version: &lt;/SPAN&gt;the problem was fixed in MKL 10.1 beta 2.&lt;SPAN&gt; &lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal"&gt;&lt;FONT face="Times New Roman"&gt;&lt;SPAN&gt;Please download the same and verify the fix.&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class="MsoNormal"&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt;Thanks, Gennady&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 16 Sep 2008 09:28:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901382#M11292</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2008-09-16T09:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sparse CSR Matrix-Vector Multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901383#M11293</link>
      <description>&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;&lt;BR /&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/331109"&gt;gfedorov&lt;/A&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;&lt;BR /&gt;
&lt;DIV id="_ctl0__ctl1_bcr__ctl0___PostRepeater__ctl7_PostViewWrapper" class="ForumPostContentText"&gt;&lt;SPAN&gt;&lt;SPAN style="font-family: Arial;"&gt;&lt;SPAN&gt;&lt;SPAN style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;BR /&gt;
&lt;P class="MsoNormal"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="font-family: Times New Roman;"&gt;&lt;SPAN&gt;Fabian,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P class="MsoNormal"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="font-family: Times New Roman;"&gt;&lt;SPAN&gt;Sorry for my previous message - I misprinted the MKL version: &lt;/SPAN&gt;the problem was fixed in MKL 10.1 beta 2.&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P class="MsoNormal"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN style="font-family: Times New Roman;"&gt;&lt;SPAN&gt;Please download the same and verify the fix.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;P class="MsoNormal"&gt;&lt;SPAN&gt;&lt;SPAN style="color: #000000;"&gt;Thanks, Gennady&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;/EM&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;/DIV&gt;&lt;BR /&gt;
Thanks.&lt;BR /&gt;
&lt;BR /&gt;
In the recently published MKL 10.0.5.25 the problem is not fixed. Unfortunately, our admin don't like betas (like in your suggestion)... and me neither. So I use my own (not optimized) multiplication routine. That's okay for me.</description>
      <pubDate>Fri, 26 Sep 2008 14:18:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901383#M11293</guid>
      <dc:creator>Fabian_K</dc:creator>
      <dc:date>2008-09-26T14:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Sparse CSR Matrix-Vector Multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901384#M11294</link>
      <description>Dear all,&lt;BR /&gt;&lt;BR /&gt;It seems that the bug of "mkl_dcsrmv" still exist on Linux version of MKL released together with Intel Fortran compiler 11.1.072 (I tested the intel64 version). &lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Zhanghong Tang</description>
      <pubDate>Tue, 04 May 2010 13:39:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901384#M11294</guid>
      <dc:creator>Zhanghong_T_</dc:creator>
      <dc:date>2010-05-04T13:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Sparse CSR Matrix-Vector Multiplication</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901385#M11295</link>
      <description>HelloZhanghong,&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;1)it will be better if you give us the exact example for reproducing the problem.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;2)how do you link the example?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;3) CPU type you are working on?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;4) the expected result&lt;/DIV&gt;&lt;DIV&gt;--Gennady&lt;/DIV&gt;</description>
      <pubDate>Wed, 05 May 2010 07:45:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901385#M11295</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2010-05-05T07:45:31Z</dc:date>
    </item>
    <item>
      <title>I am testing the functions of</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901386#M11296</link>
      <description>&lt;P&gt;Hello, I am testing the functions of Intel MKL in a C test-program and I found that I just can't make the spareblas mkl_scsrmm CSR one-based indexing work. I &lt;STRONG&gt;link &lt;/STRONG&gt;the example running first mklvar_ia32.bat, and then with VS command prompt and msvs compiler, using nmake libia32 and selecting the function I want to export (which is one I created for this test programs from the examples, because I couldn't find the problem in my original code so I wanted to isolate the function). My &lt;STRONG&gt;CPU &lt;/STRONG&gt;is Intel Core i7-3630QM 2,40 Ghz, its a 64 bit processor running Microsoft Windows 8 OS (not 8.1) 64 bits. The PC is a Toshiba laptop (Satellite). Here is the &lt;STRONG&gt;code&lt;/STRONG&gt;:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;stdio.h&amp;gt;
#include "mkl_types.h"
#include "mkl_spblas.h"

int main() {
    #define M 2        
    #define NNZ 4
        
        MKL_INT        m = M, nnz = NNZ;
        
        float        values[NNZ]     = {2.0,4.0,4.0,2.0};
        MKL_INT        columns[NNZ]  = {1,2,1,2};
        MKL_INT        rowIndex[M+1] = {1,3,5};
        
    #define N 2      
      
        MKL_INT        n = N;
        float         b&lt;M&gt;&lt;N&gt;    = {2.0, 1.0, 5.0, 2.0};
        float         c&lt;M&gt;&lt;N&gt;    = {0.0, 0.0, 0.0, 0.0};
        float         alpha = 1.0, beta = 0.0;
        char          transa, uplo, nonunit;
        char          matdescra[6];
		MKL_INT		  i, j;
        
    transa = 'N';
    
        matdescra[0] = 'S';
        matdescra[1] = 'L';
        matdescra[2] = 'N';
        matdescra[3] = 'F';
        
        mkl_scsrmm(&amp;amp;transa, &amp;amp;m, &amp;amp;n, &amp;amp;m, &amp;amp;alpha, matdescra, values, columns, rowIndex, &amp;amp;(rowIndex[1]), &amp;amp;(b[0][0]), &amp;amp;n,  &amp;amp;beta, &amp;amp;(c[0][0]), &amp;amp;n);

        printf("                             \n");
        printf("   OUTPUT DATA FOR MKL_SCSRMM\n");
        for (i = 0; i &amp;lt; m; i++) {
            for (j = 0; j &amp;lt; n; j++) {
                printf("%7.1f", c&lt;I&gt;&lt;J&gt;);
            };
            printf("\n");
        };
        return 0;
}&lt;/J&gt;&lt;/I&gt;&lt;/N&gt;&lt;/M&gt;&lt;/N&gt;&lt;/M&gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;The results I get are this:&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;Zero-based indexing (&lt;STRONG&gt;the right solution&lt;/STRONG&gt;):&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;24.0 10.0

18.0 8.0&lt;/PRE&gt;

&lt;P&gt;One-based indexing:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;8.0 10.0

18.0 24.0&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Though it seems like it only changes the diagonal elements position, &lt;STRONG&gt;with 3x3 matrix the solution its completly different from the right one&lt;/STRONG&gt;. I suspected that it might be something with the input format of the matrix b. I think that there's lack of clarity on the description of array b for the function mkl_scsrmm placed in the MKL reference manual. Thus I changed b format in this example and it worked (I placed elements position in this order: `{2.0, 5.0, 1.0, 2.0}). But I did the same for another 3x3 example I coded and it didn't work so I think it may be just a coincidence. I don't really know what to do with this problem,&amp;nbsp; I have lost three days thinking that there was a problem in my original code (I am a begginer, industrial engineer learning technical software developtment on my own for a final degree proyect, sorry if I miss some important data/information, ask for it and I'll respond as soon as posible), working with mkl core examples in c and trying to figure out what happened. I would like to understand what's going on here.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;References:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;CSR format&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/node/471374"&gt;https://software.intel.com/en-us/node/471374&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;Spare Blas mkl_scsrmm function&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/sites/products/documentation/doclib/iss/2013/mkl/mklman/hh_goto.htm#GUID-78C55D9B-86FF-4A9F-B5D5-D2F61B9314FC.htm"&gt;https://software.intel.com/sites/products/documentation/doclib/iss/2013/mkl/mklman/hh_goto.htm#GUID-78C55D9B-86FF-4A9F-B5D5-D2F61B9314FC.htm&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 21:19:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901386#M11296</guid>
      <dc:creator>Adrian_A_</dc:creator>
      <dc:date>2014-10-23T21:19:00Z</dc:date>
    </item>
    <item>
      <title>You are calling a library</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901387#M11297</link>
      <description>&lt;P&gt;You are calling a library routine that was originally designed to be called mainly from Fortran, which uses column-major 2-D arrays, i.e., the columns are contiguous in memory. A C-native 2-D array is kept in row-major format. The result is that when you pass a 2-D array A from C, the library routine interprets the argument as C&lt;SUP&gt;T&lt;/SUP&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 21:32:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901387#M11297</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2014-10-23T21:32:00Z</dc:date>
    </item>
    <item>
      <title>But then why the intel c</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901388#M11298</link>
      <description>&lt;P&gt;But then why in the intel c example, which uses zero-based indexing, they don't transpose the matrix b and the result is right?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2014 09:53:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901388#M11298</guid>
      <dc:creator>Adrian_A_</dc:creator>
      <dc:date>2014-10-24T09:53:00Z</dc:date>
    </item>
    <item>
      <title>I don't know which example</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901389#M11299</link>
      <description>&lt;P&gt;I don't know which example &amp;nbsp;you refer to, nor can I compile your example program of #12 and run it &lt;SPAN style="font-size: 14.3999996185303px; line-height: 17.5607986450195px;"&gt;to see what the problem is&amp;nbsp;&lt;/SPAN&gt;(there are undeclared variables).&lt;/P&gt;

&lt;P&gt;As I said before, note that the result array &lt;STRONG&gt;C&lt;/STRONG&gt;, which you try to print using the name &lt;STRONG&gt;rhs&lt;/STRONG&gt;, is delivered by MKL as a column-major matrix, so your program will print out C&lt;SUP&gt;T&lt;/SUP&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2014 12:29:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901389#M11299</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2014-10-24T12:29:26Z</dc:date>
    </item>
    <item>
      <title>Sorry for the code of #12 I</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901390#M11300</link>
      <description>&lt;P&gt;Sorry for the code of #12 I forgot to copy two instructions and the c name in the printf, now you should be able to compile it. The intel example I am using is located in: "...mkl\examples\examples_core_c\spblasc\source\cspblas_scsr.c". I attached &amp;nbsp;the other example I am using. There are two examples in that code, doing AxB, with the same matrix &amp;nbsp;A in zero-based indexing and in one-based indexing. With zero you don't need to store the matrix B in column major order and everything seems to work. With one based indexing I store the matrix B in column order as you said (ie transposed) and I print both C and C'. None of them are the solution. I don't know what happens. Maby the one based indexing is made only for being called from Fortran...but this is a C interface...&lt;/P&gt;

&lt;P&gt;Here is what you said, the paragraph before the title "Differences Between Intel MKL and NIST* Interfaces"&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/sites/products/documentation/doclib/iss/2013/mkl/mklman/hh_goto.htm#GUID-34C8DB79-0139-46E0-8B53-99F3BEE7B2D4.htm"&gt;https://software.intel.com/sites/products/documentation/doclib/iss/2013/mkl/mklman/hh_goto.htm#GUID-34C8DB79-0139-46E0-8B53-99F3BEE7B2D4.htm&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I read this before coding my program, but as I saw that in the examples coded in c, the native c storage format was used, I thought that the interfaces for C arranged the arrays so that they&amp;nbsp;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;get to the Fortran code in the proper format. Now I don't know what happens.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2014 15:01:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901390#M11300</guid>
      <dc:creator>Adrian_A_</dc:creator>
      <dc:date>2014-10-24T15:01:00Z</dc:date>
    </item>
    <item>
      <title>The program in #16 works</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901391#M11301</link>
      <description>&lt;P&gt;The program in #16 works correctly, and I think that the problem you have is in interpreting the results. You print C and C&lt;SUP&gt;T&lt;/SUP&gt;&amp;nbsp;separately, which is redundant, since visually transposing a 3 X 3 matrix is something that most of us can accomplish.&lt;/P&gt;

&lt;P&gt;The first pair of results that your program prints out are (A.B) and (A.B)&lt;SUP&gt;T&lt;/SUP&gt;. The second pair of results are (A&lt;SUP&gt;T&lt;/SUP&gt;.B&lt;SUP&gt;T&lt;/SUP&gt;) and (&lt;SPAN style="font-size: 14.3999996185303px; line-height: 17.5607986450195px;"&gt;A&lt;/SPAN&gt;&lt;SUP&gt;T&lt;/SUP&gt;&lt;SPAN style="font-size: 14.3999996185303px; line-height: 17.5607986450195px;"&gt;.B&lt;/SPAN&gt;&lt;SUP&gt;T&lt;/SUP&gt;&lt;SPAN style="font-size: 14.3999996185303px; line-height: 17.5607986450195px;"&gt;)&amp;nbsp;&lt;/SPAN&gt;&lt;SUP&gt;T&lt;/SUP&gt;. The last item is equal to B.A but, because B is not symmetric, it is not equal to A.B.&lt;/P&gt;

&lt;P&gt;At least as far as your example is concerned, the issue of zero-based or one-based indices is a red herring. That issue affects only sparse matrix representations, and the only sparse matrix in your problem, A, is symmetric. Secondly, you chose square matrices for your example, so that the stride from a row to the next row equals the stride from a column to the next column, so the issue of matdescra[3] being 'C' or 'F' changes nothing.&lt;/P&gt;

&lt;P&gt;You may find it beneficial to choose another example where the matrices are not square, so that the aspect of a matrix being symmetric goes away, and compare the results of hand calculations with what MKL gives you.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2014 17:50:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901391#M11301</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2014-10-24T17:50:13Z</dc:date>
    </item>
    <item>
      <title>Well, finally I think I</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901392#M11302</link>
      <description>&lt;P style="line-height: 19.5120010375977px;"&gt;Well, finally I think I understand what happens. The C interface needs you to store arrays in&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;row-major order&lt;/SPAN&gt;&amp;nbsp;when you use&amp;nbsp;&lt;STRONG&gt;&lt;SPAN style="font-weight: 700;"&gt;zero-based indexing&lt;/SPAN&gt;&lt;/STRONG&gt;&amp;nbsp;and&amp;nbsp;&lt;SPAN style="font-weight: 700;"&gt;&lt;STRONG&gt;column-major&lt;/STRONG&gt; &lt;STRONG&gt;order&lt;/STRONG&gt;&lt;/SPAN&gt;&amp;nbsp;when you use&amp;nbsp;&lt;STRONG&gt;&lt;SPAN style="font-weight: 700;"&gt;one-based indexing&lt;/SPAN&gt;&lt;/STRONG&gt;, and it returns the arrays in that same order. My mistake was thinking that C interface would accept for both ways of indexing the row-major ordering, and translate it to the Fortran column-major ordering. The format of the sparse matrix just changes in the indexing, from zero to one. So when you call the routine for one and zero-based indexing, &amp;nbsp;changing only matrix A indexing and entering the same matrix &amp;nbsp;B&lt;SUB&gt;&lt;SPAN style="line-height: 19.5120010375977px;"&gt;mxn&amp;nbsp;&lt;/SPAN&gt;&lt;/SUB&gt;&lt;EM&gt;{a11...a1n, a21....a2n,....,am1....amn}&amp;nbsp;&lt;/EM&gt;the routine will output the right result for cero-based indexing. For one-based indexing it will misunderstand the matrix B as if it was another matrix with coefficients in different positions, like this:&lt;/P&gt;

&lt;PRE class="brush:fortran;" style="font-size: 13px; line-height: 19.5120010375977px;"&gt;B = 1   2   3

    4   5   6&lt;/PRE&gt;

&lt;P style="line-height: 19.5120010375977px;"&gt;arrayB = {&lt;EM&gt;1 2 3 4 5 6}&lt;/EM&gt;&lt;/P&gt;

&lt;P style="line-height: 19.5120010375977px;"&gt;column-order matrix B interpretation, which is used in one-order indexing:&lt;/P&gt;

&lt;PRE class="brush:fortran;" style="font-size: 13px; line-height: 19.5120010375977px;"&gt;B = 1   3   5

    2   4   6&lt;/PRE&gt;

&lt;P style="line-height: 19.5120010375977px;"&gt;And the result will also be in column-major order. The last paragraph of #17 really helped me.&lt;/P&gt;

&lt;P style="line-height: 19.5120010375977px;"&gt;&lt;STRONG&gt;&lt;SPAN style="font-weight: 700;"&gt;Thank you very much&lt;/SPAN&gt;,&lt;/STRONG&gt; Mr. mecej4 for helping me. I really appreciate you took the time to explain explain this to me.&lt;/P&gt;

&lt;P style="line-height: 19.5120010375977px;"&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Oct 2014 15:37:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901392#M11302</guid>
      <dc:creator>Adrian_A_</dc:creator>
      <dc:date>2014-10-25T15:37:00Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901393#M11303</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a problem involving sparse matrix-vector multiplication in a loop. In each loop iteration the number of rows that is used in the sparse matrix increases. Is there an efficient way to implement this with&amp;nbsp;mkl_sparse_?_mv()?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 08:26:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Sparse-CSR-Matrix-Vector-Multiplication/m-p/901393#M11303</guid>
      <dc:creator>Lessig__Christian</dc:creator>
      <dc:date>2020-01-16T08:26:11Z</dc:date>
    </item>
  </channel>
</rss>

