\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input ndftip.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{License}
<<license>>=
--Copyright The Numerical Algorithms Group Limited 1996.
@
<<*>>=
<<license>>

-- Note that the conversions of results from DoubleFloat to Float
-- will become unnecessary if outputGeneral is extended to apply to
-- DoubleFloat quantities.  Those results not converted will, of
-- course, then be displayed to 6 s.f.


outputGeneral 6

seqA := [0.34907,0.54890,0.74776,0.94459,1.1385,1.3285,1.5137];

seqB := [0.34907 - 0.37168*%i,  _
         0.54890 - 0.35669*%i,  _
         0.74776 - 0.31175*%i,  _
         0.94459 - 0.23702*%i,  _
         1.13850 - 0.13274*%i,  _
         1.32850 + 0.00074*%i,  _
         1.51370 + 0.16298*%i];

hseqC : PackedHermitianSequence DoubleFloat
hseqC := packHS [0.34907,        _
                 0.54890 + %i*1.51370,  _
                 0.74776 + %i*1.32850,  _
                 0.94459 + %i*1.13850,  _
                 0.94459 - %i*1.13850,  _
                 0.74776 - %i*1.32850,  _
                 0.54890 - %i*1.51370];

seqsD : List Vector DoubleFloat;
seqsD := [vector [0.3854, 0.6772, 0.1138, 0.6751, 0.6362, 0.1424], _
          vector [0.5417, 0.2983, 0.1181, 0.7255, 0.8638, 0.8723], _
          vector [0.9172, 0.0644, 0.6037, 0.6430, 0.0428, 0.4815]];

seqsE : List PackedHermitianSequence DoubleFloat;
seqsE := [pHS [0.3854, 0.6772, 0.1138, 0.6751, 0.6362, 0.1424], _
          pHS [0.5417, 0.2983, 0.1181, 0.7255, 0.8638, 0.8723], _
          pHS [0.9172, 0.0644, 0.6037, 0.6430, 0.0428, 0.4815]];

seqsF : List Vector Complex DoubleFloat
seqsF := [vector [0.3854 + 0.5417*%i, 0.6772 + 0.2983*%i,   _
                  0.1138 + 0.1181*%i, 0.6751 + 0.7255*%i,   _
                  0.6362 + 0.8638*%i, 0.1424 + 0.8723*%i],  _
          vector [0.9172 + 0.9089*%i, 0.0644 + 0.3118*%i,   _
                  0.6037 + 0.3465*%i, 0.6430 + 0.6198*%i,   _
                  0.0428 + 0.2668*%i, 0.4815 + 0.1614*%i],  _
          vector [0.1156 + 0.6214*%i, 0.0685 + 0.8681*%i,   _
                  0.2060 + 0.7060*%i, 0.8630 + 0.8652*%i,   _
                  0.6967 + 0.9190*%i, 0.2792 + 0.3355*%i]];

-- test  1

dftA := nagDFT seqA;
dftA :: Vector Complex Float :: Matrix Complex Float
                             -- Matrix to force display as a column,
                             -- Float to allow outputGeneral to work.

--       +         2.48361         +
--       |                         |
--       |- 0.265985 + 0.530898 %i |
--       |                         |
--       |- 0.257682 + 0.202979 %i |
--       |                         |
--       |- 0.256363 + 0.0580623 %i|
--       |                         |
--       |- 0.256363 - 0.0580623 %i|
--       |                         |
--       |- 0.257682 - 0.202979 %i |
--       |                         |
--       +- 0.265985 - 0.530898 %i +

-- test  2

nagInverseDFT dftA :: Vector Float
 
--       [0.34907,0.5489,0.74776,0.94459,1.1385,1.3285,1.5137]

-- test  3

dftB := nagDFT seqB;
dftB :: Vector Complex Float :: Matrix Complex Float

--       +  2.48361 - 0.471004 %i  +
--       |                         |
--       | - 0.5518 + 0.496841 %i  |
--       |                         |
--       |- 0.367113 + 0.0975621 %i|
--       |                         |
--       |- 0.287669 - 0.0586476 %i|
--       |                         |
--       |- 0.225057 - 0.174772 %i |
--       |                         |
--       |- 0.148251 - 0.308396 %i |
--       |                         |
--       + 0.0198297 - 0.564956 %i +
 
-- test  4
 
(nagInverseDFT dftB) :: Vector Complex Float :: Matrix Complex Float
 
--       +0.34907 - 0.37168 %i+
--       |                    |
--       |0.5489 - 0.35669 %i |
--       |                    |
--       |0.74776 - 0.31175 %i|
--       |                    |
--       |0.94459 - 0.23702 %i|
--       |                    |
--       |1.1385 - 0.13274 %i |
--       |                    |
--       |1.3285 + 0.00074 %i |
--       |                    |
--       +1.5137 + 0.16298 %i +

