<?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 OK, I took the source code in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052635#M115528</link>
    <description>&lt;P&gt;OK, I took the source code from REPEAT OFFENDER and modified it using the RESULT keyword.&lt;/P&gt;

&lt;P&gt;I get a much cleaner interface from that. None of the references I looked at really go into this in much detail.&lt;/P&gt;

&lt;P&gt;see attached code. This looks like a good way to go.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jan 2015 19:36:35 GMT</pubDate>
    <dc:creator>WSinc</dc:creator>
    <dc:date>2015-01-15T19:36:35Z</dc:date>
    <item>
      <title>Q re output arrays from functions ?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052624#M115517</link>
      <description>&lt;P&gt;This could easily be done with a subroutine, with no problems - -&lt;/P&gt;

&lt;P&gt;I have three variable length arrays here,&lt;/P&gt;

&lt;P&gt;I want to add the contents of arrays A and B to get array C.&lt;/P&gt;

&lt;P&gt;The zeroth element tells the number of items in the array.&lt;/P&gt;

&lt;P&gt;The problem is - I cant get the compiler to work re the &lt;STRONG&gt;calling routine.&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I tried to keep this as simple as possible - there must be a special trick to make it compile properly ?&lt;/P&gt;

&lt;P&gt;Maybe the compiler is not meant to do this? However, in the CALLED routine it compiles with no problem.&lt;/P&gt;

&lt;P&gt;any clues ? See attached source file.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2015 22:58:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052624#M115517</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2015-01-14T22:58:59Z</dc:date>
    </item>
    <item>
      <title>Something got screwed up.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052625#M115518</link>
      <description>&lt;P&gt;Something got screwed up.&lt;/P&gt;

&lt;P&gt;Try this download.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2015 23:14:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052625#M115518</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2015-01-14T23:14:17Z</dc:date>
    </item>
    <item>
      <title>Anyway, I get an error #6413</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052626#M115519</link>
      <description>&lt;P&gt;Anyway, I get an error #6413 when I compile this.&lt;/P&gt;

&lt;P&gt;And I tried typing XADD in the calling routine as XADD(0:1000), but that doesn't work either.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;By the way, is there a way to examine the contents of attached files without trying to compile them?&lt;/P&gt;

&lt;P&gt;If they have an extension of F90 I get a message, "cannot execute this command." when i open them.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have to download them first, then use a text editor, otherwise.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2015 23:26:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052626#M115519</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2015-01-14T23:26:48Z</dc:date>
    </item>
    <item>
      <title>No trick will enable you to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052627#M115520</link>
      <description>&lt;P&gt;No trick will enable you to compile incorrectly written code. To write correct code and to understand the compiler's error messages you will have to read books and manuals and learn at least those parts of the programming language that you wish to use in your programs.&lt;/P&gt;

&lt;P&gt;Your main program declares the function to have the type scalar integer. Your function subprogram, likewise, declares "xadd" to be a scalar integer. Later, you use xadd with subscripts, which you cannot use on a scalar variable.&lt;/P&gt;

&lt;P&gt;To reference an external function whose result type is not scalar, you are required to make available an explicit interface in the subprogram/main program containing the reference.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2015 23:31:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052627#M115520</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2015-01-14T23:31:00Z</dc:date>
    </item>
    <item>
      <title>The whole purpose of the is</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052628#M115521</link>
      <description>&lt;P&gt;The whole purpose of the is post was to figure out the "correct" way to do this -&lt;/P&gt;

&lt;P&gt;I have several text books on this topic, but they are woefully inadequate about explaining this -&amp;nbsp;&lt;/P&gt;

&lt;P&gt;anyway, you can see where I did type XADD as an ARRAY in the called routine, and I do use subscripts there&lt;/P&gt;

&lt;P&gt;as well. No complaints from the compiler. see quote #3 above.&lt;/P&gt;

