<?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: Intializing an array in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intializing-an-array/m-p/885236#M9989</link>
    <description>I used the value n=1000 just as an example. In my actual code, it may be quite large, such as 1 million or 1 billion.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 20 May 2008 22:11:44 GMT</pubDate>
    <dc:creator>janzz2k</dc:creator>
    <dc:date>2008-05-20T22:11:44Z</dc:date>
    <item>
      <title>Intializing an array</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intializing-an-array/m-p/885234#M9987</link>
      <description>Hi,&lt;BR /&gt; Suppose I have an array of doubles created using malloc. Is there an efficient (vectorized + optimised) way to set some or all its elements to a specific value, say 1.0? I want to avoid using a for loop to do this element by element. In other words, is there a more optimal way to do the following:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; int n=1000;&lt;BR /&gt; double *x=(double *) malloc( n*sizeof(double));&lt;BR /&gt;&lt;BR /&gt;int p=20, q=40; &lt;BR /&gt;for (int i=p; i &amp;lt; q; ++ i) x&lt;I&gt;=1.0;&lt;BR /&gt;&lt;BR /&gt;return(0);&lt;BR /&gt;}&lt;BR /&gt;&lt;/I&gt;</description>
      <pubDate>Tue, 20 May 2008 19:10:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intializing-an-array/m-p/885234#M9987</guid>
      <dc:creator>janzz2k</dc:creator>
      <dc:date>2008-05-20T19:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Intializing an array</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intializing-an-array/m-p/885235#M9988</link>
      <description>&lt;P&gt;Compilation of your code by an auto-vectorizing compiler may give excellent results. Your loop is probably not long enough for icc #pragma vector nontemporal tobe useful. If you have taken care to get a 16-byte aligned allocation (should be the default on 64-bit OS), icc #pragma vector aligned should speed it up.&lt;/P&gt;
&lt;P&gt;You probably spend more time in malloc() than in the initialization, for such a short loop.&lt;/P&gt;
&lt;P&gt;If you don't want to use an auto-vectorizing compiler, you should be able to show an advantage from compiling with SSE intrinsics. It seems like overkill on a simple example like this.&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2008 21:06:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intializing-an-array/m-p/885235#M9988</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2008-05-20T21:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Intializing an array</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intializing-an-array/m-p/885236#M9989</link>
      <description>I used the value n=1000 just as an example. In my actual code, it may be quite large, such as 1 million or 1 billion.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 20 May 2008 22:11:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Intializing-an-array/m-p/885236#M9989</guid>
      <dc:creator>janzz2k</dc:creator>
      <dc:date>2008-05-20T22:11:44Z</dc:date>
    </item>
  </channel>
</rss>

