<?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: cross product function in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908468#M11906</link>
    <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;I don't see cross product either, it might be because it's only defined for 3 dimensions, while most MKL functions are for more general n-dimensions.&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;You might look at the wikipedia page for cross product, under "Conversion to Matrix Multiplication". You can store one vector as a 3x3 matrix then do a matrix-vector multiply using one of the BLAS level 2 functions in MKL.&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;For rotation matrices, can't you just construct them yourself then use MKL to apply them?&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;If you're after speed, I'd look to see if graphics cards can do these things in hardware.&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/279477"&gt;kooka&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;is the first time I try to use MKL, im confused and kind of frustrated because I am searching a cross product and ROTATION MATRIX subrutine and cant find it, i will thank if someone can tell me what MKL function can help me.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;</description>
    <pubDate>Sun, 10 May 2009 02:39:00 GMT</pubDate>
    <dc:creator>crispybits</dc:creator>
    <dc:date>2009-05-10T02:39:00Z</dc:date>
    <item>
      <title>cross product function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908467#M11905</link>
      <description>is the first time I try to use MKL, im confused and kind of frustrated because I am searching a cross product and ROTATION MATRIX subrutine and cant find it, i will thank if someone can tell me what MKL function can help me.&lt;BR /&gt;&lt;BR /&gt;Regards!</description>
      <pubDate>Fri, 08 May 2009 03:52:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908467#M11905</guid>
      <dc:creator>kooka</dc:creator>
      <dc:date>2009-05-08T03:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: cross product function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908468#M11906</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;I don't see cross product either, it might be because it's only defined for 3 dimensions, while most MKL functions are for more general n-dimensions.&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;You might look at the wikipedia page for cross product, under "Conversion to Matrix Multiplication". You can store one vector as a 3x3 matrix then do a matrix-vector multiply using one of the BLAS level 2 functions in MKL.&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;For rotation matrices, can't you just construct them yourself then use MKL to apply them?&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;If you're after speed, I'd look to see if graphics cards can do these things in hardware.&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/279477"&gt;kooka&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;is the first time I try to use MKL, im confused and kind of frustrated because I am searching a cross product and ROTATION MATRIX subrutine and cant find it, i will thank if someone can tell me what MKL function can help me.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;</description>
      <pubDate>Sun, 10 May 2009 02:39:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908468#M11906</guid>
      <dc:creator>crispybits</dc:creator>
      <dc:date>2009-05-10T02:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: cross product function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908469#M11907</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/279477"&gt;kooka&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;is the first time I try to use MKL, im confused and kind of frustrated because I am searching a cross product and ROTATION MATRIX subrutine and cant find it, i will thank if someone can tell me what MKL function can help me.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;kooka,&lt;BR /&gt;I am just interested  what are the typical sizes of vectors and matrices you are working with? &lt;BR /&gt;--Gennady</description>
      <pubDate>Sun, 10 May 2009 18:27:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908469#M11907</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2009-05-10T18:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: cross product function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908470#M11908</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/279477"&gt;kooka&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;is the first time I try to use MKL, im confused and kind of frustrated because I am searching a cross product and ROTATION MATRIX subrutine and cant find it, i will thank if someone can tell me what MKL function can help me.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;If you are using C++, I wrote this code to construct a rotation matrix that makes a right-handed rotation about a normal vector.&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;Regards,&lt;/DIV&gt;
