<?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 GF, in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-we-select-the-column-of-a-matrix/m-p/931399#M13775</link>
    <description>&lt;P&gt;Hi GF,&lt;/P&gt;

&lt;P&gt;What is the reason of you change the matlab or&amp;nbsp;R to C? and What is your problem size (matrix)?&lt;/P&gt;

&lt;P&gt;You may have known,&amp;nbsp;you can use R or matlab&amp;nbsp;directly, and get MKL performance benifit at the same time, &amp;nbsp;because MKL&amp;nbsp;can be&amp;nbsp;intergarted into &amp;nbsp;R and Matlab, please see&amp;nbsp;the article&amp;nbsp;&amp;nbsp;&lt;A href="http://software.intel.com/en-us/articles/using-intel-mkl-with-r"&gt;http://software.intel.com/en-us/articles/using-intel-mkl-with-r&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;So&amp;nbsp;first, i may suggest you to use matlab or R directy.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Secondly, MKL mainly focus on the computation and the interfaces are mainly based on some kind of standard interface, like BLAS ( matrix, vector operation).&amp;nbsp;So&amp;nbsp;it is not flexiable like Matlab and R.&lt;/P&gt;

&lt;P&gt;It hasn't single routines like&amp;nbsp;data operations like extract&amp;nbsp;columns&amp;nbsp;from a&amp;nbsp;Matrix.&amp;nbsp;&amp;nbsp;But these operations are embeded in the computation.&lt;/P&gt;

&lt;P&gt;for example, If you have to convert the matlab code to C/MKL code.&amp;nbsp; You may first convert them to C code, then call MKL function.&lt;/P&gt;

&lt;P&gt;for example, X(:, t-j) - B(:, t-j) , as mecej4 mentioned to use daxpy.&lt;/P&gt;

&lt;P&gt;double * Ypointer=&amp;amp;(X[0][t-j]);&lt;/P&gt;

&lt;P&gt;double * Xpointer=&amp;amp;(B[0][t-j]);&lt;/P&gt;

&lt;P&gt;IncX= number of columns of B&lt;/P&gt;

&lt;P&gt;IncY =&amp;nbsp; number of columns of A;&lt;/P&gt;

&lt;P&gt;N= row of column of A;&lt;/P&gt;

&lt;P&gt;cblas_daxpy ( N, -1.0, Xpointer, incX, Ypointer,incY);&lt;/P&gt;

&lt;P&gt;Then same as for A(:, :, J) * Ypointer.&amp;nbsp; If A can access by C pointer with regular pattern by&amp;nbsp; (expressed by&amp;nbsp;incX and lda)&lt;/P&gt;

&lt;P&gt;Call cblas_dgemv (const CBLAS_ORDER order, const CBLAS_TRANSPOSE TransA, const MKL_INT&lt;BR /&gt;
	M, const MKL_INT N, const double alpha, const double *A, const MKL_INT lda, const&lt;BR /&gt;
	double *X, const MKL_INT incX, Ypointer, 1).&lt;/P&gt;

&lt;P&gt;Last, if you are using Intel&amp;nbsp;C Compiler,&amp;nbsp; Array notication also is helpful to convert&amp;nbsp;your matlab to C code.&lt;/P&gt;

&lt;P&gt;Please See&amp;nbsp; &lt;A href="http://software.intel.com/en-us/articles/about-intel-cilk-plus-and-how-to-get-started"&gt;http://software.intel.com/en-us/articles/about-intel-cilk-plus-and-how-to-get-started&lt;/A&gt;.&lt;BR /&gt;
	You can write A[:] - refers the entire array in C code.&lt;/P&gt;

&lt;P&gt;Best Regards,&lt;/P&gt;

&lt;P&gt;Ying&lt;/P&gt;</description>
    <pubDate>Mon, 03 Mar 2014 04:36:30 GMT</pubDate>
    <dc:creator>Ying_H_Intel</dc:creator>
    <dc:date>2014-03-03T04:36:30Z</dc:date>
    <item>
      <title>How do we select the column of a matrix?</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-we-select-the-column-of-a-matrix/m-p/931396#M13772</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;

&lt;P&gt;I am new to MKL and to C in general. Lets say that we have two matrices A, B of size (n,k). We would like for j =1 until k to subtrack the j column of A from B. In Matlab language the code is: for j=1:k, B(:,j)-A(:,j), end and in R language for(j=1 in k), { B[,j]-A[,j] }. I would like to ask if there is a routine to select the j column (or row) of a matrix? I searched but I had no luck.&lt;/P&gt;

&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2014 09:09:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-we-select-the-column-of-a-matrix/m-p/931396#M13772</guid>
      <dc:creator>Fiori</dc:creator>
      <dc:date>2014-02-28T09:09:37Z</dc:date>
    </item>
    <item>
      <title>Why do you describe the</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-we-select-the-column-of-a-matrix/m-p/931397#M13773</link>
      <description>&lt;P&gt;Why do you describe the operation in a seemingly more complicated way than just "A = &amp;nbsp;A - B"? MKL contains BLAS routines for performing matrix-matrix and vector operations. In particular, look at &lt;STRONG&gt;?axpy&lt;/STRONG&gt; routines. For such a simple operation as subtraction, you may also consider using the features that the programming language itself provides, such as those provided by BOOST.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2014 13:41:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-we-select-the-column-of-a-matrix/m-p/931397#M13773</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2014-02-28T13:41:00Z</dc:date>
    </item>
    <item>
      <title>Thank you for your help. I am</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-we-select-the-column-of-a-matrix/m-p/931398#M13774</link>
      <description>&lt;P&gt;Thank you for your help. I am confused with this language. I have written a program in Matlab and I want to convert it to C language using the MKL.&lt;/P&gt;

