<?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: user defined vector function in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/user-defined-vector-function/m-p/964558#M22547</link>
    <description>James, &lt;BR /&gt; &lt;BR /&gt;Thanks a lot.  Both functions are what I am looking for</description>
    <pubDate>Sun, 26 Aug 2001 02:04:27 GMT</pubDate>
    <dc:creator>Intel_C_Intel</dc:creator>
    <dc:date>2001-08-26T02:04:27Z</dc:date>
    <item>
      <title>user defined vector function</title>
      <link>https://community.intel.com/t5/Software-Archive/user-defined-vector-function/m-p/964554#M22543</link>
      <description>I try to write a function which returns a vector like &lt;BR /&gt; rlogsig = 1/(1+exp(-x)), where x is a vector, and rlogsig should be a vector. &lt;BR /&gt;My code is like &lt;BR /&gt;program main &lt;BR /&gt;real x(2), r(2) &lt;BR /&gt;x(1) = 1.0; x(2) = 2.0 &lt;BR /&gt;r = rlogsig(x) &lt;BR /&gt;print *, r &lt;BR /&gt;end program main &lt;BR /&gt; &lt;BR /&gt;function rlogsig(x) &lt;BR /&gt;rlogsig = 1/(1+exp(-x)) &lt;BR /&gt;end function rlogsig &lt;BR /&gt; &lt;BR /&gt;But, it does not work!  Anyone can help</description>
      <pubDate>Sat, 25 Aug 2001 09:57:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/user-defined-vector-function/m-p/964554#M22543</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-08-25T09:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: user defined vector function</title>
      <link>https://community.intel.com/t5/Software-Archive/user-defined-vector-function/m-p/964555#M22544</link>
      <description>&lt;PRE&gt;&lt;FONT size="+0"&gt; 
! You are making 3 fundamental mistakes here, 
! any one of which will cause your program 
! to fail 
 
module all_my_functions 
   implicit none 
   contains 
      function rlogsig(x) 
! (1) x is an array and so must be declared as such 
! in the called function.  I use an assumed-shape 
! array so that your calling program need not pass 
! an additional parameter indicating the size of x. 
         real, intent(in) :: x(:) 
! (2) Since rlogsig returns an array-valued result, 
! it must be declared with the appropriate shape 
         real rlogsig(size(x)) 
 
         rlogsig = 1/(1+exp(-x)) 
      end function rlogsig 
end module all_my_functions 
 
program main 
! (3) The interface to rlogsig must be explicit in 
! all programs which call it because it has an 
! assumed-shape dummy argument and also because it 
! it returns an array-valued result.  Modules are 
! the most common way to create this explicit 
! interface. 
   use all_my_functions 
   implicit none 
   real x(2), r(2) 
 
   x = (/1.0, 2.0/) 
   r = rlogsig(x) 
   print *, r 
end program main 
&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Aug 2001 16:21:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/user-defined-vector-function/m-p/964555#M22544</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-08-25T16:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: user defined vector function</title>
      <link>https://community.intel.com/t5/Software-Archive/user-defined-vector-function/m-p/964556#M22545</link>
      <description>Another type:  &lt;BR /&gt;  &lt;BR /&gt;module points  &lt;BR /&gt; implicit none  &lt;BR /&gt; type:: point  &lt;BR /&gt;       real:: x,y  &lt;BR /&gt; end type point  &lt;BR /&gt;  &lt;BR /&gt;contains  &lt;BR /&gt;  &lt;BR /&gt; function rlogsig(c) result   &lt;BR /&gt;   type (point), intent(in)::c  &lt;BR /&gt;   type (point):: r  &lt;BR /&gt;    r%x = 1/(1+exp(-c%x))  &lt;BR /&gt;    r%y = 1/(1+exp(-c%y))  &lt;BR /&gt; end function rlogsig  &lt;BR /&gt;end module points  &lt;BR /&gt;  &lt;BR /&gt;program example  &lt;BR /&gt; use points  &lt;BR /&gt; implicit none  &lt;BR /&gt;  &lt;BR /&gt; type (point)::c  &lt;BR /&gt; c%x=1.0; c%y=2.0  &lt;BR /&gt;  &lt;BR /&gt; print*, 'rlogsig', rlogsig(c)  &lt;BR /&gt;  &lt;BR /&gt;end program example</description>
      <pubDate>Sat, 25 Aug 2001 16:38:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/user-defined-vector-function/m-p/964556#M22545</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-08-25T16:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: user defined vector function</title>
      <link>https://community.intel.com/t5/Software-Archive/user-defined-vector-function/m-p/964557#M22546</link>
      <description>&lt;PRE&gt;&lt;FONT size="+0"&gt; 
! It occurred to me that you may also want to use 
! an elemental function in this context 
 
module other_functions 
   implicit none 
   contains 
      elemental function rlogsig(x) 
         real, intent(in) :: x 
         real rlogsig 
 
         rlogsig = 1/(1+exp(-x)) 
      end function rlogsig 
end module other_functions 
 
program main 
! Note that the interface to an elemental function 
! must be explicit in the caller 
   use other_functions 
   implicit none 
   real x, y(2), z(2,2) 
   real r, s(size(y)), t(size(z,1),size(z,2)) 
 
   x = 1.0 
   r = rlogsig(x) 
   write(*,'(f9.7)') r 
   y = (/2.0,3.0/) 
   s = rlogsig(y) 
   write(*,'(/2(f9.7:1x))') s 
   z = reshape((/4.0, 5.0, &amp;amp; 
                 6.0, 7.0/), &amp;amp; 
               (/2,2/),order=(/2,1/)) 
   t = rlogsig(z) 
   write(*,'(/2(f9.7:1x))') transpose(t) 
end program main 
&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Aug 2001 17:18:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/user-defined-vector-function/m-p/964557#M22546</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-08-25T17:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: user defined vector function</title>
      <link>https://community.intel.com/t5/Software-Archive/user-defined-vector-function/m-p/964558#M22547</link>
      <description>James, &lt;BR /&gt; &lt;BR /&gt;Thanks a lot.  Both functions are what I am looking for</description>
      <pubDate>Sun, 26 Aug 2001 02:04:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/user-defined-vector-function/m-p/964558#M22547</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-08-26T02:04:27Z</dc:date>
    </item>
  </channel>
</rss>