&lt;DIV&gt;Jay&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/DIV&gt;
&lt;DIV&gt;#include &lt;CMATH&gt;&lt;BR /&gt;#include &lt;IOSTREAM&gt;&lt;BR /&gt;&lt;BR /&gt;typedef float Real;&lt;BR /&gt;&lt;BR /&gt;// computes a 3x3 rotation matrix&lt;BR /&gt;void compute_R_3x3(Real *v, Real a, Real *R);&lt;BR /&gt;&lt;BR /&gt;// test program&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; // v is a normal vector that is the axis of rotation&lt;BR /&gt; Real v[3] = {0.0, 0.0, 1.0};&lt;BR /&gt; // a is the angle (in radians) that you rotate about v (right-handed)&lt;BR /&gt; Real a = (45.0/180.0)*acos(-1.0);&lt;BR /&gt; // 3x3 matrix (column-major) - pre-initialized for debug purposes&lt;BR /&gt; Real R[] = {99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9, 99.9};&lt;BR /&gt; // call the rotation matrix function&lt;BR /&gt; compute_R_3x3(v, a, R);&lt;BR /&gt; // output the matrix to console&lt;BR /&gt; for (int i=0; i&amp;lt;3; i++)  std::cout&amp;lt;&lt;R&gt;&lt;I&gt;&amp;lt;&amp;lt;'t'&amp;lt;&lt;R&gt;&lt;/R&gt; return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// computes a 3x3 rotation matrix&lt;BR /&gt;void compute_R_3x3(Real *v, Real a, Real *R)&lt;BR /&gt;{&lt;BR /&gt; const Real eijk[2] = {-1.0, 1.0};  // permutation value&lt;BR /&gt; const Real COSa=cos(a), SINa=sin(a);&lt;BR /&gt; for (int i=0; i&amp;lt;3; i++){&lt;BR /&gt; const double cv = (1.0 - COSa) * v&lt;I&gt;;&lt;BR /&gt; R&lt;I&gt;   = cv*v[0];&lt;BR /&gt; R[i+3] = cv*v[1];&lt;BR /&gt; R[i+6] = cv*v[2];&lt;BR /&gt; R[4*i] += COSa;&lt;BR /&gt; int j = (i&amp;amp;1)+(i!=2);  // computes cyclic permutation of i&lt;BR /&gt; R[i+3*j] -= SINa*v[3-i-j]*eijk[i-j+3*(j&amp;gt;i)-1];&lt;BR /&gt; j = (j&amp;amp;1)+(j!=2);   // compute(i-j+3*(j&amp;gt;i))-1s cyclic permutation of j&lt;BR /&gt; R[i+3*j] -= SINa*v[3-i-j]*eijk[i-j+3*(j&amp;gt;i)-1];&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/R&gt;&lt;/IOSTREAM&gt;&lt;/CMATH&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 11 May 2009 20:52:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908470#M11908</guid>
      <dc:creator>jay_oswald</dc:creator>
      <dc:date>2009-05-11T20:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: cross product function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908471#M11909</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/334681"&gt;Gennady Fedorov (Intel)&lt;/A&gt;&lt;/DIV&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;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;kooka,&lt;BR /&gt;I am just interested  what are the typical sizes of vectors and matrices you are working with? &lt;BR /&gt;--Gennady&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
3 size vector and 3 by 3 matrices&lt;BR /&gt;</description>
      <pubDate>Mon, 11 May 2009 21:20:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908471#M11909</guid>
      <dc:creator>kooka</dc:creator>
      <dc:date>2009-05-11T21:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: cross product function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908472#M11910</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/411557"&gt;kallog&lt;/A&gt;&lt;/DIV&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;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
thanks, i think it will help&lt;BR /&gt;</description>
      <pubDate>Mon, 11 May 2009 21:23:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908472#M11910</guid>
      <dc:creator>kooka</dc:creator>
      <dc:date>2009-05-11T21:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: cross product function</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908473#M11911</link>
      <description>&lt;BR /&gt;
&lt;P&gt;kooka,&lt;BR /&gt;this is very inefficient to use MKL for such small inputs because of MKL mainly oriented on the task size much bigger then 3x3 you are using.&lt;BR /&gt;I'd recommend you to use another library - &lt;STRONG&gt;Intel&lt;SUP&gt; Integrated Performance Primitives (Intel IPP), aka IPP.&lt;/SUP&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;
&lt;/P&gt;&lt;P&gt;Please refer to the ippmman.pdf ( Small matrix ) manual and you can find there all needed routines.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The main advantage of IPP's small matrix functionality - these functions is highly optimized for the inputs you needed.&lt;BR /&gt;--Gennady&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2009 04:51:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/cross-product-function/m-p/908473#M11911</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2009-05-18T04:51:30Z</dc:date>
    </item>
  </channel>
</rss>

