Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

newmatap.h

Go to the documentation of this file.
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 void UpdateQRZT(Matrix& X, LowerTriangularMatrix& L);
00033 
00034 void UpdateQRZ(Matrix& X, UpperTriangularMatrix& U);
00035 
00036 
00037 ReturnMatrix Cholesky(const SymmetricMatrix&);
00038 
00039 ReturnMatrix Cholesky(const SymmetricBandMatrix&);
00040 
00041 
00042 // produces the Cholesky decomposition of A + x.t() * x where A = chol.t() * chol
00043 // and x is a RowVector
00044 void UpdateCholesky(UpperTriangularMatrix &chol, RowVector r1Modification);
00045 
00046 // produces the Cholesky decomposition of A - x.t() * x where A = chol.t() * chol
00047 // and x is a RowVector
00048 void DowndateCholesky(UpperTriangularMatrix &chol, RowVector x);
00049 
00050 // a RIGHT circular shift of the rows and columns from
00051 // 1,...,k-1,k,k+1,...l,l+1,...,p to
00052 // 1,...,k-1,l,k,k+1,...l-1,l+1,...p
00053 void RightCircularUpdateCholesky(UpperTriangularMatrix &chol, int k, int l);
00054 
00055 // a LEFT circular shift of the rows and columns from
00056 // 1,...,k-1,k,k+1,...l,l+1,...,p to
00057 // 1,...,k-1,k+1,...l,k,l+1,...,p to
00058 void LeftCircularUpdateCholesky(UpperTriangularMatrix &chol, int k, int l); 
00059 
00060 
00061 void SVD(const Matrix&, DiagonalMatrix&, Matrix&, Matrix&,
00062     bool=true, bool=true);
00063 
00064 void SVD(const Matrix&, DiagonalMatrix&);
00065 
00066 inline void SVD(const Matrix& A, DiagonalMatrix& D, Matrix& U,
00067    bool withU = true) { SVD(A, D, U, U, withU, false); }
00068 
00069 void SortSV(DiagonalMatrix& D, Matrix& U, bool ascending = false);
00070 
00071 void SortSV(DiagonalMatrix& D, Matrix& U, Matrix& V, bool ascending = false);
00072 
00073 void Jacobi(const SymmetricMatrix&, DiagonalMatrix&);
00074 
00075 void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&);
00076 
00077 void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, Matrix&);
00078 
00079 void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&,
00080    Matrix&, bool=true);
00081 
00082 void EigenValues(const SymmetricMatrix&, DiagonalMatrix&);
00083 
00084 void EigenValues(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&);
00085 
00086 void EigenValues(const SymmetricMatrix&, DiagonalMatrix&, Matrix&);
00087 
00088 class SymmetricEigenAnalysis
00089 // not implemented yet
00090 {
00091 public:
00092    SymmetricEigenAnalysis(const SymmetricMatrix&);
00093 private:
00094    DiagonalMatrix diag;
00095    DiagonalMatrix offdiag;
00096    SymmetricMatrix backtransform;
00097    FREE_CHECK(SymmetricEigenAnalysis)
00098 };
00099 
00100 void SortAscending(GeneralMatrix&);
00101 
00102 void SortDescending(GeneralMatrix&);
00103 
00104 
00105 // class for deciding which fft to use and containing new fft function
00106 class FFT_Controller
00107 {
00108 public:
00109    static bool OnlyOldFFT;
00110    static bool ar_1d_ft (int PTS, Real* X, Real *Y);
00111    static bool CanFactor(int PTS);
00112 };
00113 
00114 void FFT(const ColumnVector&, const ColumnVector&,
00115    ColumnVector&, ColumnVector&);
00116 
00117 void FFTI(const ColumnVector&, const ColumnVector&,
00118    ColumnVector&, ColumnVector&);
00119 
00120 void RealFFT(const ColumnVector&, ColumnVector&, ColumnVector&);
00121 
00122 void RealFFTI(const ColumnVector&, const ColumnVector&, ColumnVector&);
00123 
00124 void DCT_II(const ColumnVector&, ColumnVector&);
00125 
00126 void DCT_II_inverse(const ColumnVector&, ColumnVector&);
00127 
00128 void DST_II(const ColumnVector&, ColumnVector&);
00129 
00130 void DST_II_inverse(const ColumnVector&, ColumnVector&);
00131 
00132 void DCT(const ColumnVector&, ColumnVector&);
00133 
00134 void DCT_inverse(const ColumnVector&, ColumnVector&);
00135 
00136 void DST(const ColumnVector&, ColumnVector&);
00137 
00138 void DST_inverse(const ColumnVector&, ColumnVector&);
00139 
00140 void FFT2(const Matrix& U, const Matrix& V, Matrix& X, Matrix& Y);
00141 
00142 void FFT2I(const Matrix& U, const Matrix& V, Matrix& X, Matrix& Y);
00143 
00144 
00145 // This class is used by the new FFT program
00146 
00147 // Suppose an integer is expressed as a sequence of digits with each
00148 // digit having a different radix.
00149 // This class supposes we are counting with this multi-radix number
00150 // but also keeps track of the number with the digits (and radices)
00151 // reversed.
00152 // The integer starts at zero
00153 // operator++() increases it by 1
00154 // Counter gives the number of increments
00155 // Reverse() gives the value with the digits in reverse order
00156 // Swap is true if reverse is less than counter
00157 // Finish is true when we have done a complete cycle and are back at zero
00158 
00159 class MultiRadixCounter
00160 {
00161    const SimpleIntArray& Radix;
00162                               // radix of each digit
00163                               // n-1 highest order, 0 lowest order
00164    SimpleIntArray& Value;     // value of each digit
00165    const int n;               // number of digits
00166    int reverse;               // value when order of digits is reversed
00167    int product;               // product of radices
00168    int counter;               // counter
00169    bool finish;               // true when we have gone over whole range
00170 public:
00171    MultiRadixCounter(int nx, const SimpleIntArray& rx,
00172       SimpleIntArray& vx);
00173    void operator++();         // increment the multi-radix counter
00174    bool Swap() const { return reverse < counter; }
00175    bool Finish() const { return finish; }
00176    int Reverse() const { return reverse; }
00177    int Counter() const { return counter; }
00178 };
00179 
00180 
00181 #ifdef use_namespace
00182 }
00183 #endif
00184 
00185 
00186 
00187 #endif
00188 
00189 // body file: cholesky.cpp
00190 // body file: evalue.cpp
00191 // body file: fft.cpp
00192 // body file: hholder.cpp
00193 // body file: jacobi.cpp
00194 // body file: newfft.cpp
00195 // body file: sort.cpp
00196 // body file: svd.cpp
00197 
00198 
00199 
00200 
00201 

newmat11b
Generated Mon May 9 04:54:18 2016 by Doxygen 1.6.3