<?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 Array Notation :  passing array to function in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Array-Notation-passing-array-to-function/m-p/740538#M232</link>
    <description>&lt;ADDRESS&gt;Hello Paul,&lt;BR /&gt; I am not sure if you are aware but this website has the entire Cilk Plus language specification: &lt;A href="http://software.intel.com/en-us/articles/intel-cilk-plus-specification/"&gt;http://software.intel.com/en-us/articles/intel-cilk-plus-specification/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The Array-triplets are representedusing the following sytax&lt;BR /&gt;&lt;BR /&gt;Array [&lt;START_INDEX&gt; &lt;COLON&gt; &lt;LENGTH&gt; &lt;COLON&gt; &lt;STRIDE&gt;]&lt;BR /&gt;&lt;BR /&gt;For example, Array[0:5:2] implies we are going to touch A[0], A[2], A[4], A[6], A[8]&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I hope this helps!&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Balaji V. Iyer.&lt;/STRIDE&gt;&lt;/COLON&gt;&lt;/LENGTH&gt;&lt;/COLON&gt;&lt;/START_INDEX&gt;&lt;/ADDRESS&gt;</description>
    <pubDate>Mon, 24 Oct 2011 03:24:20 GMT</pubDate>
    <dc:creator>Balaji_I_Intel</dc:creator>
    <dc:date>2011-10-24T03:24:20Z</dc:date>
    <item>
      <title>Array Notation :  passing array to function</title>
      <link>https://community.intel.com/t5/Software-Archive/Array-Notation-passing-array-to-function/m-p/740537#M231</link>
      <description>Dear all,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;recently I started to use the Array Notation in the new compiler 12.1.0, which is amazing, and I am glad to finally have (dynamic) multi-dimensional array support in C++ too :).&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Unfortunately documentationis still a bit rare, so I am confused about following code (here an example)&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV id="_mcePaste"&gt;*****************&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;DIV id="_mcePaste"&gt;#include &lt;COMPLEX&gt;&lt;/COMPLEX&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;#include &lt;IOSTREAM&gt;&lt;/IOSTREAM&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;typedef std::complex&lt;DOUBLE&gt; cmplxd;&lt;/DOUBLE&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;typedef cmplxd(*A2c)[];&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;int Nx, Ny, NxLlD, NyLlD;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;void goCilk(cmplxd A[NxLlD,Nx][NyLlD,Ny])&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;{&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;  for(int x = NxLlD; x &amp;lt;= NxLlD+Nx-1; x++) { for(int y = NyLlD; y &amp;lt;= NyLlD+Ny-1; y++) {&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;      &lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;      std::cout &amp;lt;&amp;lt; x &amp;lt;&amp;lt; " " &amp;lt;&amp;lt; y &amp;lt;&amp;lt; " " &amp;lt;&amp;lt; A&lt;X&gt;&lt;Y&gt; &amp;lt;&amp;lt; std::endl; &lt;/Y&gt;&lt;/X&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;  }}&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;}&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;int main()&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;{&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;  NxLlD = 1; Nx = 4;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;  NyLlD = 1; Ny = 3;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;  cmplxd *A = new cmplxd[Nx*Ny];&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;  for(int x = 0; x &amp;lt; Nx*Ny; x++) A&lt;X&gt; = 1.;&lt;/X&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;  A[0]=2.;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; &lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;  goCilk((A2c) A);&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;}&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;*****************&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The code compiles and runs without error. Now concerning the "cmplxd goCilk(cmplxd A[NxLlD,Nx][NyLlD,Ny])" functions, I tought that A[NxLlD, Nx] defines the starting value, and the length of this dimension. Similar like fortran has with A(NxLlD:NxLlD+Nx-1), but it seems that even tough the code compiles, the NxLlD value has no meaning as I checked with using some random numbers for NxLlD/NyLlD.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Could you please point me to the documentation, where I can find out the correct syntax ?&lt;/DIV&gt;&lt;DIV&gt;And is it actually possible todefine an offset to an array (only in notation like in Fortran), e.g. right now A[0][0] points to the first value, but I would like thatA[NxLlD][NyLlD] to point to the lowest value (it makes life far more simpler for MPI (domain decomposition) programs).&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks a lot and best wishes,&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Paul&lt;/DIV&gt;</description>
      <pubDate>Mon, 24 Oct 2011 03:00:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Array-Notation-passing-array-to-function/m-p/740537#M231</guid>
      <dc:creator>sheliak</dc:creator>
      <dc:date>2011-10-24T03:00:20Z</dc:date>
    </item>
    <item>
      <title>Array Notation :  passing array to function</title>
      <link>https://community.intel.com/t5/Software-Archive/Array-Notation-passing-array-to-function/m-p/740538#M232</link>
      <description>&lt;ADDRESS&gt;Hello Paul,&lt;BR /&gt; I am not sure if you are aware but this website has the entire Cilk Plus language specification: &lt;A href="http://software.intel.com/en-us/articles/intel-cilk-plus-specification/"&gt;http://software.intel.com/en-us/articles/intel-cilk-plus-specification/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The Array-triplets are representedusing the following sytax&lt;BR /&gt;&lt;BR /&gt;Array [&lt;START_INDEX&gt; &lt;COLON&gt; &lt;LENGTH&gt; &lt;COLON&gt; &lt;STRIDE&gt;]&lt;BR /&gt;&lt;BR /&gt;For example, Array[0:5:2] implies we are going to touch A[0], A[2], A[4], A[6], A[8]&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I hope this helps!&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Balaji V. Iyer.&lt;/STRIDE&gt;&lt;/COLON&gt;&lt;/LENGTH&gt;&lt;/COLON&gt;&lt;/START_INDEX&gt;&lt;/ADDRESS&gt;</description>
      <pubDate>Mon, 24 Oct 2011 03:24:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Array-Notation-passing-array-to-function/m-p/740538#M232</guid>
      <dc:creator>Balaji_I_Intel</dc:creator>
      <dc:date>2011-10-24T03:24:20Z</dc:date>
    </item>
    <item>
      <title>Array Notation :  passing array to function</title>
      <link>https://community.intel.com/t5/Software-Archive/Array-Notation-passing-array-to-function/m-p/740539#M233</link>
      <description>&lt;DIV id="_mcePaste"&gt;Dear Balaji,&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;thanks a lot for your quick reply. Yes, I know about the specifictation, I looked through it and couldn't find&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;anything related. So what confused me,is that&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;WORKS : void goCilk(cmplxd A[NxLlD,Nx][NyLlD,Ny])  (&amp;lt;--- note the comma NxLLD, Nx&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;behaviour is not documented, and seems not be a valid feature, yet the compiler accepts it without warning.&lt;/DIV&gt;&lt;DIV&gt;Is this a bug or am I missing somehting ?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks&lt;/DIV&gt;</description>
      <pubDate>Mon, 24 Oct 2011 03:53:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Array-Notation-passing-array-to-function/m-p/740539#M233</guid>
      <dc:creator>sheliak</dc:creator>
      <dc:date>2011-10-24T03:53:34Z</dc:date>
    </item>
    <item>
      <title>Array Notation :  passing array to function</title>
      <link>https://community.intel.com/t5/Software-Archive/Array-Notation-passing-array-to-function/m-p/740540#M234</link>
      <description>also, it has a pretty different behavirout compared to Fortran,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Assuming I pass an array in Fortran, I define the index position of this array. E.g.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;subroutine (A)&lt;/DIV&gt;&lt;DIV&gt;  double precison :: A(Start_X:End_X, Start_Y:End_Y)&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;in the function deklaration. While cilk plus seems to always assume that my index starts from A[0].&lt;/DIV&gt;&lt;DIV&gt;Is there a way to tell cilk where to start counting ?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;E.g.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;double (int Start_X, int Length_X, A[Start_X, Length_X])&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;calling Start_X=5, and Length_X=10, then A[5] refers to the zeroth element (A'[0] in the previous view).&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;In Fortran it is pretty easy, in Cilk I hope this feature exists, or may be included ?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 24 Oct 2011 04:08:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Array-Notation-passing-array-to-function/m-p/740540#M234</guid>
      <dc:creator>sheliak</dc:creator>
      <dc:date>2011-10-24T04:08:18Z</dc:date>
    </item>
  </channel>
</rss>

