MOOS 0.2375
|
00001 //$$ newmatap.h definition file for matrix package applications 00002 00003 // Copyright (C) 1991,2,3,4,8: R B Davies 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 // ************************** applications *****************************/ 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 ReturnMatrix Cholesky(const SymmetricMatrix&); 00033 00034 ReturnMatrix Cholesky(const SymmetricBandMatrix&); 00035 00036 void SVD(const Matrix&, DiagonalMatrix&, Matrix&, Matrix&, 00037 bool=true, bool=true); 00038 00039 void SVD(const Matrix&, DiagonalMatrix&); 00040 00041 inline void SVD(const Matrix& A, DiagonalMatrix& D, Matrix& U, 00042 bool withU = true) { SVD(A, D, U, U, withU, false); } 00043 00044 void SortSV(DiagonalMatrix& D, Matrix& U, bool ascending = false); 00045 00046 void SortSV(DiagonalMatrix& D, Matrix& U, Matrix& V, bool ascending = false); 00047 00048 void Jacobi(const SymmetricMatrix&, DiagonalMatrix&); 00049 00050 void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&); 00051 00052 void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, Matrix&); 00053 00054 void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&, 00055 Matrix&, bool=true); 00056 00057 void EigenValues(const SymmetricMatrix&, DiagonalMatrix&); 00058 00059 void EigenValues(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&); 00060 00061 void EigenValues(const SymmetricMatrix&, DiagonalMatrix&, Matrix&); 00062 00063 class SymmetricEigenAnalysis 00064 // not implemented yet 00065 { 00066 public: 00067 SymmetricEigenAnalysis(const SymmetricMatrix&); 00068 private: 00069 DiagonalMatrix diag; 00070 DiagonalMatrix offdiag; 00071 SymmetricMatrix backtransform; 00072 FREE_CHECK(SymmetricEigenAnalysis) 00073 }; 00074 00075 void SortAscending(GeneralMatrix&); 00076 00077 void SortDescending(GeneralMatrix&); 00078 00079 00080 // class for deciding which fft to use and containing new fft function 00081 class FFT_Controller 00082 { 00083 public: 00084 static bool OnlyOldFFT; 00085 static bool ar_1d_ft (int PTS, Real* X, Real *Y); 00086 static bool CanFactor(int PTS); 00087 }; 00088 00089 void FFT(const ColumnVector&, const ColumnVector&, 00090 ColumnVector&, ColumnVector&); 00091 00092 void FFTI(const ColumnVector&, const ColumnVector&, 00093 ColumnVector&, ColumnVector&); 00094 00095 void RealFFT(const ColumnVector&, ColumnVector&, ColumnVector&); 00096 00097 void RealFFTI(const ColumnVector&, const ColumnVector&, ColumnVector&); 00098 00099 void DCT_II(const ColumnVector&, ColumnVector&); 00100 00101 void DCT_II_inverse(const ColumnVector&, ColumnVector&); 00102 00103 void DST_II(const ColumnVector&, ColumnVector&); 00104 00105 void DST_II_inverse(const ColumnVector&, ColumnVector&); 00106 00107 void DCT(const ColumnVector&, ColumnVector&); 00108 00109 void DCT_inverse(const ColumnVector&, ColumnVector&); 00110 00111 void DST(const ColumnVector&, ColumnVector&); 00112 00113 void DST_inverse(const ColumnVector&, ColumnVector&); 00114 00115 // This class is used by the new FFT program 00116 00117 // Suppose an integer is expressed as a sequence of digits with each 00118 // digit having a different radix. 00119 // This class supposes we are counting with this multi-radix number 00120 // but also keeps track of the number with the digits (and radices) 00121 // reversed. 00122 // The integer starts at zero 00123 // operator++() increases it by 1 00124 // Counter gives the number of increments 00125 // Reverse() gives the value with the digits in reverse order 00126 // Swap is true if reverse is less than counter 00127 // Finish is true when we have done a complete cycle and are back at zero 00128 00129 class MultiRadixCounter 00130 { 00131 const SimpleIntArray& Radix; 00132 // radix of each digit 00133 // n-1 highest order, 0 lowest order 00134 SimpleIntArray& Value; // value of each digit 00135 const int n; // number of digits 00136 int reverse; // value when order of digits is reversed 00137 int product; // product of radices 00138 int counter; // counter 00139 bool finish; // true when we have gone over whole range 00140 public: 00141 MultiRadixCounter(int nx, const SimpleIntArray& rx, 00142 SimpleIntArray& vx); 00143 void operator++(); // increment the multi-radix counter 00144 bool Swap() const { return reverse < counter; } 00145 bool Finish() const { return finish; } 00146 int Reverse() const { return reverse; } 00147 int Counter() const { return counter; } 00148 }; 00149 00150 00151 #ifdef use_namespace 00152 } 00153 #endif 00154 00155 00156 00157 #endif 00158 00159 // body file: cholesky.cpp 00160 // body file: evalue.cpp 00161 // body file: fft.cpp 00162 // body file: hholder.cpp 00163 // body file: jacobi.cpp 00164 // body file: newfft.cpp 00165 // body file: sort.cpp 00166 // body file: svd.cpp 00167 00168 00169 00170 00171