<?xml version="1.0" encoding="utf-8"?>
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:bib="http://bibtexml.sf.net/" xmlns:q="http://cnx.rice.edu/qml/1.0" id="id2255528" module-id="" cnxml-version="0.6">
  <title>Program 4: Basic Quick Fourier Transform (QFT)</title>
  <metadata xmlns:md="http://cnx.rice.edu/mdml/0.4">
  <!-- WARNING! The 'metadata' section is read only. Do not edit below.
       Changes to the metadata section in the source will not be saved. -->
  <md:content-id>m17373</md:content-id>
  <md:title>Program 4: Basic Quick Fourier Transform (QFT)</md:title>
  <md:version>1.3</md:version>
  <md:created>2008/05/28 12:12:27 GMT-5</md:created>
  <md:revised>2009/04/04 09:16:16.721 GMT-5</md:revised>
  <md:authorlist>
    <md:author id="cburrus">
        <md:firstname>C.</md:firstname>
        <md:othername>Sidney</md:othername>
        <md:surname>Burrus</md:surname>
        <md:fullname>C. Sidney Burrus</md:fullname>
        <md:email>csb@rice.edu</md:email>
    </md:author>
  </md:authorlist>
  <md:maintainerlist>
    <md:maintainer id="cburrus">
        <md:firstname>C.</md:firstname>
        <md:othername>Sidney</md:othername>
        <md:surname>Burrus</md:surname>
        <md:fullname>C. Sidney Burrus</md:fullname>
        <md:email>csb@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="dcwill">
        <md:firstname>Daniel</md:firstname>
        <md:othername>Collins</md:othername>
        <md:surname>Williamson</md:surname>
        <md:fullname>Daniel Williamson</md:fullname>
        <md:email>dcwill@cnx.org</md:email>
    </md:maintainer>
  </md:maintainerlist>
  <md:license href="http://creativecommons.org/licenses/by/2.0/"/>
  <md:licensorlist>
    <md:licensor id="cburrus">
        <md:firstname>C.</md:firstname>
        <md:othername>Sidney</md:othername>
        <md:surname>Burrus</md:surname>
        <md:fullname>C. Sidney Burrus</md:fullname>
        <md:email>csb@rice.edu</md:email>
    </md:licensor>
  </md:licensorlist>
  <md:keywordlist>
    <md:keyword>FFT</md:keyword>
    <md:keyword>QFT</md:keyword>
    <md:keyword>Quick Fourier Transform</md:keyword>
  </md:keywordlist>
  <md:subjectlist>
    <md:subject>Mathematics and Statistics</md:subject>
  </md:subjectlist>
  <md:abstract>Basic Quick Fourier Transform (QFT) Program</md:abstract>
  <md:language>en</md:language>
  <!-- WARNING! The 'metadata' section is read only. Do not edit above.
       Changes to the metadata section in the source will not be saved. -->
</metadata>
  <content>
    <section id="uid1">
      <title>Basic QFT Algorithm</title>
      <para id="id2255548">A FORTRAN implementation of the basic QFT algorithm is given below to show
how the theory is implemented. The program is written for clarity, not to
minimize the number of floating point operations.</para>
      <code id="uid2" display="block" class="listing">C
   SUBROUTINE QDFT(X,Y,XX,YY,NN)
   REAL X(0:260),Y(0:260),XX(0:260),YY(0:260)
   C
   N1 = NN - 1
   N2 = N1/2
   N21 = NN/2
   Q   = 6.283185308/NN
   DO 2 K = 0, N21
      SSX = X(0)
      SSY = Y(0)
      SDX = 0
      SDY = 0
      IF (MOD(NN,2).EQ.0) THEN
         SSX = SSX + COS(3.1426*K)*X(N21)
         SSY = SSY + COS(3.1426*K)*Y(N21)
      ENDIF
      DO 3 N = 1, N2
         SSX = SSX + (X(N) + X(NN-N))*COS(Q*N*K)
         SSY = SSY + (Y(N) + Y(NN-N))*COS(Q*N*K)
         SDX = SDX + (X(N) - X(NN-N))*SIN(Q*N*K)
         SDY = SDY + (Y(N) - Y(NN-N))*SIN(Q*N*K)
3     CONTINUE
      XX(K) = SSX + SDY
      YY(K) = SSY - SDX
      XX(NN-K) = SSX - SDY
      YY(NN-K) = SSY + SDX
2  CONTINUE
   RETURN
   END
 
<caption>Simple QFT Fortran Program</caption></code>
    </section>
  </content>
  <bib:file/>
</document>