-- test  5

hdftA := nagHermitianDFT seqA;
(expand hdftA) :: Vector Complex Float :: Matrix Complex Float

--       +         2.48361         +
--       |                         |
--       |- 0.265985 + 0.530898 %i |
--       |                         |
--       |- 0.257682 + 0.202979 %i |
--       |                         |
--       |- 0.256363 + 0.0580623 %i|
--       |                         |
--       |- 0.256363 - 0.0580623 %i|
--       |                         |
--       |- 0.257682 - 0.202979 %i |
--       |                         |
--       +- 0.265985 - 0.530898 %i +
 
-- test  6
 
(nagInverseDFT hdftA) :: Vector Float

--       [0.34907,0.5489,0.74776,0.94459,1.1385,1.3285,1.5137]

-- test  7

dftC := nagDFT hseqC;
dftC :: Vector Float
 
-- [1.82616,1.86862,- 0.017503,0.502001,- 0.598725,- 0.0314404,- 2.62557]

-- test  8

(nagInverseDFT dftC) :: Vector Complex Float
 
-- [0.34907, 0.5489 + 1.5137 %i, 0.74776 + 1.3285 %i, 0.94459 + 1.1385 %i,
--  0.94459 - 1.1385 %i, 0.74776 - 1.3285 %i, 0.5489 - 1.5137 %i]

-- test  9

nagHermitianInverseDFT dftC
 
-- [0.34907000000000005, 0.54889999999999983, 0.74775999999999987,
--  0.94459000000000004, 1.1385000000000003, 1.3284999999999998,
--  1.5136999999999998]

-- test 10:

dftsD := nagDFT seqsD;

dftsD :: List Vector Complex Float
 
-- [
--   [1.07373, - 0.104062 - 0.00438406 %i, 0.112554 - 0.373777 %i, - 0.146684,
--    0.112554 + 0.373777 %i, - 0.104062 + 0.00438406 %i]
--   ,

--   [1.39609, - 0.0365178 + 0.466584 %i, 0.077955 - 0.0607051 %i, - 0.152072,
--    0.077955 + 0.0607051 %i, - 0.0365178 - 0.466584 %i]
--   ,

--   [1.12374, 0.0914068 - 0.050841 %i, 0.393551 + 0.345775 %i, 0.153011,
--    0.393551 - 0.345775 %i, 0.0914068 + 0.050841 %i]
--   ]

-- test 11:

invdftsD := nagInverseDFT dftsD ;
invdftsD :: List Vector Complex Float
 
-- [[0.3854,0.6772,0.1138,0.6751,0.6362,0.1424],
--  [0.5417,0.2983,0.1181,0.7255,0.8638,0.8723],
--  [0.9172,0.0644,0.6037,0.643,0.0428,0.4815]]

-- test 12:

dftsE := nagDFT seqsE;
dftsE :: List Vector Float
 
-- [[1.0788,0.662291,- 0.239146,- 0.578284,0.459192,- 0.438816],
--  [0.857321,1.22614,0.353348,- 0.222169,0.341327,- 1.22908],
--  [1.18245,0.262509,0.674406,0.552278,0.0539906,- 0.478963]]

-- test 13:

invdftsE := nagInverseDFT dftsE;
invdftsE :: List Vector Complex Float
 
-- [
--   [0.3854, 0.6772 + 0.1424 %i, 0.1138 + 0.6362 %i, 0.6751,
--    0.1138 - 0.6362 %i, 0.6772 - 0.1424 %i]
--   ,

--   [0.5417, 0.2983 + 0.8723 %i, 0.1181 + 0.8638 %i, 0.7255,
--    0.1181 - 0.8638 %i, 0.2983 - 0.8723 %i]
--   ,

--   [0.9172, 0.0644 + 0.4815 %i, 0.6037 + 0.0428 %i, 0.643,
--    0.6037 - 0.0428 %i, 0.0644 - 0.4815 %i]
--   ]

-- test 14:

hdftsD := nagHermitianDFT seqsD;
map(expand,hdftsD) :: List Vector Complex Float
 
-- [
--   [1.07373, - 0.104062 - 0.00438406 %i, 0.112554 - 0.373777 %i, - 0.146684,
--    0.112554 + 0.373777 %i, - 0.104062 + 0.00438406 %i]
--   ,

--   [1.39609, - 0.0365178 + 0.466584 %i, 0.077955 - 0.0607051 %i, - 0.152072,
--    0.077955 + 0.0607051 %i, - 0.0365178 - 0.466584 %i]
--   ,

--   [1.12374, 0.0914068 - 0.050841 %i, 0.393551 + 0.345775 %i, 0.153011,
--    0.393551 - 0.345775 %i, 0.0914068 + 0.050841 %i]
--   ]

