newmatap.h
Go to the documentation of this file.
1 
6 
7 // Copyright (C) 1991,2,3,4,8: R B Davies
8 
9 #ifndef NEWMATAP_LIB
10 #define NEWMATAP_LIB 0
11 
12 #include "newmat.h"
13 
14 #ifdef use_namespace
15 namespace NEWMAT {
16 #endif
17 
18 
19 // ************************** applications *****************************/
20 
21 
23 
24 void QRZT(const Matrix&, Matrix&, Matrix&);
25 
27 
28 void QRZ(const Matrix&, Matrix&, Matrix&);
29 
31 { QRZT(X,L); }
32 
33 inline void HHDecompose(const Matrix& X, Matrix& Y, Matrix& M)
34 { QRZT(X, Y, M); }
35 
37 
39 
41  { updateQRZT(X, L); }
42 
44  { updateQRZ(X, U); }
45 
46 // Matrix A's first n columns are orthonormal
47 // so A.Columns(1,n).t() * A.Columns(1,n) is the identity matrix.
48 // Fill out the remaining columns of A to make them orthonormal
49 // so A.t() * A is the identity matrix
50 void extend_orthonormal(Matrix& A, int n);
51 
52 
54 
56 
57 
58 // produces the Cholesky decomposition of A + x.t() * x where A = chol.t() * chol
59 // and x is a RowVector
61 inline void UpdateCholesky(UpperTriangularMatrix& chol, const RowVector& x)
62  { update_Cholesky(chol, x); }
63 
64 // produces the Cholesky decomposition of A - x.t() * x where A = chol.t() * chol
65 // and x is a RowVector
67 inline void DowndateCholesky(UpperTriangularMatrix &chol, const RowVector& x)
68  { downdate_Cholesky(chol, x); }
69 
70 // a RIGHT circular shift of the rows and columns from
71 // 1,...,k-1,k,k+1,...l,l+1,...,p to
72 // 1,...,k-1,l,k,k+1,...l-1,l+1,...p
75  int k, int l) { right_circular_update_Cholesky(chol, k, l); }
76 
77 // a LEFT circular shift of the rows and columns from
78 // 1,...,k-1,k,k+1,...l,l+1,...,p to
79 // 1,...,k-1,k+1,...l,k,l+1,...,p to
80 void left_circular_update_Cholesky(UpperTriangularMatrix &chol, int k, int l);
82  int k, int l) { left_circular_update_Cholesky(chol, k, l); }
83 
84 
85 void SVD(const Matrix&, DiagonalMatrix&, Matrix&, Matrix&,
86  bool=true, bool=true);
87 
88 void SVD(const Matrix&, DiagonalMatrix&);
89 
90 inline void SVD(const Matrix& A, DiagonalMatrix& D, Matrix& U,
91  bool withU = true) { SVD(A, D, U, U, withU, false); }
92 
93 void SortSV(DiagonalMatrix& D, Matrix& U, bool ascending = false);
94 
95 void SortSV(DiagonalMatrix& D, Matrix& U, Matrix& V, bool ascending = false);
96 
98 
100 
102 
104  Matrix&, bool=true);
105 
107 
109 
111 
112 inline void EigenValues(const SymmetricMatrix& A, DiagonalMatrix& D)
113  { eigenvalues(A, D); }
114 
115 inline void EigenValues(const SymmetricMatrix& A, DiagonalMatrix& D,
116  SymmetricMatrix& S) { eigenvalues(A, D, S); }
117 
118 inline void EigenValues(const SymmetricMatrix& A, DiagonalMatrix& D, Matrix& V)
119  { eigenvalues(A, D, V); }
120 
122 // not implemented yet
123 {
124 public:
126 private:
131 };
132 
134 
136 
137 inline void SortAscending(GeneralMatrix& gm) { sort_ascending(gm); }
138 
140 
143 {
144 public:
145  static bool OnlyOldFFT;
146  static bool ar_1d_ft (int PTS, Real* X, Real *Y);
147  static bool CanFactor(int PTS);
148 };
149 
150 void FFT(const ColumnVector&, const ColumnVector&,
152 
153 void FFTI(const ColumnVector&, const ColumnVector&,
155 
157 
158 void RealFFTI(const ColumnVector&, const ColumnVector&, ColumnVector&);
159 
160 void DCT_II(const ColumnVector&, ColumnVector&);
161 
163 
164 void DST_II(const ColumnVector&, ColumnVector&);
165 
167 
168 void DCT(const ColumnVector&, ColumnVector&);
169 
170 void DCT_inverse(const ColumnVector&, ColumnVector&);
171 
172 void DST(const ColumnVector&, ColumnVector&);
173 
174 void DST_inverse(const ColumnVector&, ColumnVector&);
175 
176 void FFT2(const Matrix& U, const Matrix& V, Matrix& X, Matrix& Y);
177 
178 void FFT2I(const Matrix& U, const Matrix& V, Matrix& X, Matrix& Y);
179 
180 
181 // This class is used by the new FFT program
182 
183 // Suppose an integer is expressed as a sequence of digits with each
184 // digit having a different radix.
185 // This class supposes we are counting with this multi-radix number
186 // but also keeps track of the number with the digits (and radices)
187 // reversed.
188 // The integer starts at zero
189 // operator++() increases it by 1
190 // Counter gives the number of increments
191 // Reverse() gives the value with the digits in reverse order
192 // Swap is true if reverse is less than counter
193 // Finish is true when we have done a complete cycle and are back at zero
194 
196 {
198  // radix of each digit
199  // n-1 highest order, 0 lowest order
200  SimpleIntArray& Value; // value of each digit
201  const int n; // number of digits
202  int reverse; // value when order of digits is reversed
203  int product; // product of radices
204  int counter; // counter
205  bool finish; // true when we have gone over whole range
206 public:
207  MultiRadixCounter(int nx, const SimpleIntArray& rx,
208  SimpleIntArray& vx);
209  void operator++(); // increment the multi-radix counter
210  bool Swap() const { return reverse < counter; }
211  bool Finish() const { return finish; }
212  int Reverse() const { return reverse; }
213  int Counter() const { return counter; }
214 };
215 
216 // multiplication by Helmert matrix
217 ReturnMatrix Helmert(int n, bool full=false);
218 ReturnMatrix Helmert(const ColumnVector& X, bool full=false);
219 ReturnMatrix Helmert(int n, int j, bool full=false);
220 ReturnMatrix Helmert_transpose(const ColumnVector& Y, bool full=false);
221 Real Helmert_transpose(const ColumnVector& Y, int j, bool full=false);
222 ReturnMatrix Helmert(const Matrix& X, bool full=false);
223 ReturnMatrix Helmert_transpose(const Matrix& Y, bool full=false);
224 
225 
226 
227 
228 #ifdef use_namespace
229 }
230 #endif
231 
232 
233 
234 #endif
235 
236 // body file: cholesky.cpp
237 // body file: evalue.cpp
238 // body file: fft.cpp
239 // body file: hholder.cpp
240 // body file: jacobi.cpp
241 // body file: newfft.cpp
242 // body file: sort.cpp
243 // body file: svd.cpp
244 // body file: nm_misc.cpp
245 
246 
247 
249 
250 
void DST_inverse(const ColumnVector &, ColumnVector &)
Definition: fft.cpp:406
const SimpleIntArray & Radix
Definition: newmatap.h:197
SymmetricMatrix backtransform
Definition: newmatap.h:129
ReturnMatrix Helmert_transpose(const ColumnVector &Y, bool full=false)
Definition: nm_misc.cpp:76
void UpdateCholesky(UpperTriangularMatrix &chol, const RowVector &x)
Definition: newmatap.h:61
int Reverse() const
Definition: newmatap.h:212
void UpdateQRZT(Matrix &X, LowerTriangularMatrix &L)
Definition: newmatap.h:40
void DowndateCholesky(UpperTriangularMatrix &chol, const RowVector &x)
Definition: newmatap.h:67
void RealFFTI(const ColumnVector &, const ColumnVector &, ColumnVector &)
Definition: fft.cpp:166
ReturnMatrix Helmert(int n, bool full=false)
Definition: nm_misc.cpp:24
void FFT(const ColumnVector &, const ColumnVector &, ColumnVector &, ColumnVector &)
Definition: fft.cpp:201
void downdate_Cholesky(UpperTriangularMatrix &chol, RowVector x)
Definition: cholesky.cpp:129
const int n
Definition: newmatap.h:201
void EigenValues(const SymmetricMatrix &A, DiagonalMatrix &D)
Definition: newmatap.h:112
bool Finish() const
Definition: newmatap.h:211
double Real
Definition: include.h:307
void DCT_II_inverse(const ColumnVector &, ColumnVector &)
Definition: fft.cpp:281
#define FREE_CHECK(Class)
Definition: myexcept.h:328
void LeftCircularUpdateCholesky(UpperTriangularMatrix &chol, int k, int l)
Definition: newmatap.h:81
void SortAscending(GeneralMatrix &gm)
Definition: newmatap.h:137
void DCT(const ColumnVector &, ColumnVector &)
Definition: fft.cpp:397
SimpleIntArray & Value
Definition: newmatap.h:200
void update_Cholesky(UpperTriangularMatrix &chol, RowVector x)
Definition: cholesky.cpp:102
void FFT2(const Matrix &U, const Matrix &V, Matrix &X, Matrix &Y)
Definition: fft.cpp:444
Upper triangular matrix.
Definition: newmat.h:799
void RightCircularUpdateCholesky(UpperTriangularMatrix &chol, int k, int l)
Definition: newmatap.h:74
void right_circular_update_Cholesky(UpperTriangularMatrix &chol, int k, int l)
Definition: cholesky.cpp:176
void RealFFT(const ColumnVector &, ColumnVector &, ColumnVector &)
Definition: fft.cpp:130
void extend_orthonormal(Matrix &A, int n)
Definition: hholder.cpp:341
void left_circular_update_Cholesky(UpperTriangularMatrix &chol, int k, int l)
Definition: cholesky.cpp:231
int Counter() const
Definition: newmatap.h:213
void updateQRZ(Matrix &X, UpperTriangularMatrix &U)
Definition: hholder.cpp:269
void sort_descending(GeneralMatrix &)
Definition: sort.cpp:49
void DCT_inverse(const ColumnVector &, ColumnVector &)
Definition: fft.cpp:363
void SVD(const Matrix &, DiagonalMatrix &, Matrix &, Matrix &, bool=true, bool=true)
Definition: svd.cpp:30
void FFT2I(const Matrix &U, const Matrix &V, Matrix &X, Matrix &Y)
Definition: fft.cpp:465
DiagonalMatrix diag
Definition: newmatap.h:127
void DST_II(const ColumnVector &, ColumnVector &)
Definition: fft.cpp:308
The usual rectangular matrix.
Definition: newmat.h:625
void SortDescending(GeneralMatrix &gm)
Definition: newmatap.h:139
DiagonalMatrix offdiag
Definition: newmatap.h:128
ReturnMatrix Cholesky(const SymmetricMatrix &)
Definition: cholesky.cpp:36
void eigenvalues(const SymmetricMatrix &, DiagonalMatrix &)
Definition: evalue.cpp:290
void DCT_II(const ColumnVector &, ColumnVector &)
Definition: fft.cpp:253
Diagonal matrix.
Definition: newmat.h:896
static bool OnlyOldFFT
Definition: newmatap.h:145
Lower triangular matrix.
Definition: newmat.h:848
void DST(const ColumnVector &, ColumnVector &)
Definition: fft.cpp:434
Symmetric band matrix.
Definition: newmat.h:1245
Decide which fft method to use and carry out new fft function.
Definition: newmatap.h:142
void UpdateQRZ(Matrix &X, UpperTriangularMatrix &U)
Definition: newmatap.h:43
void DST_II_inverse(const ColumnVector &, ColumnVector &)
Definition: fft.cpp:336
void HHDecompose(Matrix &X, LowerTriangularMatrix &L)
Definition: newmatap.h:30
Row vector.
Definition: newmat.h:953
void QRZ(Matrix &, UpperTriangularMatrix &)
Definition: hholder.cpp:117
void FFTI(const ColumnVector &, const ColumnVector &, ColumnVector &, ColumnVector &)
Definition: fft.cpp:120
Column vector.
Definition: newmat.h:1008
void Jacobi(const SymmetricMatrix &, DiagonalMatrix &)
Definition: jacobi.cpp:115
void QRZT(Matrix &, LowerTriangularMatrix &)
Definition: hholder.cpp:33
The classes for matrices that can contain data are derived from this.
Definition: newmat.h:447
bool Swap() const
Definition: newmatap.h:210
void sort_ascending(GeneralMatrix &)
Definition: sort.cpp:125
void SortSV(DiagonalMatrix &D, Matrix &U, bool ascending=false)
Definition: sort.cpp:194
void updateQRZT(Matrix &X, LowerTriangularMatrix &L)
Definition: hholder.cpp:229
Symmetric matrix.
Definition: newmat.h:753


kni
Author(s): Martin Günther
autogenerated on Fri Jan 3 2020 04:01:16