<?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 The seventh argument to cblas in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978068#M17224</link>
    <description>&lt;P&gt;The seventh argument to cblas_dgemv&amp;nbsp;should be n. The convention is that a matrix is passed by specifying four attributes:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;&amp;nbsp;the address of the base, i.e., the address of the (1,1) element in Fortran or the [0][0] element in C/C++,&amp;nbsp;&lt;/LI&gt;
	&lt;LI&gt;the number of rows, m&lt;/LI&gt;
	&lt;LI&gt;the number of columns, n&lt;/LI&gt;
	&lt;LI&gt;the stride from one row to the next, if using row-major order as in C/C++, or the stride from one column to the next, if using column-major order as in Fortran.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;You are passing a 3 X 2 matrix using row-major order; therefore, the stride from each row to the next is 2.&lt;/P&gt;

&lt;P&gt;There is some avoidable confusion in the MKL documentation; this is caused by using Fortran-centric terms such as "leading dimension", which a C/C++ programmer may take to be something different.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2014 21:03:00 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2014-02-06T21:03:00Z</dc:date>
    <item>
      <title>Waht is wrong with cblas_dgemv</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978067#M17223</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; I am interested in the following operation:&lt;/P&gt;

&lt;P&gt;Y = A^T * X&lt;/P&gt;

&lt;P&gt;using the cblas_dgemv or cblas_dgemm routine in MKL. In the code I use small letters: y, a, and x.&lt;/P&gt;

&lt;P&gt;I have a test example as follows:&lt;/P&gt;

&lt;P&gt;#include &amp;lt;cstdio&amp;gt;&lt;BR /&gt;
	#include &amp;lt;cstdlib&amp;gt;&lt;BR /&gt;
	#include "mkl.h"&lt;/P&gt;

&lt;P&gt;void main()&lt;BR /&gt;
	{&lt;/P&gt;

&lt;P&gt;&amp;nbsp;double a[6] = {2., 3., 1., 1., 0., 2. }; // 3 x 2 matrix&lt;BR /&gt;
	&amp;nbsp; double x[3] = {1., 1., 1.};&lt;BR /&gt;
	&amp;nbsp; double y[2] = {0., 0.};&lt;BR /&gt;
	&amp;nbsp; int m = 3;&lt;BR /&gt;
	&amp;nbsp; int n = 2;&lt;BR /&gt;
	&amp;nbsp; double alpha = 1.0;&lt;BR /&gt;
	&amp;nbsp; double beta = 1.0;&lt;BR /&gt;
	&amp;nbsp; int incx = 1;&lt;BR /&gt;
	&amp;nbsp; int incy = 1;&lt;BR /&gt;
	&amp;nbsp; int i,j;&lt;/P&gt;

&lt;P&gt;&amp;nbsp; for (i=0; i&amp;lt;m; i++){&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; for (j=0; j&amp;lt;n; j++)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("%g ", a[i*n + j]);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("\n");&lt;BR /&gt;
	&amp;nbsp; }&lt;/P&gt;

&lt;P&gt;&amp;nbsp; cblas_dgemv(CblasRowMajor, CblasTrans, m, n, alpha, a, m, x, incx, beta, y, incy );&lt;/P&gt;

&lt;P&gt;&amp;nbsp; for (i=0; i&amp;lt;n; i++)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("%g\n", y&lt;I&gt;);&lt;/I&gt;&lt;/P&gt;

&lt;P&gt;}&lt;/P&gt;

&lt;P&gt;After running the code, I get wrong results. Can someone point out the mistake?&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Pawan&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 18:09:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978067#M17223</guid>
      <dc:creator>pawan_k_</dc:creator>
      <dc:date>2014-02-06T18:09:49Z</dc:date>
    </item>
    <item>
      <title>The seventh argument to cblas</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978068#M17224</link>
      <description>&lt;P&gt;The seventh argument to cblas_dgemv&amp;nbsp;should be n. The convention is that a matrix is passed by specifying four attributes:&lt;/P&gt;