-- test 15:

(nagInverseDFT hdftsD) :: List Vector Float
 
-- [[0.3854,0.6772,0.1138,0.6751,0.6362,0.1424],
--  [0.5417,0.2983,0.1181,0.7255,0.8638,0.8723],
--  [0.9172,0.0644,0.6037,0.643,0.0428,0.4815]]

-- test 16:

dftsF := nagDFT seqsF;
dftsF :: List Vector Complex Float
 
-- [
--   [1.07373 + 1.39609 %i, - 0.570647 - 0.0409019 %i, 0.173259 - 0.295822 %i,
--    - 0.146684 - 0.152072 %i, 0.0518489 + 0.451732 %i,
--    0.362522 - 0.0321337 %i]
--   ,

--   [1.12374 + 1.06765 %i, 0.172759 + 0.0385858 %i, 0.418548 + 0.748083 %i,
--    0.153011 + 0.17522 %i, 0.368555 + 0.0565331 %i, 0.0100542 + 0.140268 %i]
--   ,

--   [0.909985 + 1.76167 %i, - 0.305418 + 0.0624335 %i,
--    0.407884 - 0.0694786 %i, - 0.078547 + 0.0725049 %i,
--    - 0.119334 + 0.128511 %i, - 0.531409 - 0.433531 %i]
--   ]

-- test 17:

invdftsF := nagInverseDFT dftsF ;
invdftsF :: List Vector Complex Float
 
-- [
--   [0.3854 + 0.5417 %i, 0.6772 + 0.2983 %i, 0.1138 + 0.1181 %i,
--    0.6751 + 0.7255 %i, 0.6362 + 0.8638 %i, 0.1424 + 0.8723 %i]
--   ,

--   [0.9172 + 0.9089 %i, 0.0644 + 0.3118 %i, 0.6037 + 0.3465 %i,
--    0.643 + 0.6198 %i, 0.0428 + 0.2668 %i, 0.4815 + 0.1614 %i]
--   ,

--   [0.1156 + 0.6214 %i, 0.0685 + 0.8681 %i, 0.206 + 0.706 %i,
--    0.863 + 0.8652 %i, 0.6967 + 0.919 %i, 0.2792 + 0.3355 %i]
--   ]

-- test 18:

nagHermitianInverseDFT dftsE
 
-- [
--   [0.38540000000000013, 0.67720000000000025, 0.11380000000000001,
--    0.67510000000000014, 0.63620000000000021, 0.14240000000000003]
--   ,

--   [0.54170000000000018, 0.29830000000000012, 0.1181, 0.72550000000000014,
--    0.86380000000000023, 0.87230000000000019]
--   ,

--   [0.91720000000000035, 0.064399999999999999, 0.60370000000000024,
--    0.64300000000000013, 0.042799999999999991, 0.48150000000000015]
--   ]

-- error tests:

-- test 19:

nagDFT [vector [0.3854 + 0.5417*%i, 0.6772 + 0.2983*%i,   _
                0.1138 + 0.1181*%i, 0.6751 + 0.7255*%i,   _
                0.6362 + 0.8638*%i, 0.1424 + 0.8723*%i],  _
        vector [0.1156 + 0.6214*%i, 0.0685 + 0.8681*%i,   _
                0.6967 + 0.9190*%i, 0.2792 + 0.3355*%i]]
 
-- Error signalled from user code:
--    The data sequences in nagDFT must all have the same length. The 
--    length of sequence 1 is 6 that of sequence 2 is 4.

-- test 20:

nagHermitianDFT [vector [0.3854, 0.6751, 0.6362, 0.1424], _
                 vector [0.5417, 0.7255, 0.8638, 0.8723], _
                 vector [0.9172, 0.0428, 0.4815]]
 
-- Error signalled from user code:
--    The data sequences in nagHermitianDFT must all have the same 
--    length. The length of sequence 1 is 4 that of sequence 3 is 3.

-- test 21:

badSeqs : List PackedHermitianSequence DoubleFloat
badSeqs := [pHS [0.3854, 0.1138, 0.6751, 0.6362, 0.1424],         _
            pHS [0.5417, 0.2983, 0.1181, 0.7255, 0.8638, 0.8723], _
            pHS [0.9172, 0.0644, 0.6037, 0.6430, 0.0428, 0.4815]];
 
nagDFT badSeqs
 
-- Error signalled from user code:
--    The data sequences in nagDFT must all have the same length. The 
--    length of sequence 1 is 5 that of sequence 2 is 6.

outputGeneral()

output "End of tests"

@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}