1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
| //file:matrix.hpp
#ifndef DUTOR_MATRIX_HPP
#define DUTOR_MATRIX_HPP
namespace dutor {
class Vector;
class Matrix {
public:
Matrix(int rows=1, int cols=1, double d=0);
Matrix(const Matrix& m);
~Matrix();
int numRows() const { return rows; }
int numCols() const { return cols; }
const double* operator[](const int row) const;
double* operator[](const int row);
double& operator()(int row, int col);
Matrix& operator=(const Matrix& m);
Matrix& operator=(const double d);
Matrix& operator += (const Matrix& m);
Matrix& operator -= (const Matrix& m);
Matrix& operator *= (double d);
Matrix& operator /= (double d);
Matrix transpose();
friend std::ostream& operator<<(std::ostream& os, const Matrix& mat);
private:
int rows;
int cols;
double **m;
};
inline Matrix operator + (const Matrix& m) {
return m;
}
extern Matrix operator - (const Matrix& m);
extern Matrix operator * (const Matrix& m, double d);
extern Matrix operator * (double d, const Matrix& m);
extern Matrix operator / (const Matrix& m, double d);
extern Matrix operator + (const Matrix& m1, const Matrix& m2);
extern Matrix operator - (const Matrix& m1, const Matrix& m2);
extern Matrix operator * (const Matrix& m1, const Matrix& m2);
extern void solveGaussJordan(Matrix& A, Matrix& B);
extern void solveLUDecompose(Matrix& A, Matrix& B);
extern void reduceHouseholder(Matrix& A, Vector& d, Vector& e);
extern void solveTQLI(Vector& d, Vector&e, Matrix& z);
extern void sortEigen(Vector& d, Matrix& z);
extern Vector solveEigenSymmetric(Matrix& A);
extern void singularValueDecompose(Matrix& a, Vector& w, Matrix& v);
extern void minimizeBFGS(Vector& p, const double gtol, int& iter, double& fret,
double (*func)(Vector&), void (*dfunc)(Vector&, Vector&));
} /* end namespace dutor */
#endif /* DUTOR_MATRIX_HPP */ |
Be the first to comment on this entry.