&lt;P&gt;and when I type it&amp;nbsp;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;in the &lt;STRONG&gt;calling routine as an array,&lt;/STRONG&gt; it wont compile that either, as I mentioned above.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Maybe someone has a less&lt;STRONG&gt; condescending, accusatory, and more intelligent reply?&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Maybe there is an article about this somewhere?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 00:18:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052628#M115521</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2015-01-15T00:18:56Z</dc:date>
    </item>
    <item>
      <title>Your program is a long way</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052629#M115522</link>
      <description>&lt;P&gt;Your program is a long way from working. First off, you need IMPLICIT NONE in all program units to handle carelessly mismatched variable names. Then, since your function returns something that F77 could not (i.e. an array result) it needs its interface to be explicit in the caller. Also standard Fortran doesn't zero out arrays for you so you have to give them initial values yourself somehow. And the array assignment that captures the result of invocation of xadd is particularly problematic because function xadd doesn't know the true extents of its inputs because they are assumed size arrays (assumed shape arrays would have been a better fit for your usage) so either c has to be allocatable (but then your result ends up starting at index 1 instead of index 0) or you have to invoke xadd twice to get its specifications and value or you have to compute the size of the result separately, which is what I did.&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module M
&amp;nbsp; implicit none
&amp;nbsp; contains
&amp;nbsp;&amp;nbsp;&amp;nbsp; function xadd(p,q)
&amp;nbsp;&amp;nbsp;&amp;nbsp; integer p(0:*),q(0:*),ip,np,nq,nx,ix
&amp;nbsp;&amp;nbsp;&amp;nbsp; integer xadd(0:max(p(0),q(0)))
&amp;nbsp;&amp;nbsp;&amp;nbsp; np=p(0)
&amp;nbsp;&amp;nbsp;&amp;nbsp; nq=q(0)
&amp;nbsp;&amp;nbsp;&amp;nbsp; nx=ubound(xadd,1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; do ix=1,nx
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xadd(ix)=p(ix)+q(ix)
&amp;nbsp;&amp;nbsp;&amp;nbsp; enddo
&amp;nbsp;&amp;nbsp;&amp;nbsp; xadd(0)=nx
&amp;nbsp;&amp;nbsp;&amp;nbsp; end function
end module M

&amp;nbsp; use M
&amp;nbsp; implicit none
&amp;nbsp; integer a(0:1000),b(0:1000),c(0:1000)
&amp;nbsp; integer i
&amp;nbsp; a(0) = 13
&amp;nbsp; a(1:a(0)) = [(i,i=1,a(0))]
&amp;nbsp; a(a(0)+1:) = 0
&amp;nbsp; b(0) = 17
&amp;nbsp; b(1:b(0)) = [(i**2,i=1,b(0))]
&amp;nbsp; b(b(0)+1:) = 0
&amp;nbsp; c(0:max(a(0),b(0)))=xadd(a,b)
&amp;nbsp; write(*,*) c(1:c(0))
&amp;nbsp; end
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 00:21:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052629#M115522</guid>
      <dc:creator>JVanB</dc:creator>
      <dc:date>2015-01-15T00:21:01Z</dc:date>
    </item>
    <item>
      <title>Well, what I gave originally</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052630#M115523</link>
      <description>&lt;P&gt;Well, what I gave originally was NOT supposed to be a running program, I simplified it &amp;nbsp;to illustrate&lt;/P&gt;

&lt;P&gt;the problems in compiling it.&lt;/P&gt;

&lt;P&gt;apparently I cannot just put the routines together and have VS&lt;/P&gt;

&lt;P&gt;figure out the interface?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;When I typed the arrays, routines, etc. correctly, I get MORE compiler errors.&lt;/P&gt;

&lt;P&gt;And it still is a mystery why I did not get a compiler error in the called routine.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;This came about from a situation where all the routines were subroutines.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;so I was pretty well committed in use the zeroth element of ALL the arrays.&lt;/P&gt;

&lt;P&gt;Well, let me play around with what you sent.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 00:46:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052630#M115523</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2015-01-15T00:46:42Z</dc:date>
    </item>
    <item>
      <title>OK, I played around with it -</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052631#M115524</link>
      <description>&lt;P&gt;OK, I played around with it -&lt;/P&gt;

&lt;P&gt;Works fine, but I was wondering why your &amp;nbsp;line 27 has to be so involved.&lt;/P&gt;

&lt;P&gt;after all, the &amp;nbsp;XADD routine is supposed to &lt;STRONG&gt;figure out the length of the output array,&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;so why is it necessary to do that separately?&lt;/P&gt;

&lt;P&gt;There are situations in the original code where the length of the output array is &lt;STRONG&gt;really complicated, &lt;/STRONG&gt;that's&lt;/P&gt;

&lt;P&gt;why I mention this.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Apparently I cannot just say&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;c=xadd(a,b)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;without getting a breakpoint error. No way around that?&lt;/P&gt;

&lt;P&gt;Maybe just using the subroutines is less involved in the long run?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;To illustrate: If i have signed integers in the arrays A and B, I can a result that is much shorter than&lt;/P&gt;

&lt;P&gt;either of them. If A has (3,17) in it, and B has (4,-17) in it, then the result is (7,0). So the output&lt;/P&gt;

&lt;P&gt;has only one number in it we need to carry further, so the length is ONE then, not two.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 01:40:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052631#M115524</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2015-01-15T01:40:00Z</dc:date>
    </item>
    <item>
      <title>Your original problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052632#M115525</link>
      <description>&lt;P&gt;Your original problem statement did not indicate that the result number of elements should truncate trailing zeros.&lt;/P&gt;

&lt;P&gt;Also not stated is if your outermost scope&amp;nbsp;array declarations, as used by a, b, c in the c=xadd(a,b) have a known fixed (parameter) size.&lt;/P&gt;

&lt;P&gt;integer, parameter :: MAX_ACCUMULATOR = 4096&lt;/P&gt;

&lt;P&gt;Then the parameter can be used by the common/module/program and the caller and callee with the used portion of the array stored in the 0'th index.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 13:47:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052632#M115525</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2015-01-15T13:47:09Z</dc:date>
    </item>
    <item>
      <title>Well, the original code did</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052633#M115526</link>
      <description>&lt;P&gt;Well, the original code &lt;STRONG&gt;did have logic to truncate the output array length&lt;/STRONG&gt; at the last non-zero position in the array.&lt;/P&gt;

&lt;P&gt;I was trying to simplify the examples I gave. Normally I did have a PARAMETER statement like you mention.&lt;/P&gt;

&lt;P&gt;I was wondering if the use of the RESULT keyword in the function header might simplify the interface?&lt;/P&gt;

&lt;P&gt;For example (and I have yet to experiment further):&lt;/P&gt;

&lt;P&gt;FUNCTION XADD(A,B) RESULT C&lt;/P&gt;

&lt;P&gt;integer A(0:*), B(0:*) , C(0:*)&lt;/P&gt;

&lt;P&gt;Instead of * I could just say 10000, or the PARAMETER like you suggested, to give an open-ended result.&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;The original code was pretty involved because I was using it to simulate numerical operations on very large integers.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Hundreds of digits long,&lt;/STRONG&gt; so we want to avoid operations on a lot of trailing zeros, In the older FORTRAN,&lt;/P&gt;

&lt;P&gt;I would carry the array lengths as separate integer variables, and all the array positions would begin with 1 not zero.&lt;/P&gt;

&lt;P&gt;Of course we would also have CARRY operations as well. Example:&lt;/P&gt;

&lt;P&gt;A= (9,9,9) so A(0)=3&lt;/P&gt;

&lt;P&gt;B=(9,9,8) so B(0)=3&lt;/P&gt;

&lt;P&gt;C=XADD(A,B) would give C=(1,9,9,7) and C(0)=4&lt;/P&gt;

&lt;P style="line-height: 19.5120010375977px;"&gt;If I add two sets of integers and there is &amp;nbsp;a CARRY, then I have to allow for one extra place in the result.&lt;/P&gt;

&lt;P&gt;This was extended for multiply and divide, and of course BORROW for subtract.&lt;/P&gt;

&lt;P&gt;Of course the numeric content of each cell could be a lot higher than just + or - 9. i.e. 0 to + or - 999999999&lt;/P&gt;

&lt;P&gt;Or even 2**N-1, so that the operations could be binary in places, i.e. shifts, AND, OR, etc.&lt;/P&gt;

&lt;P&gt;But that complicates the problem of DISPLAYING the results.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 18:10:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052633#M115526</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2015-01-15T18:10:36Z</dc:date>
    </item>
    <item>
      <title>Example for multiply:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052634#M115527</link>
      <description>&lt;P&gt;Example for multiply:&lt;/P&gt;

&lt;P&gt;A=(9,9) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;a(0)=2&lt;/P&gt;

&lt;P&gt;b=(9,9) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;b(0)=2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;This is the most extreme case.&lt;/P&gt;

&lt;P&gt;8 1&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp;8 1&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; 8 1&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8 &amp;nbsp;1&lt;/P&gt;

&lt;P&gt;--------------------&lt;/P&gt;

&lt;P&gt;9 &amp;nbsp; 8 &amp;nbsp; 0 &amp;nbsp;1&lt;/P&gt;

&lt;P&gt;The largest possible length for C would be A(0)+b(0), in this case = 4.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 18:17:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052634#M115527</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2015-01-15T18:17:42Z</dc:date>
    </item>
    <item>
      <title>OK, I took the source code</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052635#M115528</link>
      <description>&lt;P&gt;OK, I took the source code from REPEAT OFFENDER and modified it using the RESULT keyword.&lt;/P&gt;

&lt;P&gt;I get a much cleaner interface from that. None of the references I looked at really go into this in much detail.&lt;/P&gt;

&lt;P&gt;see attached code. This looks like a good way to go.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 19:36:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052635#M115528</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2015-01-15T19:36:35Z</dc:date>
    </item>
    <item>
      <title>Whoops - here is the source</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052636#M115529</link>
      <description>&lt;P&gt;Whoops - here is the source code:&lt;/P&gt;

&lt;P&gt;I do not test to see if the result is going to be shorter in this example.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 19:43:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052636#M115529</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2015-01-15T19:43:00Z</dc:date>
    </item>
    <item>
      <title>Now that you've got</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052637#M115530</link>
      <description>&lt;P&gt;Now that you've got everything working more or less to your satisfaction, the obvious thing to do is do tear everything up and start over from scratch! In your final version when you do the last assignment to c, 10001 elements will be copied no matter how many are actually nonzero. If instead you switched to a subroutine interface, the results could be placed in their ultimate destination as they are generated, so there would be no need to do all that copying provided that you knew&amp;nbsp;a reasonably good&amp;nbsp;upper bound on the size of the output when you started the operation. Probably I would change over to a user defined type so different types of things weren't mixed up in the same array.&lt;/P&gt;

&lt;P&gt;type MyBigInt&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; integer NUsed&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; integer Sign&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp; integer, allocatable ::&amp;nbsp;Data(:)&lt;/P&gt;

&lt;P&gt;end type MyBigInt&lt;/P&gt;

&lt;P&gt;Now when you are going to compute c = a+b, you know to allocate(c%Data(max(a%NUsed,b%NUsed)+1)) and then you can put the result in c%Data as you figure it out and then set c%NUsed and c%Sign appropriately.&amp;nbsp;All this could be taken care of inside subroutine xadd, so all your main code would see is call xadd(c,a,b) ! c = a+b&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 22:27:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052637#M115530</guid>
      <dc:creator>JVanB</dc:creator>
      <dc:date>2015-01-15T22:27:44Z</dc:date>
    </item>
    <item>
      <title>Also note, if you use user</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052638#M115531</link>
      <description>&lt;P&gt;Also note, if you use user defined types, you can also create operators for these types such that you can use&lt;/P&gt;

&lt;P&gt;c = a + b&lt;/P&gt;

&lt;P&gt;as well as&lt;/P&gt;

&lt;P&gt;c = a + 12345&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jan 2015 23:30:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052638#M115531</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2015-01-15T23:30:06Z</dc:date>
    </item>
    <item>
      <title>To expand on what</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052639#M115532</link>
      <description>&lt;P&gt;To expand on what jimdempseyatthecove said (BTW, what kind of monitor do you have? 4k rules, as you noted previously) I tried:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module M
&amp;nbsp;&amp;nbsp; use ISO_FORTRAN_ENV
&amp;nbsp;&amp;nbsp; implicit none
&amp;nbsp;&amp;nbsp; private
&amp;nbsp;&amp;nbsp; type, public :: MyBigInt
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer NUsed
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer Sign
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer(INT8), allocatable :: Data(:)
&amp;nbsp;&amp;nbsp; end type MyBigInt
&amp;nbsp;&amp;nbsp; public operator(+)
&amp;nbsp;&amp;nbsp; interface operator(+)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; module procedure plus
&amp;nbsp;&amp;nbsp; end interface operator(+)
&amp;nbsp;&amp;nbsp; contains
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function plus(a,b)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type(MyBigInt), intent(in) :: a, b
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type(MyBigInt) plus
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer(kind(plus%Data)) carry
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer i

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(a%Sign /= b%Sign) then
! Insert logic to handle subtraction
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; plus%Sign = a%Sign
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; allocate(plus%Data(max(a%NUsed,b%NUsed)+1))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; carry = 0
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = 1, min(a%Nused,b%NUsed)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; carry = carry+a%Data(i)+b%Data(i)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; plus%Data(i) = modulo(carry,10)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; carry = carry/10
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(a%NUsed &amp;gt; b%NUsed) then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = i, a%NUsed
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; carry = carry+a%Data(i)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; plus%Data(i) = modulo(carry,10)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; carry = carry/10
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if(b%NUsed &amp;gt; a%NUsed) then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = i, b%NUsed
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; carry = carry+b%Data(i)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; plus%Data(i) = modulo(carry,10)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; carry = carry/10
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(carry == 0) then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; plus%NUsed = i-1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; plus%NUsed = i
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; plus%Data(i) = carry
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end function plus
end module M

program P
&amp;nbsp;&amp;nbsp; use M
&amp;nbsp;&amp;nbsp; use ISO_FORTRAN_ENV
&amp;nbsp;&amp;nbsp; implicit none
&amp;nbsp;&amp;nbsp; type(MyBigInt) a, b, c
&amp;nbsp;&amp;nbsp; integer i
&amp;nbsp;&amp;nbsp; integer(INT8) temp
&amp;nbsp;&amp;nbsp; a%Sign = 1 ! Positive
&amp;nbsp;&amp;nbsp; a%NUsed = 13
&amp;nbsp;&amp;nbsp; allocate(a%Data(a%NUsed))
&amp;nbsp;&amp;nbsp; temp = 3
&amp;nbsp;&amp;nbsp; do i = 1, a%NUsed
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a%Data(i) = temp
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; temp = modulo(3*temp,10)
&amp;nbsp;&amp;nbsp; end do
&amp;nbsp;&amp;nbsp; write(*,*) 'a = ',merge('-','+',a%Sign == -1),a%Data(1:a%NUsed)
&amp;nbsp;&amp;nbsp; b%Sign = 1 ! Positive
&amp;nbsp;&amp;nbsp; b%NUsed = 17
&amp;nbsp;&amp;nbsp; allocate(b%Data(b%NUsed))
&amp;nbsp;&amp;nbsp; temp = 7
&amp;nbsp;&amp;nbsp; do i = 1, b%NUsed
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b%Data(i) = temp
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; temp = modulo(7*temp,10)
&amp;nbsp;&amp;nbsp; end do
&amp;nbsp;&amp;nbsp; write(*,*) 'b = ',merge('-','+',b%Sign == -1),b%Data(1:b%NUsed)
&amp;nbsp;&amp;nbsp; c = a+b
&amp;nbsp;&amp;nbsp; write(*,*) 'c = ',merge('-','+',c%Sign == -1),c%Data(1:c%NUsed)
end program P
&lt;/PRE&gt;

&lt;P&gt;And gfortran said:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;a = +&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;BR /&gt;
	&amp;nbsp;b = +&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&lt;BR /&gt;
	3&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&lt;BR /&gt;
	&amp;nbsp;c = +&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;
	4&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&lt;/P&gt;

&lt;P&gt;But ifort died on this code. I suppose functions that return results with allocatable components&amp;nbsp;are not yet implemented or something?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 00:05:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052639#M115532</guid>
      <dc:creator>JVanB</dc:creator>
      <dc:date>2015-01-16T00:05:23Z</dc:date>
    </item>
    <item>
      <title>If you change Line-18 to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052640#M115533</link>
      <description>&lt;P&gt;If you change Line-18 to&amp;nbsp;&lt;STRONG&gt;integer(INT8) carry&lt;/STRONG&gt;, IFort 15.0.1 will succeed. Probably a compiler bug.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Another minor point: the intrinsic function MODULO requires both arguments to be of the same kind, according to the compiler documentation.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 00:46:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052640#M115533</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2015-01-16T00:46:09Z</dc:date>
    </item>
    <item>
      <title>RO,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052641#M115534</link>
      <description>&lt;P&gt;RO,&lt;/P&gt;

&lt;P&gt;I have a Seiki 39" 4K TV. Image quality is excellent. The viewing area and pixel count is equivalent to four "HD" tiled together (without bezels). The only downside is the firmware is very sensitive to timing. Occasionally the screen will blank out then come back in 2-3 seconds. I think the firmware thought it lost connection. The upside is it was affordable. All together I won't go back to multiple monitors, unless they are all 4K.&lt;/P&gt;

&lt;P&gt;Great job on the operator(+). It would be relatively easy to use a parameter for the type used for the internal accumulator element. If, for example, you were most interested in high performance computation as opposed to conversion speed to/from the variable integer type, then I would suggestion using INT64. You an compute the carry relatively easy. Something like this untested code&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;c%data(i) = a%data(i) + b%data(i) + carry
if(iand(a%data(i), b%data(i)) &amp;lt; 0) then
&amp;nbsp; carry = 1
else if(iand(ior(a%data(i), b%data(i)), not(c%data(i)) &amp;lt; 0) then
&amp;nbsp; carry = 1
else
&amp;nbsp; carry = 0
endif
&lt;/PRE&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 13:24:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052641#M115534</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2015-01-16T13:24:33Z</dc:date>
    </item>
    <item>
      <title>For decimal floating point</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052642#M115535</link>
      <description>&lt;P&gt;For decimal floating point arithmetic with limited precision (7, 16 and 34 digits for DECIMAL32, DECIMAL64 and DECIMAL128), which is covered by the IEEE Standard 754-2008, Intel provides a build &amp;nbsp;package at&amp;nbsp;&amp;nbsp;https://software.intel.com/en-us/articles/intel-decimal-floating-point-math-library . The library is provided in source form with makefiles and test problems, and is in C.&lt;/P&gt;

&lt;P&gt;If the user is certain that 34 digits will suffice for the entire calculation, using the library would have the advantages of higher speed and smaller memory use for variables. The disadvantage would be that &amp;nbsp;is there no Fortran API provided.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 13:57:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052642#M115535</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2015-01-16T13:57:54Z</dc:date>
    </item>
    <item>
      <title>Also, if I use mixed signs, I</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052643#M115536</link>
      <description>&lt;P&gt;Also, if I use mixed signs, I can USE PLUS for the MINUS function. I just have to reverse the sign first.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jan 2015 16:35:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-re-output-arrays-from-functions/m-p/1052643#M115536</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2015-01-16T16:35:39Z</dc:date>
    </item>
  </channel>
</rss>

