0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / math / math_SVD.hxx
CommitLineData
42cf5bc1 1// Created on: 1991-05-13
2// Created by: Laurent PAINNOT
3// Copyright (c) 1991-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _math_SVD_HeaderFile
18#define _math_SVD_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Standard_Boolean.hxx>
25#include <math_Matrix.hxx>
26#include <math_Vector.hxx>
27#include <Standard_Integer.hxx>
28#include <Standard_Real.hxx>
29#include <Standard_OStream.hxx>
30class StdFail_NotDone;
31class Standard_DimensionError;
32class math_Matrix;
33
34
35//! SVD implements the solution of a set of N linear equations
36//! of M unknowns without condition on N or M. The Singular
37//! Value Decomposition algorithm is used. For singular or
38//! nearly singular matrices SVD is a better choice than Gauss
39//! or GaussLeastSquare.
40class math_SVD
41{
42public:
43
44 DEFINE_STANDARD_ALLOC
45
46
47
48 //! Given as input an n X m matrix A with n < m, n = m or n > m
49 //! this constructor performs the Singular Value Decomposition.
50 Standard_EXPORT math_SVD(const math_Matrix& A);
51
52 //! Returns true if the computations are successful, otherwise returns false.
53 Standard_Boolean IsDone() const;
54
55
56 //! Given the input Vector B this routine solves the set of linear
57 //! equations A . X = B.
58 //! Exception NotDone is raised if the decomposition of A was not done
59 //! successfully.
60 //! Exception DimensionError is raised if the range of B is not
61 //! equal to the rowrange of A.
62 //! Exception DimensionError is raised if the range of X is not
63 //! equal to the colrange of A.
18434846 64 Standard_EXPORT void Solve (const math_Vector& B, math_Vector& X, const Standard_Real Eps = 1.0e-6);
42cf5bc1 65
66 //! Computes the inverse Inv of matrix A such as A * Inverse = Identity.
67 //! Exceptions
68 //! StdFail_NotDone if the algorithm fails (and IsDone returns false).
69 //! Standard_DimensionError if the ranges of Inv are
70 //! compatible with the ranges of A.
18434846 71 Standard_EXPORT void PseudoInverse (math_Matrix& Inv, const Standard_Real Eps = 1.0e-6);
42cf5bc1 72
73 //! Prints information on the current state of the object.
74 //! Is used to redefine the operator <<.
75 Standard_EXPORT void Dump (Standard_OStream& o) const;
76
77
78
79
80protected:
81
82
83
84
85
86private:
87
88
89
90 Standard_Boolean Done;
91 math_Matrix U;
92 math_Matrix V;
93 math_Vector Diag;
94 Standard_Integer RowA;
95
96
97};
98
99
100#include <math_SVD.lxx>
101
102
103
104
105
106#endif // _math_SVD_HeaderFile