<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hello,<br>
      <br>
      Le 28/06/2018 à 17:41, Stéphane Mottelet a écrit :<br>
    </div>
    <blockquote cite="mid:097f1d1d-0047-ab98-11cb-307672848fad@utc.fr"
      type="cite">Hello all,
      <br>
      <br>
      A fix proposal is under review @
      <a class="moz-txt-link-freetext" href="https://codereview.scilab.org/#/c/20204/2">https://codereview.scilab.org/#/c/20204/2</a>, in order to consider
      the actual behavior of clean() when the argument has some infinite
      values:
      <br>
      <br>
      In Scilab 6.0.1:
      <br>
      <br>
      <br>
      --> clean([%inf 1])
      <br>
       ans  =
      <br>
      <br>
         0.   0.
      <br>
      <br>
      By a argument of continuity, since
      <br>
      <br>
      --> clean([1.79e308 1])
      <br>
       ans  =
      <br>
      <br>
         1.79D+308   0.
      <br>
      <br>
      the fixed behavior would be
      <br>
      <br>
      --> clean([%inf 1])
      <br>
       ans  =
      <br>
      <br>
         Inf   0.
      <br>
      <br>
      Please give your opinion if you feel concerned.
      <br>
    </blockquote>
    <br>
    <br>
    IMO, setting to  zero all finite values of an array as soon as one
    of them is %inf is abusive and counter-productive.<br>
    Let<br>
    <tt>--> A = 10.^grand(4,4,"unf",-10,5); A(2,2) = %inf;</tt><tt><br>
       A  = <br>
         4.3699094   0.0000014   0.67061     6.095D-09<br>
         6503.1214   Inf         4.5767598   0.0006926<br>
         20.907407   1.5687011   2.749D-08   0.0029886<br>
         129.70759   1.102D-10   0.4564722   40.621591<br>
    </tt><br>
    The proposed implementation would lead to
    <br>
    <br>
    <tt>--> clean(A)    //  A(abs(A)~=%inf & A==A)=0</tt><tt><br>
    </tt><tt> ans  = </tt><tt><br>
    </tt><tt>   0.   0.    0.   0.</tt><tt><br>
    </tt><tt>   0.   Inf   0.   0.</tt><tt><br>
    </tt><tt>   0.   0.    0.   0.</tt><tt><br>
    </tt><tt>   0.   0.    0.   0.</tt><tt><br>
    </tt><br>
    With that, no more processing or linear algebra can be done, just
    getting exclusively some zeros, %inf, and Nan.<br>
    The same can be done with A(abs(A)~=%inf) = 0. This is a poor and
    stopping result.<br>
    <br>
    Instead, cleaning values <b>with respect to the max |finite| one</b>
    will yield<br>
    <br>
     <tt>--> clean(A)     // B = A;
      A(abs(A)<max(A(abs(A)<%inf))*1e-10)=0</tt><tt><br>
    </tt><tt> A  = </tt><tt><br>
    </tt><tt>   4.3699094   0.0000014   0.67061     0.       </tt><tt><br>
    </tt><tt>   6503.1214   Inf         4.5767598   0.0006926</tt><tt><br>
    </tt><tt>   20.907407   1.5687011   0.          0.0029886</tt><tt><br>
    </tt><tt>   129.70759   0.          0.4564722   40.621591</tt><tt><br>
    </tt> <br>
    This result is a way richer. It still allows to work with it.<br>
    <br>
    By the way, there is no <i>continuity</i> from 1.79D+308 to %inf<br>
    An array may have all its |values| around and below the max
    1.79D+308 by some small factors, then arithmetic can still be
    possible with them, and %inf will still be a special value with a
    special processing.<br>
    <br>
    This is why i do not agree with the proposed clean() update.<br>
    <br>
    Best regards<br>
    Samuel<br>
    <br>
    <br>
  </body>
</html>