&lt;UL&gt;
	&lt;LI&gt;&amp;nbsp;the address of the base, i.e., the address of the (1,1) element in Fortran or the [0][0] element in C/C++,&amp;nbsp;&lt;/LI&gt;
	&lt;LI&gt;the number of rows, m&lt;/LI&gt;
	&lt;LI&gt;the number of columns, n&lt;/LI&gt;
	&lt;LI&gt;the stride from one row to the next, if using row-major order as in C/C++, or the stride from one column to the next, if using column-major order as in Fortran.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;You are passing a 3 X 2 matrix using row-major order; therefore, the stride from each row to the next is 2.&lt;/P&gt;

&lt;P&gt;There is some avoidable confusion in the MKL documentation; this is caused by using Fortran-centric terms such as "leading dimension", which a C/C++ programmer may take to be something different.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2014 21:03:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978068#M17224</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2014-02-06T21:03:00Z</dc:date>
    </item>
    <item>
      <title>Thanks. It works now.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978069#M17225</link>
      <description>Thanks. It works now. 

This was tricky! I will apply this trick also to the dgemm routine.

regards,
Pawan</description>
      <pubDate>Thu, 06 Feb 2014 23:08:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978069#M17225</guid>
      <dc:creator>pawan_k_</dc:creator>
      <dc:date>2014-02-06T23:08:19Z</dc:date>
    </item>
    <item>
      <title>For dgemm, it was confusing</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978070#M17226</link>
      <description>&lt;P&gt;For dgemm, it was confusing as well. I put an working&lt;/P&gt;

&lt;P&gt;example below for someone in need.&lt;/P&gt;

&lt;P&gt;Goal: C := alpha A^T * B + beta * C, with alpha = 1; beta = 0;&lt;/P&gt;

&lt;P&gt;Use the following:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;cblas_dgemm(CblasRowMajor, CblasTrans, CblasNoTrans, A.ncols(), B.ncols(), A.nrows(),&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alpha, A.vec, A.ncols(), B.vec, B.ncols(), beta, C.vec, B.ncols())&lt;/P&gt;

&lt;P&gt;&amp;nbsp; Here I take:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LDA: stride for A = A.ncols();&amp;nbsp; // it would have been A.nrows(), if transA = 'N'&lt;/P&gt;

&lt;P&gt;NOTE: Notice that this is a bit confusing when compared to dgemv, because for dgemm, the number of rows and number of columns of A^T are input. By this logic, one may take LDA to be A.nrows() above, because the rows of A^T have strides of A.nrows(). In other words, although for dgemm, we are required to put number of rows and number of columns of A^T, for LDA we must consider strides for A not for A^T.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LDB: stride for B = B.ncols();&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LDC: stride for C = B.ncols();&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Pawan&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2014 00:23:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978070#M17226</guid>
      <dc:creator>pawan_k_</dc:creator>
      <dc:date>2014-02-07T00:23:00Z</dc:date>
    </item>
    <item>
      <title>Hi Pawan,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978071#M17227</link>
      <description>&lt;P&gt;Hi Pawan,&lt;/P&gt;

&lt;P&gt;Thank you a lot&amp;nbsp;for your comments about dgemv and dgemm.&lt;/P&gt;

&lt;P&gt;Just add some&lt;/P&gt;

&lt;P&gt;based on the documentation of dgemm: C&lt;SUB&gt;mxn=&lt;/SUB&gt;op(A)&lt;SUB&gt;mxk&lt;/SUB&gt;*op(B)&lt;SUB&gt;kxn&lt;/SUB&gt;&lt;/P&gt;

&lt;P&gt;m INTEGER. Specifies the number of rows of the matrix &lt;STRONG&gt;op(A) &lt;/STRONG&gt;and of the matrix C. The value of m must be at least zero&lt;/P&gt;

&lt;P&gt;k, INTEGER. Specifies the number of columns of the matrix op(A) and the number of rows of the matrix op(B).&lt;/P&gt;

&lt;P&gt;Where the documetnation of dgemv, the m. n is from A and LDA is&amp;nbsp; A.&lt;/P&gt;

&lt;P&gt;m INTEGER. Specifies the number of rows of the matrix A. The value of m must be at least zero.&lt;BR /&gt;
	n INTEGER. Specifies the number of columns of the matrix A. The value of n must be at least zero.&lt;/P&gt;

