Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/newmat/newmatap.h @ 4631

Last change on this file since 4631 was 4565, checked in by patrick, 19 years ago

orxonox/trunk: added the newmat library to the project. needs some translation in directory, temp under util/newmat. is needed by the collision detection engine to perform lin alg operations such as eigenvector decomposition. perhaps we will make our own library to do that later.

File size: 4.5 KB
Line 
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
11namespace NEWMAT {
12#endif
13
14
15// ************************** applications *****************************/
16
17
18void QRZT(Matrix&, LowerTriangularMatrix&);
19
20void QRZT(const Matrix&, Matrix&, Matrix&);
21
22void QRZ(Matrix&, UpperTriangularMatrix&);
23
24void QRZ(const Matrix&, Matrix&, Matrix&);
25
26inline void HHDecompose(Matrix& X, LowerTriangularMatrix& L)
27{ QRZT(X,L); }
28
29inline void HHDecompose(const Matrix& X, Matrix& Y, Matrix& M)
30{ QRZT(X, Y, M); }
31
32ReturnMatrix Cholesky(const SymmetricMatrix&);
33
34ReturnMatrix Cholesky(const SymmetricBandMatrix&);
35
36void SVD(const Matrix&, DiagonalMatrix&, Matrix&, Matrix&,
37    bool=true, bool=true);
38
39void SVD(const Matrix&, DiagonalMatrix&);
40
41inline void SVD(const Matrix& A, DiagonalMatrix& D, Matrix& U,
42   bool withU = true) { SVD(A, D, U, U, withU, false); }
43
44void SortSV(DiagonalMatrix& D, Matrix& U, bool ascending = false);
45
46void SortSV(DiagonalMatrix& D, Matrix& U, Matrix& V, bool ascending = false);
47
48void Jacobi(const SymmetricMatrix&, DiagonalMatrix&);
49
50void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&);
51
52void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, Matrix&);
53
54void Jacobi(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&,
55   Matrix&, bool=true);
56
57void EigenValues(const SymmetricMatrix&, DiagonalMatrix&);
58
59void EigenValues(const SymmetricMatrix&, DiagonalMatrix&, SymmetricMatrix&);
60
61void EigenValues(const SymmetricMatrix&, DiagonalMatrix&, Matrix&);
62
63class SymmetricEigenAnalysis
64// not implemented yet
65{
66public:
67   SymmetricEigenAnalysis(const SymmetricMatrix&);
68private:
69   DiagonalMatrix diag;
70   DiagonalMatrix offdiag;
71   SymmetricMatrix backtransform;
72   FREE_CHECK(SymmetricEigenAnalysis)
73};
74
75void SortAscending(GeneralMatrix&);
76
77void SortDescending(GeneralMatrix&);
78
79
80// class for deciding which fft to use and containing new fft function
81class FFT_Controller
82{
83public:
84   static bool OnlyOldFFT;
85   static bool ar_1d_ft (int PTS, Real* X, Real *Y);
86   static bool CanFactor(int PTS);
87};
88
89void FFT(const ColumnVector&, const ColumnVector&,
90   ColumnVector&, ColumnVector&);
91
92void FFTI(const ColumnVector&, const ColumnVector&,
93   ColumnVector&, ColumnVector&);
94
95void RealFFT(const ColumnVector&, ColumnVector&, ColumnVector&);
96
97void RealFFTI(const ColumnVector&, const ColumnVector&, ColumnVector&);
98
99void DCT_II(const ColumnVector&, ColumnVector&);
100
101void DCT_II_inverse(const ColumnVector&, ColumnVector&);
102
103void DST_II(const ColumnVector&, ColumnVector&);
104
105void DST_II_inverse(const ColumnVector&, ColumnVector&);
106
107void DCT(const ColumnVector&, ColumnVector&);
108
109void DCT_inverse(const ColumnVector&, ColumnVector&);
110
111void DST(const ColumnVector&, ColumnVector&);
112
113void 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
129class 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
140public:
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
Note: See TracBrowser for help on using the repository browser.