&lt;P&gt;The&amp;nbsp; part of my code is the following&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;for t=1:T&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;c1=0; c2=0;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;for j=1:p&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;c1=c1+A(:,:,j) * ( X(:,t-j)-B(:,t-j));&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;end&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;end&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I haven't known to use the library well yet.&amp;nbsp; Thanks again.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2014 14:00:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-we-select-the-column-of-a-matrix/m-p/931398#M13774</guid>
      <dc:creator>Fiori</dc:creator>
      <dc:date>2014-02-28T14:00:00Z</dc:date>
    </item>
    <item>
      <title>Hi GF,</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-we-select-the-column-of-a-matrix/m-p/931399#M13775</link>
      <description>&lt;P&gt;Hi GF,&lt;/P&gt;

&lt;P&gt;What is the reason of you change the matlab or&amp;nbsp;R to C? and What is your problem size (matrix)?&lt;/P&gt;

&lt;P&gt;You may have known,&amp;nbsp;you can use R or matlab&amp;nbsp;directly, and get MKL performance benifit at the same time, &amp;nbsp;because MKL&amp;nbsp;can be&amp;nbsp;intergarted into &amp;nbsp;R and Matlab, please see&amp;nbsp;the article&amp;nbsp;&amp;nbsp;&lt;A href="http://software.intel.com/en-us/articles/using-intel-mkl-with-r"&gt;http://software.intel.com/en-us/articles/using-intel-mkl-with-r&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;So&amp;nbsp;first, i may suggest you to use matlab or R directy.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Secondly, MKL mainly focus on the computation and the interfaces are mainly based on some kind of standard interface, like BLAS ( matrix, vector operation).&amp;nbsp;So&amp;nbsp;it is not flexiable like Matlab and R.&lt;/P&gt;

&lt;P&gt;It hasn't single routines like&amp;nbsp;data operations like extract&amp;nbsp;columns&amp;nbsp;from a&amp;nbsp;Matrix.&amp;nbsp;&amp;nbsp;But these operations are embeded in the computation.&lt;/P&gt;

&lt;P&gt;for example, If you have to convert the matlab code to C/MKL code.&amp;nbsp; You may first convert them to C code, then call MKL function.&lt;/P&gt;

&lt;P&gt;for example, X(:, t-j) - B(:, t-j) , as mecej4 mentioned to use daxpy.&lt;/P&gt;

&lt;P&gt;double * Ypointer=&amp;amp;(X[0][t-j]);&lt;/P&gt;

&lt;P&gt;double * Xpointer=&amp;amp;(B[0][t-j]);&lt;/P&gt;

&lt;P&gt;IncX= number of columns of B&lt;/P&gt;

&lt;P&gt;IncY =&amp;nbsp; number of columns of A;&lt;/P&gt;

&lt;P&gt;N= row of column of A;&lt;/P&gt;

&lt;P&gt;cblas_daxpy ( N, -1.0, Xpointer, incX, Ypointer,incY);&lt;/P&gt;

&lt;P&gt;Then same as for A(:, :, J) * Ypointer.&amp;nbsp; If A can access by C pointer with regular pattern by&amp;nbsp; (expressed by&amp;nbsp;incX and lda)&lt;/P&gt;

&lt;P&gt;Call cblas_dgemv (const CBLAS_ORDER order, const CBLAS_TRANSPOSE TransA, const MKL_INT&lt;BR /&gt;
	M, const MKL_INT N, const double alpha, const double *A, const MKL_INT lda, const&lt;BR /&gt;
	double *X, const MKL_INT incX, Ypointer, 1).&lt;/P&gt;

&lt;P&gt;Last, if you are using Intel&amp;nbsp;C Compiler,&amp;nbsp; Array notication also is helpful to convert&amp;nbsp;your matlab to C code.&lt;/P&gt;

&lt;P&gt;Please See&amp;nbsp; &lt;A href="http://software.intel.com/en-us/articles/about-intel-cilk-plus-and-how-to-get-started"&gt;http://software.intel.com/en-us/articles/about-intel-cilk-plus-and-how-to-get-started&lt;/A&gt;.&lt;BR /&gt;
	You can write A[:] - refers the entire array in C code.&lt;/P&gt;

&lt;P&gt;Best Regards,&lt;/P&gt;

&lt;P&gt;Ying&lt;/P&gt;</description>
      <pubDate>Mon, 03 Mar 2014 04:36:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/How-do-we-select-the-column-of-a-matrix/m-p/931399#M13775</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2014-03-03T04:36:30Z</dc:date>
    </item>
  </channel>
</rss>

