<?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 Subroutine argument values in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Subroutine-argument-values/m-p/775213#M24704</link>
    <description>Please show the contents of mod_A. It is required that the caller of rank1 and the caller of sub1 have explicit interfaces for those routines visible, because you have deferred-shape and pointer array arguments. In particular, if rank1 does not see a correct explicit interface for sub1, arguments X and M_rank will be incorrectly passed. I can tell by context that kra is a POINTER array, so it's ok that far, but I'm not seeing the explicit interfaces. It is also clear that these are separate procedures and not in a module.</description>
    <pubDate>Thu, 02 Aug 2012 18:20:02 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2012-08-02T18:20:02Z</dc:date>
    <item>
      <title>Subroutine argument values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Subroutine-argument-values/m-p/775210#M24701</link>
      <description>I have a subroutine, rank1, that calls another subroutine, sub1 like so: call sub1(m, n, A, kra), and Subroutine sub1(m, n, X, M_rank). Am I wrong in thinking that after sub1 is called, if I am to print kra, which is an array,in rank1 it should be the same values as M_rank at the very end of sub1? Because this is not the case and I cannot figure out the reason for this. Or maybe I am way off base and I just don't understand how this works. Thanks</description>
      <pubDate>Wed, 01 Aug 2012 18:51:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Subroutine-argument-values/m-p/775210#M24701</guid>
      <dc:creator>Kate_Johnson</dc:creator>
      <dc:date>2012-08-01T18:51:08Z</dc:date>
    </item>
    <item>
      <title>Subroutine argument values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Subroutine-argument-values/m-p/775211#M24702</link>
      <description>Kate, we'd at least need to see the declarations of all of these arguments, both in rank1 and sub1. Also it would be helpful to know how the values are different - does it seem that they are "shifted" to the wrong element number, or are the values wildly different? Most helpful would be a small but complete test case that demonstrates the problem. If you can't give us a full test case, please show the actual code and not "like" code.</description>
      <pubDate>Wed, 01 Aug 2012 20:05:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Subroutine-argument-values/m-p/775211#M24702</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2012-08-01T20:05:58Z</dc:date>
    </item>
    <item>
      <title>Subroutine argument values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Subroutine-argument-values/m-p/775212#M24703</link>
      <description>Got it, here's the code:&lt;BR /&gt;&lt;P&gt;Subroutine rank1(m, n, A, B)&lt;/P&gt;&lt;P&gt;use Mod_A&lt;/P&gt;&lt;P&gt;Integer m, n, i, j, k&lt;/P&gt;&lt;P&gt;Real(8), Dimension (:,:) :: A(m,n), B(m,n)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c This program first finds out the rank matrix KR of A, then &lt;/P&gt;&lt;P&gt;c re-arrange the the elements in matrix B according to this &lt;/P&gt;&lt;P&gt;c rank matrix, so A and B will have the rank correlation matrix.&lt;/P&gt;&lt;P&gt;c ******************************************************************&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;P&gt;Allocate(kra(m,n))&lt;/P&gt;&lt;P&gt;Allocate(krb(m,n))&lt;/P&gt;&lt;P&gt;Call sub1(m, n, A, kra)&lt;/P&gt;&lt;P&gt;print*, 'kra(1,1)=',kra(1,1)&lt;/P&gt;&lt;P&gt;! print*, 'size of kra=',size(kra)&lt;/P&gt;&lt;P&gt;! print*, 'inbetween'&lt;/P&gt;&lt;P&gt;Call sub1(m, n, B, krb)&lt;/P&gt;&lt;P&gt;print*, 'krb(1,1)=',krb(1,1)&lt;/P&gt;&lt;P&gt;! print*, 'size of krb=',size(krb)&lt;/P&gt;&lt;P&gt;print*, 'Done'&lt;/P&gt;&lt;P&gt;Deallocate (C)&lt;/P&gt;&lt;P&gt;Allocate(C(m,n))&lt;/P&gt;&lt;P&gt;print*, 'kra(1,1)=',kra(1,1)&lt;/P&gt;&lt;P&gt;print*, 'krb(1,1)=',krb(1,1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do 500 k=1,n&lt;/P&gt;&lt;P&gt;do 600 i=1, m&lt;/P&gt;&lt;P&gt;! C(krb(i,k),k)=B(i,k)&lt;/P&gt;&lt;P&gt;600 continue&lt;/P&gt;&lt;P&gt;do 610 i=1,m&lt;/P&gt;&lt;P&gt;! B(i,k)=C(kra(i,k),k) &lt;/P&gt;&lt;P&gt;610 continue&lt;/P&gt;&lt;P&gt;500 continue&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;P&gt;Deallocate(kra)&lt;/P&gt;&lt;P&gt;Deallocate(krb)&lt;/P&gt;&lt;P&gt;Return&lt;/P&gt;&lt;P&gt;End&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;P&gt;c Sub1 is the program to find out the rank matrix M_rank for X matrix&lt;/P&gt;&lt;P&gt;c *********************************************************************&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Subroutine sub1(m, n, X, M_rank)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use Mod_A&lt;/P&gt;&lt;P&gt;Real(8), Dimension(:,:), Target :: X(m,n)&lt;/P&gt;&lt;P&gt;Integer, dimension(:,:), Pointer :: M_rank(:,:)&lt;/P&gt;&lt;P&gt;allocate(M_rank(m,n))&lt;/P&gt;&lt;P&gt;do 10 i=1, m&lt;/P&gt;&lt;P&gt;do 10 j=1,n&lt;/P&gt;&lt;P&gt;M_rank(i,j)=1 &lt;/P&gt;&lt;P&gt;10 continue &lt;/P&gt;&lt;P&gt;do 100 k=1, n&lt;/P&gt;&lt;P&gt;do 200 i=1, m&lt;/P&gt;&lt;P&gt;do 200 j=i+1, m&lt;/P&gt;&lt;P&gt;if (x(i,k) .GT. x(j,k)) then&lt;/P&gt;&lt;P&gt;M_rank(i,k)= M_rank(i,k)+1&lt;/P&gt;&lt;P&gt;M_rank(j,k)= M_rank(j,k)-1&lt;/P&gt;&lt;P&gt;endif&lt;/P&gt;&lt;P&gt;200 continue&lt;/P&gt;&lt;P&gt;100 continue&lt;/P&gt;&lt;P&gt;print*, 'M_rank(1,1)=',M_rank(1,1)&lt;/P&gt;&lt;P&gt;! print*, 'size of M_rank=',size(M_rank)&lt;/P&gt;&lt;P&gt;! print*, 'M_rank 10=',M_rank(1:10,1:10)&lt;/P&gt;&lt;P&gt;! pause&lt;/P&gt;&lt;P&gt;c&lt;/P&gt;&lt;P&gt;Return &lt;/P&gt;&lt;P&gt;End &lt;/P&gt;</description>
      <pubDate>Thu, 02 Aug 2012 16:23:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Subroutine-argument-values/m-p/775212#M24703</guid>
      <dc:creator>Kate_Johnson</dc:creator>
      <dc:date>2012-08-02T16:23:54Z</dc:date>
    </item>
    <item>
      <title>Subroutine argument values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Subroutine-argument-values/m-p/775213#M24704</link>
      <description>Please show the contents of mod_A. It is required that the caller of rank1 and the caller of sub1 have explicit interfaces for those routines visible, because you have deferred-shape and pointer array arguments. In particular, if rank1 does not see a correct explicit interface for sub1, arguments X and M_rank will be incorrectly passed. I can tell by context that kra is a POINTER array, so it's ok that far, but I'm not seeing the explicit interfaces. It is also clear that these are separate procedures and not in a module.</description>
      <pubDate>Thu, 02 Aug 2012 18:20:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Subroutine-argument-values/m-p/775213#M24704</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2012-08-02T18:20:02Z</dc:date>
    </item>
  </channel>
</rss>

