Integration of OCCT 6.5.0 from SVN
[occt.git] / src / math / math_Recipes.hxx
CommitLineData
7fd59977 1#ifndef math_Recipes_HeaderFile
2#define math_Recipes_HeaderFile
3
4#include <Standard_Boolean.hxx>
5#include <Standard_Integer.hxx>
6#include <Standard_Real.hxx>
7
8#ifndef __math_API
9# if defined(WNT) && !defined(HAVE_NO_DLL)
10# ifdef __math_DLL
11# define __math_API __declspec( dllexport )
12# else
13# define __math_API __declspec( dllimport )
14# endif /* __math_DLL */
15# else
16# define __math_API
17# endif /* WNT */
18#endif /* __math_API */
19
20class math_IntegerVector;
21class math_Vector;
22class math_Matrix;
23
24
25const Standard_Integer math_Status_OK = 0;
26const Standard_Integer math_Status_SingularMatrix = 1;
27const Standard_Integer math_Status_ArgumentError = 2;
28const Standard_Integer math_Status_NoConvergence = 3;
29
30__math_API Standard_Integer LU_Decompose(math_Matrix& a,
31 math_IntegerVector& indx,
32 Standard_Real& d,
33 Standard_Real TINY = 1.0e-20);
34
35// Given a matrix a(1..n, 1..n), this routine computes its LU decomposition,
36// The matrix a is replaced by this LU decomposition and the vector indx(1..n)
37// is an output which records the row permutation effected by the partial
38// pivoting; d is output as +1 or -1 depending on wether the number of row
39// interchanges was even or odd.
40
41__math_API Standard_Integer LU_Decompose(math_Matrix& a,
42 math_IntegerVector& indx,
43 Standard_Real& d,
44 math_Vector& vv,
45 Standard_Real TINY = 1.0e-30);
46
47// Idem to the previous LU_Decompose function. But the input Vector vv(1..n) is
48// used internally as a scratch area.
49
50
51__math_API void LU_Solve(const math_Matrix& a,
52 const math_IntegerVector& indx,
53 math_Vector& b);
54
55// Solves a * x = b for a vector x, where x is specified by a(1..n, 1..n),
56// indx(1..n) as returned by LU_Decompose. n is the dimension of the
57// square matrix A. b(1..n) is the input right-hand side and will be
58// replaced by the solution vector.Neither a and indx are destroyed, so
59// the routine may be called sequentially with different b's.
60
61
62__math_API Standard_Integer LU_Invert(math_Matrix& a);
63
64// Given a matrix a(1..n, 1..n) this routine computes its inverse. The matrix
65// a is replaced by its inverse.
66
67
68__math_API Standard_Integer SVD_Decompose(math_Matrix& a,
69 math_Vector& w,
70 math_Matrix& v);
71
72// Given a matrix a(1..m, 1..n), this routine computes its singular value
73// decomposition, a = u * w * transposed(v). The matrix u replaces a on
74// output. The diagonal matrix of singular values w is output as a vector
75// w(1..n). The matrix v is output as v(1..n, 1..n). m must be greater or
76// equal to n; if it is smaller, then a should be filled up to square with
77// zero rows.
78
79
80__math_API Standard_Integer SVD_Decompose(math_Matrix& a,
81 math_Vector& w,
82 math_Matrix& v,
83 math_Vector& rv1);
84
85
86// Idem to the previous LU_Decompose function. But the input Vector vv(1..m)
87// (the number of rows a(1..m, 1..n)) is used internally as a scratch area.
88
89
90__math_API void SVD_Solve(const math_Matrix& u,
91 const math_Vector& w,
92 const math_Matrix& v,
93 const math_Vector& b,
94 math_Vector& x);
95
96// Solves a * x = b for a vector x, where x is specified by u(1..m, 1..n),
97// w(1..n), v(1..n, 1..n) as returned by SVD_Decompose. m and n are the
98// dimensions of A, and will be equal for square matrices. b(1..m) is the
99// input right-hand side. x(1..n) is the output solution vector.
100// No input quantities are destroyed, so the routine may be called
101// sequentially with different b's.
102
103
104
105__math_API Standard_Integer DACTCL_Decompose(math_Vector& a, const math_IntegerVector& indx,
106 const Standard_Real MinPivot = 1.e-20);
107
108// Given a SYMMETRIC matrix a, this routine computes its
109// LU decomposition.
110// a is given through a vector of its non zero components of the upper
111// triangular matrix.
112// indx is the indice vector of the diagonal elements of a.
113// a is replaced by its LU decomposition.
114// The range of the matrix is n = indx.Length(),
115// and a.Length() = indx(n).
116
117
118
119__math_API Standard_Integer DACTCL_Solve(const math_Vector& a, math_Vector& b,
120 const math_IntegerVector& indx,
121 const Standard_Real MinPivot = 1.e-20);
122
123// Solves a * x = b for a vector x and a matrix a coming from DACTCL_Decompose.
124// indx is the same vector as in DACTCL_Decompose.
125// the vector b is replaced by the vector solution x.
126
127
128
129
130__math_API Standard_Integer Jacobi(math_Matrix& a, math_Vector& d, math_Matrix& v, Standard_Integer& nrot);
131
132// Computes all eigenvalues and eigenvectors of a real symmetric matrix
133// a(1..n, 1..n). On output, elements of a above the diagonal are destroyed.
134// d(1..n) returns the eigenvalues of a. v(1..n, 1..n) is a matrix whose
135// columns contain, on output, the normalized eigenvectors of a. nrot returns
136// the number of Jacobi rotations that were required.
137// Eigenvalues are sorted into descending order, and eigenvectors are
138// arranges correspondingly.
139
140__math_API Standard_Real Random2(Standard_Integer& idum);
141
142// returns a uniform random deviate betwween 0.0 and 1.0. Set idum to any
143// negative value to initialize or reinitialize the sequence.
144
145
146
147#endif
148
149
150
151
152
153
154
155
156