00001
00002
00003
00004
00005 #ifndef NEWMATAP_LIB
00006 #define NEWMATAP_LIB 0
00007
00008 #include "newmat.h"
00009
00010 #ifdef use_namespace
00011 namespace NEWMAT {
00012 #endif
00013
00014
00015
00016
00017
00018 void QRZT(Matrix&, LowerTriangularMatrix&);
00019
00020 void QRZT(const Matrix&, Matrix&, Matrix&);
00021
00022 void QRZ(Matrix&, UpperTriangularMatrix&);
00023
00024 void QRZ(const Matrix&, Matrix&, Matrix&);
00025
00026 inline void HHDecompose(Matrix& X, LowerTriangularMatrix& L)
00027 { QRZT(X,L); }
00028
00029 inline void HHDecompose(const Matrix& X, Matrix& Y, Matrix& M)
00030 { QRZT(X, Y, M); }
00031
00032 void UpdateQRZT(Matrix& X, LowerTriangularMatrix& L);
00033
00034 void UpdateQRZ(Matrix& X, UpperTriangularMatrix& U);
00035
00036
00037
00038
00039
00040 void extend_orthonormal(Matrix& A, int n);
00041
00042
00043 ReturnMatrix Cholesky(const SymmetricMatrix&);
00044
00045 ReturnMatrix Cholesky(const SymmetricBandMatrix&);
00046
00047
00048
00049
00050 void UpdateCholesky(UpperTriangularMatrix &chol, RowVector r1Modification);
00051
00052
00053
00054 void DowndateCholesky(UpperTriangularMatrix &chol, RowVector x);
00055
00056
00057
00058
00059 void RightCircularUpdateCholesky(UpperTriangularMatrix &chol, int k, int l);
00060
00061
00062
00063
00064 void LeftCircularUpdateCholesky(UpperTriangularMatrix &chol, int k, int l);
00065
00066
00067 void SVD(const Matrix&, DiagonalMatrix&, Matrix&, Matrix&,
00068 bool=true, bool=true);
00069
00070 void SVD(const Matrix&, DiagonalMatrix&);
00071
00072 inline void SVD(const Matrix& A, DiagonalMatrix& D, Matrix& U,
00073 bool withU = true) { SVD(A, D, U, U, withU, false); }
00074
00075 void SortSV(DiagonalMatrix& D, Matrix& U, bool ascending = false);
00076
00077 void SortSV(DiagonalMatrix& D, Matrix& U, Matrix& V, bool ascending = false);
00078
00079 void Jacobi(const SymmetricMatrix&, DiagonalMatrix&);
00080
00081 void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&);
00082
00083 void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, Matrix&);
00084
00085 void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&,
00086 Matrix&, bool=true);
00087
00088 void EigenValues(const SymmetricMatrix&, DiagonalMatrix&);
00089
00090 void EigenValues(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&);
00091
00092 void EigenValues(const SymmetricMatrix&, DiagonalMatrix&, Matrix&);
00093
00094 class SymmetricEigenAnalysis
00095
00096 {
00097 public:
00098 SymmetricEigenAnalysis(const SymmetricMatrix&);
00099 private:
00100 DiagonalMatrix diag;
00101 DiagonalMatrix offdiag;
00102 SymmetricMatrix backtransform;
00103 FREE_CHECK(SymmetricEigenAnalysis)
00104 };
00105
00106 void SortAscending(GeneralMatrix&);
00107
00108 void SortDescending(GeneralMatrix&);
00109
00110
00111
00112 class FFT_Controller
00113 {
00114 public:
00115 static bool OnlyOldFFT;
00116 static bool ar_1d_ft (int PTS, Real* X, Real *Y);
00117 static bool CanFactor(int PTS);
00118 };
00119
00120 void FFT(const ColumnVector&, const ColumnVector&,
00121 ColumnVector&, ColumnVector&);
00122
00123 void FFTI(const ColumnVector&, const ColumnVector&,
00124 ColumnVector&, ColumnVector&);
00125
00126 void RealFFT(const ColumnVector&, ColumnVector&, ColumnVector&);
00127
00128 void RealFFTI(const ColumnVector&, const ColumnVector&, ColumnVector&);
00129
00130 void DCT_II(const ColumnVector&, ColumnVector&);
00131
00132 void DCT_II_inverse(const ColumnVector&, ColumnVector&);
00133
00134 void DST_II(const ColumnVector&, ColumnVector&);
00135
00136 void DST_II_inverse(const ColumnVector&, ColumnVector&);
00137
00138 void DCT(const ColumnVector&, ColumnVector&);
00139
00140 void DCT_inverse(const ColumnVector&, ColumnVector&);
00141
00142 void DST(const ColumnVector&, ColumnVector&);
00143
00144 void DST_inverse(const ColumnVector&, ColumnVector&);
00145
00146 void FFT2(const Matrix& U, const Matrix& V, Matrix& X, Matrix& Y);
00147
00148 void FFT2I(const Matrix& U, const Matrix& V, Matrix& X, Matrix& Y);
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 class MultiRadixCounter
00166 {
00167 const SimpleIntArray& Radix;
00168
00169
00170 SimpleIntArray& Value;
00171 const int n;
00172 int reverse;
00173 int product;
00174 int counter;
00175 bool finish;
00176 public:
00177 MultiRadixCounter(int nx, const SimpleIntArray& rx,
00178 SimpleIntArray& vx);
00179 void operator++();
00180 bool Swap() const { return reverse < counter; }
00181 bool Finish() const { return finish; }
00182 int Reverse() const { return reverse; }
00183 int Counter() const { return counter; }
00184 };
00185
00186
00187 #ifdef use_namespace
00188 }
00189 #endif
00190
00191
00192
00193 #endif
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207