<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Le 10/10/2018 à 09:21, <a class="moz-txt-link-abbreviated" href="mailto:amonmayr@laas.fr">amonmayr@laas.fr</a>
      a écrit :<br>
    </div>
    <blockquote cite="mid:dd1dbc55-dd6c-8eed-7981-2720e751cded@laas.fr"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="moz-cite-prefix">Le 10/10/2018 à 08:47, Samuel Gougeon
        a écrit :<br>
      </div>
      <blockquote type="cite"
        cite="mid:4f167b65-4986-7bd5-ccc7-68a4e99eed5b@free.fr">Le
        09/10/2018 à 21:52, antoine monmayrant a écrit : <br>
        <blockquote type="cite">Hello Samuel, <br>
          <br>
          Sorry I might not have made myself clear: fft and fftshift
          provide the ability to perform transform along only one of the
          dimensions of a multidimensional array. <br>
          Something like S(x,y,z) --[FFT along 3rd dim]-->
          ffthift(ffft(S(x,y,z), -1,3),3)=Ŝ(x,y,kz). <br>
          In that case, you need to perform fft and eventually fftshift
          along only the dimension of the transform. <br>
          ifftshift should also provide the same possibility to perform
          the inverse transform: Ŝ(x,y,kz) --[IFFT along 3rd dim]-->
          iffthift(ffft(Ŝ(x,y,kz), +1,3),3)=S(x,y,z). <br>
          <br>
          This is a basic signal processing requirement in my field. <br>
        </blockquote>
        <br>
        Hello Antoine, <br>
        <br>
        Yes, you are right: in case of directional FFT and odd number of
        elements along the chosen direction, ifftshift can't presently
        be used. <br>
        Could you please post the same remark on bugzilla? This bug/wish
        is not yet reported. <br>
      </blockquote>
      OK, I'll put it in my TODO-list.<br>
      <blockquote type="cite"
        cite="mid:4f167b65-4986-7bd5-ccc7-68a4e99eed5b@free.fr"> <br>
        IMO we may propose and include it in Scilab as soon as for
        Scilab 6.0.2. <br>
        <br>
        BTW, still IMO, fftshift and ifftshift should rather be merged
        in a single function. <br>
        It's the same code, except a floor<=>ceil. This should
        deserve just an option, not a separate dedicated function. <br>
        I guess that this separation likely comes from a kind of abusive
        Matlab-like mimicry. <br>
      </blockquote>
      Yes, I agree.<br>
      But I don't see how we can merge the two without increasing the
      huge halo of confusion that blurs the help pages and use of
      fft-related functions¹ ².<br>
    </blockquote>
    <br>
    You know, the most numerous pages we have about basically the same
    feature, the more inconsistencies between them we can get.<br>
    <br>
    <blockquote cite="mid:dd1dbc55-dd6c-8eed-7981-2720e751cded@laas.fr"
      type="cite"> The first idea that came to my mind was to make one
      single fftshift function where:<br>
       - if dim>0, you do direct shift (ie for a direct Fourier
      transform) along dimension dim;<br>
       - if dim<0, you do inverse shift (ie for an inverse Fourier
      transform) along dimension |dim|.<br>
    </blockquote>
    <br>
    I am not too convinced using the sign of dim to set the direction of
    the shift,<br>
    because the dim sign could be used to something else more useful
    (and general)<br>
    when dealing with an hypermatrix (to be discussed elsewhere).<br>
    <br>
    <blockquote cite="mid:dd1dbc55-dd6c-8eed-7981-2720e751cded@laas.fr"
      type="cite"> But as "-1" means direct fft and "+1" inverse fft,
      mixing fft and fftshift would be a real mess.<br>
    </blockquote>
    Yes, having chosen the sign of the exponent as a flag to set the
    direction is not very handy/clear.<br>
    But we must do with it now...<br>
    <br>
    Basically, flipdim() could do the same, by implementing  new
    "fft"|"ifft" values for its blockSize option.<br>
    <br>
    <blockquote cite="mid:dd1dbc55-dd6c-8eed-7981-2720e751cded@laas.fr"
      type="cite"> <br>
      Antoine<br>
      ¹ One I just discovered yesterday: the help page for fft is not
      listed in "Scilab Help >> Signal Processing > Transforms
      " ! Only ifft is listed, cool, he? Of course, ifft points to
      "Scilab Help >> Signal Processing > Transforms > fft".
      Idem  for dst, ...<br>
    </blockquote>
    <br>
    It is listed, but it depends on the way you get the list:<br>
    <ul>
      <li>Go to the Scilab help browser, and watch the list in the left
        margin : fft is listed, but not ifft</li>
      <li>Now, click on the fft help directory, still on the leftside
        list : in the page pannel, you get the list of contents of the
        help directory: here, ifft is listed, but not fft</li>
    </ul>
    <p>This is due to the <a
        href="http://bugzilla.scilab.org/show_bug.cgi?id=11633">bug
        11633</a>. It occurs when a page has multiple <refname>
      (titles)<br>
    </p>
    <p>About ifft() and fft2(): to me, these both functions are
      completely useless. They do nothing more than what fft() can do.<br>
      I presume they have been introduced again to mimic Matlab. What
      brings confusion.<br>
      Formerly, there was also a mfft() in Scilab. We have removed it,
      since fft() does its job whatever is the number of dimensions of
      the input!<br>
      To me, we must go on and remove fft2() and ifft(), or at least
      undocument them.<br>
      This does not prevent to keep "fft2" and "ifft" tags in the fft()
      page, in order to get the fft() page when we type "help ifft" ; <br>
      or even to keep also their code (but maintaining the
      Matlab-to-Scilab converter should be a priority instead!).<br>
      But not to keep their pages. Or otherwise, to move them in the
      "Compatibility functions" module.<br>
      To me, it's their only relevant place.<br>
    </p>
    <blockquote cite="mid:dd1dbc55-dd6c-8eed-7981-2720e751cded@laas.fr"
      type="cite"> ² Oh, and this one cool too: in the fft help page: <br>
      "incr<br>
      a vector of positive numbers with integer values, or a vector of
      positive integers. <b>See the Description part for details.</b>"<br>
      but the Description never says what the heck "incr" is, does and
      means.... Arghhh. It only appears once in an example of a
      "previous syntax".<br>
    </blockquote>
    <br>
    It is written:<br>
    <div class="refsection">
      <dl>
        <dd>
          <ul class="itemizedlist">
            <li>
              <p class="para"> <i><code class="literal">X=fft(A,sign,dims,incr
                    [,option])</code></i><i> is a previous syntax that
                  also allows to perform all direct or inverse fft of
                  the slices of </i><i><code class="literal">A</code></i><i>
                  along selected dimensions. </i></p>
              <i> </i>
              <p class="para"><i> For example, if </i><i><code
                    class="literal">A</code></i><i> is an array with </i><i><code
                    class="literal">n1*n2*n3</code></i><i> elements </i><i><code
                    class="literal">X=fft(A,-1,n1,1)</code></i><i> is
                  equivalent to </i><i><code class="literal">X=fft(matrix(A,[n1,n2,n3]),-1,1)</code></i><i>.<br>
                  and </i><i><code class="literal">X=fft(A,-1,[n1
                    n3],[1 n1*n2])</code></i><i> is equivalent to </i><i><code
                    class="literal">X=fft(matrix(A,[n1,n2,n3]),-1,[1,3])</code></i><i>.
                </i></p>
              <i> </i></li>
          </ul>
          <i> </i></dd>
      </dl>
      <i> </i></div>
    <i> </i>So, it is described ;) But it is rather unclear, indeed.
    You are welcome to reformulate it :)<br>
    <br>
    When 3 pages have to be written and maintained (in ideally 5
    different languages en fr ja pt ru) instead of one, then the time
    and care than can be invested to write excellent pages is expectedly
    3 times shorter for each one of them... <br>
    <br>
  </body>
</html>