&lt;P&gt;So&amp;nbsp;you are&amp;nbsp;exctaly right, that for dgemm, we are required to put number of rows and number of colums of A^T&amp;nbsp;when transA=T.&lt;/P&gt;

&lt;P&gt;But &lt;STRONG&gt;LDA is&amp;nbsp;&amp;nbsp;the stride of A both the dgemv and dgemm, whatever transA= N or T.&lt;/STRONG&gt; &lt;/P&gt;

&lt;P&gt;I guess, you may have tried&lt;/P&gt;

&lt;P&gt;1. cblas_dgemm(CblasRowMajor, CblasTrans, CblasNoTrans, 2, 1, 3,&amp;nbsp; 1.0, a, 2, x, 1, 0, y, 1);&amp;nbsp;&amp;nbsp; get y=(6, 3)&lt;/P&gt;

&lt;P&gt;2. cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, 2, 1, 3,&amp;nbsp; 1.0, a, 3, x, 1, 0, y, 1);&amp;nbsp;get y=(3,6)&lt;/P&gt;

&lt;P&gt;thus happen to get the conclustion of &amp;nbsp;LDA=A.nrows when trans='N'.&amp;nbsp; Actually, it&amp;nbsp;is not correct because&amp;nbsp;the A&amp;nbsp;are different under the two cases.&amp;nbsp;&amp;nbsp;for example, if you change the original A =&amp;nbsp; {2., 3., &lt;STRONG&gt;5.,&lt;/STRONG&gt; 1., 0., 2. }, you will see the difference more obviously.&lt;/P&gt;

&lt;P&gt;2 3 )T&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m=3, n=2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m=2, n=3&lt;/P&gt;

&lt;P&gt;5&amp;nbsp;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; =&amp;nbsp;&amp;nbsp;&amp;nbsp;7 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; =&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;

