0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / math / math_Recipes.hxx
CommitLineData
b311480e 1// Copyright (c) 1997-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15#ifndef math_Recipes_HeaderFile
16#define math_Recipes_HeaderFile
17
18#include <Standard_Boolean.hxx>
19#include <Standard_Integer.hxx>
20#include <Standard_Real.hxx>
9f785738 21#include <Standard_Handle.hxx>
7fd59977 22
7fd59977 23class math_IntegerVector;
24class math_Vector;
25class math_Matrix;
9f785738 26class Message_ProgressIndicator;
7fd59977 27
9f785738 28const Standard_Integer math_Status_UserAborted = -1;
7fd59977 29const Standard_Integer math_Status_OK = 0;
30const Standard_Integer math_Status_SingularMatrix = 1;
31const Standard_Integer math_Status_ArgumentError = 2;
32const Standard_Integer math_Status_NoConvergence = 3;
33
68df8478 34Standard_EXPORT Standard_Integer LU_Decompose(math_Matrix& a,
7fd59977 35 math_IntegerVector& indx,
36 Standard_Real& d,
9f785738 37 Standard_Real TINY = 1.0e-20,
38 const Handle(Message_ProgressIndicator) & aProgress = Handle(Message_ProgressIndicator)());
7fd59977 39
40// Given a matrix a(1..n, 1..n), this routine computes its LU decomposition,
41// The matrix a is replaced by this LU decomposition and the vector indx(1..n)
42// is an output which records the row permutation effected by the partial
43// pivoting; d is output as +1 or -1 depending on wether the number of row
44// interchanges was even or odd.
45
68df8478 46Standard_EXPORT Standard_Integer LU_Decompose(math_Matrix& a,
7fd59977 47 math_IntegerVector& indx,
48 Standard_Real& d,
49 math_Vector& vv,
9f785738 50 Standard_Real TINY = 1.0e-30,
51 const Handle(Message_ProgressIndicator) & aProgress = Handle(Message_ProgressIndicator)());
7fd59977 52
53// Idem to the previous LU_Decompose function. But the input Vector vv(1..n) is
54// used internally as a scratch area.
55
56
68df8478 57Standard_EXPORT void LU_Solve(const math_Matrix& a,
7fd59977 58 const math_IntegerVector& indx,
59 math_Vector& b);
60
61// Solves a * x = b for a vector x, where x is specified by a(1..n, 1..n),
62// indx(1..n) as returned by LU_Decompose. n is the dimension of the
63// square matrix A. b(1..n) is the input right-hand side and will be
64// replaced by the solution vector.Neither a and indx are destroyed, so
65// the routine may be called sequentially with different b's.
66
67
68df8478 68Standard_EXPORT Standard_Integer LU_Invert(math_Matrix& a);
7fd59977 69
70// Given a matrix a(1..n, 1..n) this routine computes its inverse. The matrix
71// a is replaced by its inverse.
72
73
68df8478 74Standard_EXPORT Standard_Integer SVD_Decompose(math_Matrix& a,
7fd59977 75 math_Vector& w,
76 math_Matrix& v);
77
78// Given a matrix a(1..m, 1..n), this routine computes its singular value
79// decomposition, a = u * w * transposed(v). The matrix u replaces a on
80// output. The diagonal matrix of singular values w is output as a vector
81// w(1..n). The matrix v is output as v(1..n, 1..n). m must be greater or
82// equal to n; if it is smaller, then a should be filled up to square with
83// zero rows.
84
85
68df8478 86Standard_EXPORT Standard_Integer SVD_Decompose(math_Matrix& a,
7fd59977 87 math_Vector& w,
88 math_Matrix& v,
89 math_Vector& rv1);
90
91
92// Idem to the previous LU_Decompose function. But the input Vector vv(1..m)
93// (the number of rows a(1..m, 1..n)) is used internally as a scratch area.
94
95
68df8478 96Standard_EXPORT void SVD_Solve(const math_Matrix& u,
7fd59977 97 const math_Vector& w,
98 const math_Matrix& v,
99 const math_Vector& b,
100 math_Vector& x);
101
102// Solves a * x = b for a vector x, where x is specified by u(1..m, 1..n),
103// w(1..n), v(1..n, 1..n) as returned by SVD_Decompose. m and n are the
104// dimensions of A, and will be equal for square matrices. b(1..m) is the
105// input right-hand side. x(1..n) is the output solution vector.
106// No input quantities are destroyed, so the routine may be called
107// sequentially with different b's.
108
109
110
68df8478 111Standard_EXPORT Standard_Integer DACTCL_Decompose(math_Vector& a, const math_IntegerVector& indx,
7fd59977 112 const Standard_Real MinPivot = 1.e-20);
113
114// Given a SYMMETRIC matrix a, this routine computes its
115// LU decomposition.
116// a is given through a vector of its non zero components of the upper
117// triangular matrix.
118// indx is the indice vector of the diagonal elements of a.
119// a is replaced by its LU decomposition.
120// The range of the matrix is n = indx.Length(),
121// and a.Length() = indx(n).
122
123
124
68df8478 125Standard_EXPORT Standard_Integer DACTCL_Solve(const math_Vector& a, math_Vector& b,
7fd59977 126 const math_IntegerVector& indx,
127 const Standard_Real MinPivot = 1.e-20);
128
129// Solves a * x = b for a vector x and a matrix a coming from DACTCL_Decompose.
130// indx is the same vector as in DACTCL_Decompose.
131// the vector b is replaced by the vector solution x.
132
133
134
135
68df8478 136Standard_EXPORT Standard_Integer Jacobi(math_Matrix& a, math_Vector& d, math_Matrix& v, Standard_Integer& nrot);
7fd59977 137
138// Computes all eigenvalues and eigenvectors of a real symmetric matrix
139// a(1..n, 1..n). On output, elements of a above the diagonal are destroyed.
140// d(1..n) returns the eigenvalues of a. v(1..n, 1..n) is a matrix whose
141// columns contain, on output, the normalized eigenvectors of a. nrot returns
142// the number of Jacobi rotations that were required.
143// Eigenvalues are sorted into descending order, and eigenvectors are
144// arranges correspondingly.
145
7fd59977 146#endif
147
148
149
150
151
152
153
154
155