<?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 Combining Hadamard division and matrix multiplication in one procedure in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1407319#M33522</link>
    <description>&lt;P&gt;Hey everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am currently optimising code that performs a series of Hadamard (element-wise)&amp;nbsp; divisions (1 ./ matrix) and matrix multiplications.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;C = A[1 ⊘ B]
1, B ∈ R^d×d
A ∈ R^d×d&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently, I implement the calculation in two steps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;vdDiv(d*d, mOnes, B, temp_M);
// mOnes is a matrix with all elements equal 1

cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans,
                    d, d, d, alpha, A, d, temp_M, d, beta, C, d);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to avoid doing d^2+ d^3 operations and do instead just d^3 operations.&lt;/P&gt;
&lt;P&gt;In theory, both steps could be performed in one procedure by defining C as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;(c_ij) = a_i1 / b_1j + a_2i / b_2j + ... + a_id / b_dj&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to implement this in MKL efficiently?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks and best,&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
    <pubDate>Wed, 10 Aug 2022 07:52:49 GMT</pubDate>
    <dc:creator>Chris_Mayer</dc:creator>
    <dc:date>2022-08-10T07:52:49Z</dc:date>
    <item>
      <title>Combining Hadamard division and matrix multiplication in one procedure</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1407319#M33522</link>
      <description>&lt;P&gt;Hey everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am currently optimising code that performs a series of Hadamard (element-wise)&amp;nbsp; divisions (1 ./ matrix) and matrix multiplications.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;C = A[1 ⊘ B]
1, B ∈ R^d×d
A ∈ R^d×d&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently, I implement the calculation in two steps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;vdDiv(d*d, mOnes, B, temp_M);
// mOnes is a matrix with all elements equal 1

cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans,
                    d, d, d, alpha, A, d, temp_M, d, beta, C, d);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to avoid doing d^2+ d^3 operations and do instead just d^3 operations.&lt;/P&gt;
&lt;P&gt;In theory, both steps could be performed in one procedure by defining C as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;(c_ij) = a_i1 / b_1j + a_2i / b_2j + ... + a_id / b_dj&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to implement this in MKL efficiently?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks and best,&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 07:52:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1407319#M33522</guid>
      <dc:creator>Chris_Mayer</dc:creator>
      <dc:date>2022-08-10T07:52:49Z</dc:date>
    </item>
    <item>
      <title>Re:Combining Hadamard division and matrix multiplication in one procedure</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1407582#M33524</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;&lt;P&gt;Could you please refer to the below link which contains the details of some functions of MKL which i guess might help you?&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/blas-and-sparse-blas-routines/blas-like-extensions.html" target="_blank"&gt;https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/blas-and-sparse-blas-routines/blas-like-extensions.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/blas-and-sparse-blas-routines/blas-like-extensions/cblas-gemm-batch.html" target="_blank"&gt;https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/blas-and-sparse-blas-routines/blas-like-extensions/cblas-gemm-batch.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vidya.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Aug 2022 12:33:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1407582#M33524</guid>
      <dc:creator>VidyalathaB_Intel</dc:creator>
      <dc:date>2022-08-11T12:33:48Z</dc:date>
    </item>
    <item>
      <title>Re:Combining Hadamard division and matrix multiplication in one procedure</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1409022#M33545</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;As we haven't heard back from you, could you please provide us with an update regarding your issue?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vidya.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Aug 2022 05:29:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1409022#M33545</guid>
      <dc:creator>VidyalathaB_Intel</dc:creator>
      <dc:date>2022-08-18T05:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: Combining Hadamard division and matrix multiplication in one procedure</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1409066#M33547</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Vidya,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you for your reply!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I could not find any function in the documentation that provides the operation that I am seeking. Could you point me to a specific function that might solve the problem?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Many thanks and best,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 08:27:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1409066#M33547</guid>
      <dc:creator>Chris_Mayer</dc:creator>
      <dc:date>2022-08-18T08:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Combining Hadamard division and matrix multiplication in one procedure</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1409178#M33550</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The links in the earlier post lists out the routines which are extensions of BLAS that are available in MKL (i guess there is no direct routine available in MKL which combines both the cases hadamard division and gemm operation and as I mentioned you can refer to the extended functionalities of BLAS)&lt;/P&gt;
&lt;P&gt;They may not exactly match the use case of yours but might help you for further stages.&lt;/P&gt;
&lt;P&gt;Maybe using this function cblas-gemm-batch might help you but not sure &lt;A href="https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/blas-and-sparse-blas-routines/blas-like-extensions/cblas-gemm-batch.html" target="_blank" rel="noopener"&gt;https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/blas-and-sparse-blas-routines/blas-like-extensions/cblas-gemm-batch.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Vidya.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Aug 2022 15:33:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1409178#M33550</guid>
      <dc:creator>VidyalathaB_Intel</dc:creator>
      <dc:date>2022-08-18T15:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: Combining Hadamard division and matrix multiplication in one procedure</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1409804#M33554</link>
      <description>&lt;P&gt;Hi Vidya,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;It seems that it is not possible to perform the exact operation that I envisioned. I will try to find a work around. The question is answered for me, thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 08:15:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1409804#M33554</guid>
      <dc:creator>Chris_Mayer</dc:creator>
      <dc:date>2022-08-22T08:15:49Z</dc:date>
    </item>
    <item>
      <title>Re:Combining Hadamard division and matrix multiplication in one procedure</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1409821#M33555</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;gt;The question is answered for me,&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Thanks for the confirmation.&lt;/P&gt;&lt;P&gt;Please post a new question if you need any additional assistance from Intel as this thread will no longer be monitored.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Have a Nice Day!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vidya.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Aug 2022 09:44:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Combining-Hadamard-division-and-matrix-multiplication-in-one/m-p/1409821#M33555</guid>
      <dc:creator>VidyalathaB_Intel</dc:creator>
      <dc:date>2022-08-22T09:44:23Z</dc:date>
    </item>
  </channel>
</rss>

