<?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 I wish to pass an array in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Implicit-array-lengths/m-p/1039121#M112587</link>
    <description>&lt;P&gt;I wish to pass an array length implicitly, for example:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;real &amp;nbsp;A(12,12),avg&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;call average(a(3:8,5),avg)&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;in this case AVERAGE would take the average of 6 elements of column 5.&lt;/P&gt;

&lt;P&gt;Or we could have&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;real c(5)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;call average(c,avg)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Where we take the average of all 5 elements of array C.&lt;/P&gt;

&lt;P&gt;How would one do this without having to SAY HOW MANY elements to process?&lt;/P&gt;

&lt;P&gt;Actually AVERAGE could be a function, and I suppose there is one already in the math library.&lt;/P&gt;

&lt;P&gt;This is just an example - - -&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jun 2014 17:58:00 GMT</pubDate>
    <dc:creator>WSinc</dc:creator>
    <dc:date>2014-06-12T17:58:00Z</dc:date>
    <item>
      <title>Implicit array lengths</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Implicit-array-lengths/m-p/1039120#M112586</link>
      <description>&lt;P&gt;sdadasd&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2014 17:51:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Implicit-array-lengths/m-p/1039120#M112586</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2014-06-12T17:51:30Z</dc:date>
    </item>
    <item>
      <title>I wish to pass an array</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Implicit-array-lengths/m-p/1039121#M112587</link>
      <description>&lt;P&gt;I wish to pass an array length implicitly, for example:&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;real &amp;nbsp;A(12,12),avg&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;call average(a(3:8,5),avg)&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;in this case AVERAGE would take the average of 6 elements of column 5.&lt;/P&gt;

&lt;P&gt;Or we could have&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;real c(5)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;call average(c,avg)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Where we take the average of all 5 elements of array C.&lt;/P&gt;

&lt;P&gt;How would one do this without having to SAY HOW MANY elements to process?&lt;/P&gt;

&lt;P&gt;Actually AVERAGE could be a function, and I suppose there is one already in the math library.&lt;/P&gt;

&lt;P&gt;This is just an example - - -&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2014 17:58:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Implicit-array-lengths/m-p/1039121#M112587</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2014-06-12T17:58:00Z</dc:date>
    </item>
    <item>
      <title>This is done using assumed</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Implicit-array-lengths/m-p/1039122#M112588</link>
      <description>&lt;P&gt;This is done using assumed-shape arrays, which require an explicit interface. An example:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module myfuncs
contains
subroutine average (a,avg)
real, intent(in) :: a(:,:)
real, intent(out) :: avg
avg = sum(array)/real(size(array))
end subroutine average
end module myfuncs&lt;/PRE&gt;

&lt;P&gt;You would then add "use myfuncs" to make the declaration visible. Note that this example requires a two-dimension array. In order to allow arrays of other dimensions, you'd need to define one routine for each number of dimensions and then have a generic declaration to allow the compiler to pick.&lt;/P&gt;

&lt;P&gt;Fortran 2015 will have a new feature called assumed-rank where you can have one routine accept an array of any rank (number of dimensions), but there are severe restrictions on what you can do with the argument when you get it. We don't support this feature yet.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2014 18:44:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Implicit-array-lengths/m-p/1039122#M112588</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-06-12T18:44:40Z</dc:date>
    </item>
  </channel>
</rss>