&lt;P&gt;(0 2&amp;nbsp;&amp;nbsp;&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;3&lt;/P&gt;

&lt;P&gt;Hope it can lighten some confustion.&lt;/P&gt;

&lt;P&gt;Best Regards,&lt;/P&gt;

&lt;P&gt;Ying&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2014 06:25:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978071#M17227</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2014-02-07T06:25:50Z</dc:date>
    </item>
    <item>
      <title>Thanks Ying for a correction.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978072#M17228</link>
      <description>Thanks Ying for a correction. I quote your correction:

 "But LDA is  the stride of A both the dgemv and dgemm, whatever transA= N or T. "

Regards,
Pawan</description>
      <pubDate>Fri, 07 Feb 2014 09:19:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978072#M17228</guid>
      <dc:creator>pawan_k_</dc:creator>
      <dc:date>2014-02-07T09:19:08Z</dc:date>
    </item>
    <item>
      <title>Hello! I have a problem with</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978073#M17229</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;

&lt;P&gt;I have a problem with the function dgemv so I thought to post it here. If I should open a new topic please let me know to fix it.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Let A1, A2, A3 be 4x4 matrices.&lt;/P&gt;

&lt;P&gt;A1 = 5&amp;nbsp; 6&amp;nbsp; 7&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , A2 = 21 22 23 24&amp;nbsp; , A3 = 37 38 39 40&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9 10 11 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25 26 27 28&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 41 42 43 44&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13 14 15 16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 29 30 31 32&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 45 46 47 48&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 17 18 19 20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 33 34 35 36&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 49 50 51 52&lt;/P&gt;

&lt;P&gt;I defined in this way in my code&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;
double A[48];

double y[4];

for( int i=0; i&amp;lt;48; i++) {A&lt;I&gt; = i+5;}.&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I want to multiply the matrix A1 with the vector&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;
double pi0 = {0.1, 0.2, 0.3, 0.4};&lt;/PRE&gt;

&lt;P&gt;so I did this&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;
		 cblas_dgemv(CblasRowMajor, CblasNoTrans, 4, 4, 1.0, &amp;amp;A[0:15], 4, pi0, 1, 0.0, y, 1);
&lt;/PRE&gt;

&lt;P&gt;The result I got is {21, 25, 29,31} , although the true result is {7, 11 , 15 ,19};&lt;/P&gt;

&lt;P&gt;One solution that worked was to copy the first 15 values of the matrix A to another matrix B, then when I did&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;
int B[16];

        for(int i=0; i&amp;lt;16; i++)
        {B&lt;I&gt; =A&lt;I&gt;;
        }
cblas_dgemv(CblasRowMajor, CblasNoTrans, 4, 4, 1.0, B, 4, pi0, 1, 0.0, y, 1);&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;

&lt;P&gt;it worked.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;The problem is that I don't understand what went wrong in the first way. Also if I first copy the matrix I think that this will require more time. Please, help me.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2014 15:53:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978073#M17229</guid>
      <dc:creator>Anas_A_</dc:creator>
      <dc:date>2014-03-06T15:53:28Z</dc:date>
    </item>
    <item>
      <title>Hi</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978074#M17230</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Replace &amp;amp;A[0:15] by A.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;Does it work now?&lt;/P&gt;

&lt;P&gt;&amp;nbsp; cblas_dgemv(CblasRowMajor, CblasNoTrans, 4, 4, 1.0, A, 4, pi0, 1, 0.0, y, 1);&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Pawan&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2014 20:54:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978074#M17230</guid>
      <dc:creator>pawan_k_</dc:creator>
      <dc:date>2014-03-06T20:54:00Z</dc:date>
    </item>
    <item>
      <title>Hi! Yes, now it works. Could</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978075#M17231</link>
      <description>&lt;P&gt;Hi! Yes, now it works. Could I ask you something? How do we find the lda? I have understood that if we have a matrix mxn and we save it row-by-row then the lda is equal to the number of columns. But, how do we decide in a situation like here? I mean when we have 3 matrices which we have defined firstly the first matrix row-by-row, then the second matrix row-by-row and etc.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;If&amp;nbsp; we want to compute the product of the matrix A2 (or A3) with the vector pi0 how do we select the lda?&lt;/P&gt;

&lt;P&gt;In general how do we decide the lda&amp;nbsp; in we have P matrices (not 3). (I have a problem like this but with P matrices, where P =0,1,2,3,...)&lt;/P&gt;

&lt;P&gt;If you know a book, notes , anything that could help me with that please tell me.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks for helping me!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2014 23:36:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978075#M17231</guid>
      <dc:creator>Anas_A_</dc:creator>
      <dc:date>2014-03-06T23:36:43Z</dc:date>
    </item>
    <item>
      <title>Hi Anas,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978076#M17232</link>
      <description>&lt;P&gt;Hi Anas,&lt;/P&gt;

&lt;P&gt;Right, lda is generally equal to the number of columns when A is mxn.&lt;/P&gt;

&lt;P&gt;About the complex&amp;nbsp;situation like A[48], it is a 1-D array in C.&amp;nbsp;and&lt;/P&gt;

&lt;P&gt;A1={A[0],&amp;nbsp; A[15]};&lt;/P&gt;

&lt;P&gt;A2={A[16],&amp;nbsp; A[31]};&lt;/P&gt;

&lt;P&gt;A3={A[32], .. A[47];&lt;/P&gt;

&lt;P&gt;As you see, the A1, A2, A3, can be accessed by regular patten as a 1-D C-array.&amp;nbsp; The adress of A2[mxn] is &amp;amp;A[16]. and it's mxn&amp;nbsp;elements are continous elements in A[16] .. A[31], so lda is&amp;nbsp;still n.&amp;nbsp;you can just move the first pointer to access A2, A3. for example, &amp;nbsp;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;if &amp;nbsp;A2 * pio,&amp;nbsp;&amp;nbsp;call&amp;nbsp;cblas_dgemv(CblasRowMajor, CblasNoTrans, 4, 4, 1.0, &amp;amp;A[16], 4, pi0, 1, 0.0, y, 1);&amp;nbsp; or A+16&lt;/P&gt;

&lt;P&gt;if A3* pio,&amp;nbsp;&amp;nbsp; call cblas_dgemv(CblasRowMajor, CblasNoTrans, 4, 4, 1.0, A+32 , pi0, 1, 0.0, y, 1);&amp;nbsp;&amp;nbsp; or &amp;amp;A[32]&lt;/P&gt;

&lt;P&gt;The key point is how you access the array in C array.&amp;nbsp;if only&amp;nbsp;the array can be accessed by some regular pattern as a C array, then you can decide the input parameter of A.&lt;/P&gt;

&lt;P&gt;Best Regards,&lt;/P&gt;

&lt;P&gt;Ying&lt;/P&gt;

&lt;P&gt;P.S. Please ignore the syntax I mentioned last&amp;nbsp;time about Array notation&amp;nbsp;like A[0:15]. It is special syntax only for Array notation, can't be taken as a C pointer to pass to MKL funtion.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2014 02:04:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978076#M17232</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2014-03-07T02:04:35Z</dc:date>
    </item>
    <item>
      <title>I had serious problems with</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978077#M17233</link>
      <description>&lt;P&gt;I had serious problems with my pc and I just saw the answer. Ying, you are great! I have no words to express my appreciation. Thank you.&lt;/P&gt;</description>
      <pubDate>Sun, 09 Mar 2014 18:07:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978077#M17233</guid>
      <dc:creator>Anas_A_</dc:creator>
      <dc:date>2014-03-09T18:07:40Z</dc:date>
    </item>
    <item>
      <title>can anyone please explain</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978078#M17234</link>
      <description>&lt;P&gt;can anyone please explain what does each of the parameters incX and incY indicate ?&lt;/P&gt;</description>
      <pubDate>Sun, 13 Nov 2016 14:08:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978078#M17234</guid>
      <dc:creator>Eman_H_</dc:creator>
      <dc:date>2016-11-13T14:08:11Z</dc:date>
    </item>
    <item>
      <title>Quote:Eman H. wrote:</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978079#M17235</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Eman H. wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;can anyone please explain what does each of the parameters incX and incY indicate ?&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;These are described in the MKL documentation, as well at&amp;nbsp;http://www.netlib.org/lapack/explore-html/dc/da8/dgemv_8f.html .&lt;/P&gt;

&lt;P&gt;The ?gemv routines compute α A x + β&amp;nbsp;y or&amp;nbsp;&lt;SPAN style="font-size: 16.26px;"&gt;α&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 16.26px;"&gt;A&lt;SUP&gt;T&lt;/SUP&gt; x +&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 16.26px;"&gt;β&lt;/SPAN&gt;&lt;SPAN style="font-size: 16.26px;"&gt;&amp;nbsp;y, where A is a matrix and x, y are vectors. Sometimes, we wish to extract a row from a matrix and regard that as a vector. In Fortran, storage is by columns, so the distance between successive row elements to be extracted is not equal to 1, as in a column vector of the same matrix, but is equal to the number of columns in the matrix. Similar considerations apply to the destination of the computed vector.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Nov 2016 14:28:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978079#M17235</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2016-11-13T14:28:20Z</dc:date>
    </item>
    <item>
      <title>Hi Eman,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978080#M17236</link>
      <description>&lt;P&gt;Hi Eman,&lt;/P&gt;

&lt;P&gt;In simple word, the incX is the distance of&amp;nbsp; each&amp;nbsp;&amp;nbsp;element&amp;nbsp; (who will involved the compute A*X)&amp;nbsp; or the stride of X[1] and X[2].&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In most of case, the&amp;nbsp;vector(involved the compute)&amp;nbsp;is continuous, &amp;nbsp;it is 1.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;In some times, if the element (will involve the compute) is not continuous, but can be &lt;STRONG&gt;accessed by regular&amp;nbsp;way&lt;/STRONG&gt;, for example,&amp;nbsp; X[1], X[3], X[5], then the incX =&amp;nbsp;2. &amp;nbsp;&lt;/P&gt;

&lt;P&gt;Best Regards,&lt;BR /&gt;
	Ying&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 03:53:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Waht-is-wrong-with-cblas-dgemv/m-p/978080#M17236</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2016-11-14T03:53:17Z</dc:date>
    </item>
  </channel>
</rss>

