<?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 Calling Dr Stack! in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Calling-Dr-Stack/m-p/982188#M26329</link>
    <description>let's say we want to calculate the std.dev of an array of #'s in a function. Traditionally one sets up loops to get the sum and the variance etc. &lt;BR /&gt;Consider the following alternative: &lt;BR /&gt; &lt;BR /&gt;pure real(4) function getSdev(X,first,last) &lt;BR /&gt;	integer,intent(in):: first,last &lt;BR /&gt;	real(4),intent(in),volatile:: X(first:last) &lt;BR /&gt;                ave=SUM(X(last:first))/(last-first+1) &lt;BR /&gt;                std=sqrt(SUM(X**2)-ave**2)/(last-first) &lt;BR /&gt; &lt;BR /&gt;1. Can the SUM function improve the speed over a looped sum? &lt;BR /&gt; &lt;BR /&gt;2. Since we do not know the size of the array AND that X**2 is stored on the STACK, for a large array, can this cause problems in either in lack of stack size, or speed? &lt;BR /&gt; &lt;BR /&gt;Thanks,  &lt;BR /&gt;Tim</description>
    <pubDate>Fri, 01 Feb 2002 09:00:57 GMT</pubDate>
    <dc:creator>rahzan</dc:creator>
    <dc:date>2002-02-01T09:00:57Z</dc:date>
    <item>
      <title>Calling Dr Stack!</title>
      <link>https://community.intel.com/t5/Software-Archive/Calling-Dr-Stack/m-p/982188#M26329</link>
      <description>let's say we want to calculate the std.dev of an array of #'s in a function. Traditionally one sets up loops to get the sum and the variance etc. &lt;BR /&gt;Consider the following alternative: &lt;BR /&gt; &lt;BR /&gt;pure real(4) function getSdev(X,first,last) &lt;BR /&gt;	integer,intent(in):: first,last &lt;BR /&gt;	real(4),intent(in),volatile:: X(first:last) &lt;BR /&gt;                ave=SUM(X(last:first))/(last-first+1) &lt;BR /&gt;                std=sqrt(SUM(X**2)-ave**2)/(last-first) &lt;BR /&gt; &lt;BR /&gt;1. Can the SUM function improve the speed over a looped sum? &lt;BR /&gt; &lt;BR /&gt;2. Since we do not know the size of the array AND that X**2 is stored on the STACK, for a large array, can this cause problems in either in lack of stack size, or speed? &lt;BR /&gt; &lt;BR /&gt;Thanks,  &lt;BR /&gt;Tim</description>
      <pubDate>Fri, 01 Feb 2002 09:00:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Calling-Dr-Stack/m-p/982188#M26329</guid>
      <dc:creator>rahzan</dc:creator>
      <dc:date>2002-02-01T09:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calling Dr Stack!</title>
      <link>https://community.intel.com/t5/Software-Archive/Calling-Dr-Stack/m-p/982189#M26330</link>
      <description>As an aside, some authors recommend using two loops (or, I suppose, two SUM's).  The first one calculates the mean, the second one sums (X-mean)**2.  This way, you avoid roundoff errors (and the negative variances they produce sometimes). &lt;BR /&gt; &lt;BR /&gt;Gabriel</description>
      <pubDate>Sun, 03 Feb 2002 11:43:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Calling-Dr-Stack/m-p/982189#M26330</guid>
      <dc:creator>grtoro</dc:creator>
      <dc:date>2002-02-03T11:43:52Z</dc:date>
    </item>
  </channel>
</rss>

