1 | //$$ newmatap.h definition file for matrix package applications |
---|
2 | |
---|
3 | // Copyright (C) 1991,2,3,4,8: R B Davies |
---|
4 | |
---|
5 | #ifndef NEWMATAP_LIB |
---|
6 | #define NEWMATAP_LIB 0 |
---|
7 | |
---|
8 | #include "newmat.h" |
---|
9 | |
---|
10 | #ifdef use_namespace |
---|
11 | namespace NEWMAT { |
---|
12 | #endif |
---|
13 | |
---|
14 | |
---|
15 | // ************************** applications *****************************/ |
---|
16 | |
---|
17 | |
---|
18 | void QRZT(Matrix&, LowerTriangularMatrix&); |
---|
19 | |
---|
20 | void QRZT(const Matrix&, Matrix&, Matrix&); |
---|
21 | |
---|
22 | void QRZ(Matrix&, UpperTriangularMatrix&); |
---|
23 | |
---|
24 | void QRZ(const Matrix&, Matrix&, Matrix&); |
---|
25 | |
---|
26 | inline void HHDecompose(Matrix& X, LowerTriangularMatrix& L) |
---|
27 | { QRZT(X,L); } |
---|
28 | |
---|
29 | inline void HHDecompose(const Matrix& X, Matrix& Y, Matrix& M) |
---|
30 | { QRZT(X, Y, M); } |
---|
31 | |
---|
32 | ReturnMatrix Cholesky(const SymmetricMatrix&); |
---|
33 | |
---|
34 | ReturnMatrix Cholesky(const SymmetricBandMatrix&); |
---|
35 | |
---|
36 | void SVD(const Matrix&, DiagonalMatrix&, Matrix&, Matrix&, |
---|
37 | bool=true, bool=true); |
---|
38 | |
---|
39 | void SVD(const Matrix&, DiagonalMatrix&); |
---|
40 | |
---|
41 | inline void SVD(const Matrix& A, DiagonalMatrix& D, Matrix& U, |
---|
42 | bool withU = true) { SVD(A, D, U, U, withU, false); } |
---|
43 | |
---|
44 | void SortSV(DiagonalMatrix& D, Matrix& U, bool ascending = false); |
---|
45 | |
---|
46 | void SortSV(DiagonalMatrix& D, Matrix& U, Matrix& V, bool ascending = false); |
---|
47 | |
---|
48 | void Jacobi(const SymmetricMatrix&, DiagonalMatrix&); |
---|
49 | |
---|
50 | void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&); |
---|
51 | |
---|
52 | void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, Matrix&); |
---|
53 | |
---|
54 | void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&, |
---|
55 | Matrix&, bool=true); |
---|
56 | |
---|
57 | void EigenValues(const SymmetricMatrix&, DiagonalMatrix&); |
---|
58 | |
---|
59 | void EigenValues(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&); |
---|
60 | |
---|
61 | void EigenValues(const SymmetricMatrix&, DiagonalMatrix&, Matrix&); |
---|
62 | |
---|
63 | class SymmetricEigenAnalysis |
---|
64 | // not implemented yet |
---|
65 | { |
---|
66 | public: |
---|
67 | SymmetricEigenAnalysis(const SymmetricMatrix&); |
---|
68 | private: |
---|
69 | DiagonalMatrix diag; |
---|
70 | DiagonalMatrix offdiag; |
---|
71 | SymmetricMatrix backtransform; |
---|
72 | FREE_CHECK(SymmetricEigenAnalysis) |
---|
73 | }; |
---|
74 | |
---|
75 | void SortAscending(GeneralMatrix&); |
---|
76 | |
---|
77 | void SortDescending(GeneralMatrix&); |
---|
78 | |
---|
79 | |
---|
80 | // class for deciding which fft to use and containing new fft function |
---|
81 | class FFT_Controller |
---|
82 | { |
---|
83 | public: |
---|
84 | static bool OnlyOldFFT; |
---|
85 | static bool ar_1d_ft (int PTS, Real* X, Real *Y); |
---|
86 | static bool CanFactor(int PTS); |
---|
87 | }; |
---|
88 | |
---|
89 | void FFT(const ColumnVector&, const ColumnVector&, |
---|
90 | ColumnVector&, ColumnVector&); |
---|
91 | |
---|
92 | void FFTI(const ColumnVector&, const ColumnVector&, |
---|
93 | ColumnVector&, ColumnVector&); |
---|
94 | |
---|
95 | void RealFFT(const ColumnVector&, ColumnVector&, ColumnVector&); |
---|
96 | |
---|
97 | void RealFFTI(const ColumnVector&, const ColumnVector&, ColumnVector&); |
---|
98 | |
---|
99 | void DCT_II(const ColumnVector&, ColumnVector&); |
---|
100 | |
---|
101 | void DCT_II_inverse(const ColumnVector&, ColumnVector&); |
---|
102 | |
---|
103 | void DST_II(const ColumnVector&, ColumnVector&); |
---|
104 | |
---|
105 | void DST_II_inverse(const ColumnVector&, ColumnVector&); |
---|
106 | |
---|
107 | void DCT(const ColumnVector&, ColumnVector&); |
---|
108 | |
---|
109 | void DCT_inverse(const ColumnVector&, ColumnVector&); |
---|
110 | |
---|
111 | void DST(const ColumnVector&, ColumnVector&); |
---|
112 | |
---|
113 | void DST_inverse(const ColumnVector&, ColumnVector&); |
---|
114 | |
---|
115 | // This class is used by the new FFT program |
---|
116 | |
---|
117 | // Suppose an integer is expressed as a sequence of digits with each |
---|
118 | // digit having a different radix. |
---|
119 | // This class supposes we are counting with this multi-radix number |
---|
120 | // but also keeps track of the number with the digits (and radices) |
---|
121 | // reversed. |
---|
122 | // The integer starts at zero |
---|
123 | // operator++() increases it by 1 |
---|
124 | // Counter gives the number of increments |
---|
125 | // Reverse() gives the value with the digits in reverse order |
---|
126 | // Swap is true if reverse is less than counter |
---|
127 | // Finish is true when we have done a complete cycle and are back at zero |
---|
128 | |
---|
129 | class MultiRadixCounter |
---|
130 | { |
---|
131 | const SimpleIntArray& Radix; |
---|
132 | // radix of each digit |
---|
133 | // n-1 highest order, 0 lowest order |
---|
134 | SimpleIntArray& Value; // value of each digit |
---|
135 | const int n; // number of digits |
---|
136 | int reverse; // value when order of digits is reversed |
---|
137 | int product; // product of radices |
---|
138 | int counter; // counter |
---|
139 | bool finish; // true when we have gone over whole range |
---|
140 | public: |
---|
141 | MultiRadixCounter(int nx, const SimpleIntArray& rx, |
---|
142 | SimpleIntArray& vx); |
---|
143 | void operator++(); // increment the multi-radix counter |
---|
144 | bool Swap() const { return reverse < counter; } |
---|
145 | bool Finish() const { return finish; } |
---|
146 | int Reverse() const { return reverse; } |
---|
147 | int Counter() const { return counter; } |
---|
148 | }; |
---|
149 | |
---|
150 | |
---|
151 | #ifdef use_namespace |
---|
152 | } |
---|
153 | #endif |
---|
154 | |
---|
155 | |
---|
156 | |
---|
157 | #endif |
---|
158 | |
---|
159 | // body file: cholesky.cpp |
---|
160 | // body file: evalue.cpp |
---|
161 | // body file: fft.cpp |
---|
162 | // body file: hholder.cpp |
---|
163 | // body file: jacobi.cpp |
---|
164 | // body file: newfft.cpp |
---|
165 | // body file: sort.cpp |
---|
166 | // body file: svd.cpp |
---|
167 | |
---|
168 | |
---|
169 | |
---|
170 | |
---|
171 | |
---|