<?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 MKL does not provide a in Intel® oneAPI Math Kernel Library</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/log-sum-and-under-overflow/m-p/1047195#M21030</link>
    <description>&lt;P&gt;MKL does not provide a function that specifically minimize underflow/overflow for such computation. Looks like the trick still applies when you call MKL functions to compute log-sum-exp.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Nov 2014 18:53:57 GMT</pubDate>
    <dc:creator>Zhang_Z_Intel</dc:creator>
    <dc:date>2014-11-05T18:53:57Z</dc:date>
    <item>
      <title>log sum and under/overflow</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/log-sum-and-under-overflow/m-p/1047194#M21029</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;I have converted some neural net code from matlab which consists of adding/subtracting very small probabilities and is of the form log( sum( Array) ). This may be affected by underflow. There is a common workaround on the internet called the log sum exp trick which involves shifting back and forward by a value equal to maxval(Array) &amp;nbsp;see&amp;nbsp;&lt;A href="http://machineintelligence.tumblr.com/post/4998477107/the-log-sum-exp-trick"&gt;http://machineintelligence.tumblr.com/post/4998477107/the-log-sum-exp-trick&lt;/A&gt;&amp;nbsp;for example. I could replicate this is fortran but before I do I though I would ask. Is there a MKL function that computes log( sum (Array) )) with minimal underflow/overflow before I reinvent the wheel - Here is the matlab code - repmat is similar to fortran spread(), ones creates a matrix of 1's and&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Alternately are there any fortran specific tricks for handling very small numbers accurately ?&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;if(length(xx(:))==1) ls=xx; return; end

xdims=size(xx);
if(nargin&amp;lt;2) 
  dim=find(xdims&amp;gt;1);
end

alpha = max(xx,[],dim)-log(realmax)/2;
repdims=ones(size(xdims)); repdims(dim)=xdims(dim);
ls = alpha+log(sum(exp(xx-repmat(alpha,repdims)),dim));&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2014 15:45:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/log-sum-and-under-overflow/m-p/1047194#M21029</guid>
      <dc:creator>steve_o_</dc:creator>
      <dc:date>2014-11-05T15:45:46Z</dc:date>
    </item>
    <item>
      <title>MKL does not provide a</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/log-sum-and-under-overflow/m-p/1047195#M21030</link>
      <description>&lt;P&gt;MKL does not provide a function that specifically minimize underflow/overflow for such computation. Looks like the trick still applies when you call MKL functions to compute log-sum-exp.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2014 18:53:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/log-sum-and-under-overflow/m-p/1047195#M21030</guid>
      <dc:creator>Zhang_Z_Intel</dc:creator>
      <dc:date>2014-11-05T18:53:57Z</dc:date>
    </item>
    <item>
      <title>Thanks, no worries just</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/log-sum-and-under-overflow/m-p/1047196#M21031</link>
      <description>&lt;P&gt;Thanks, no worries just thought I would ask before rolling my own version&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Nov 2014 00:25:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/log-sum-and-under-overflow/m-p/1047196#M21031</guid>
      <dc:creator>steve_o_</dc:creator>
      <dc:date>2014-11-06T00:25:45Z</dc:date>
    </item>
  </channel>
</rss>

