0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[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>
42cf5bc1 22
42cf5bc1 23#include <math_Matrix.hxx>
24#include <math_Vector.hxx>
25#include <Standard_Integer.hxx>
42cf5bc1 26#include <Standard_OStream.hxx>
42cf5bc1 27
28
29//! SVD implements the solution of a set of N linear equations
30//! of M unknowns without condition on N or M. The Singular
31//! Value Decomposition algorithm is used. For singular or
32//! nearly singular matrices SVD is a better choice than Gauss
33//! or GaussLeastSquare.
34class math_SVD
35{
36public:
37
38 DEFINE_STANDARD_ALLOC
39
40
41
42 //! Given as input an n X m matrix A with n < m, n = m or n > m
43 //! this constructor performs the Singular Value Decomposition.
44 Standard_EXPORT math_SVD(const math_Matrix& A);
45
46 //! Returns true if the computations are successful, otherwise returns false.
47 Standard_Boolean IsDone() const;
48
49
50 //! Given the input Vector B this routine solves the set of linear
51 //! equations A . X = B.
52 //! Exception NotDone is raised if the decomposition of A was not done
53 //! successfully.
54 //! Exception DimensionError is raised if the range of B is not
55 //! equal to the rowrange of A.
56 //! Exception DimensionError is raised if the range of X is not
57 //! equal to the colrange of A.
18434846 58 Standard_EXPORT void Solve (const math_Vector& B, math_Vector& X, const Standard_Real Eps = 1.0e-6);
42cf5bc1 59
60 //! Computes the inverse Inv of matrix A such as A * Inverse = Identity.
61 //! Exceptions
62 //! StdFail_NotDone if the algorithm fails (and IsDone returns false).
63 //! Standard_DimensionError if the ranges of Inv are
64 //! compatible with the ranges of A.
18434846 65 Standard_EXPORT void PseudoInverse (math_Matrix& Inv, const Standard_Real Eps = 1.0e-6);
42cf5bc1 66
67 //! Prints information on the current state of the object.
68 //! Is used to redefine the operator <<.
69 Standard_EXPORT void Dump (Standard_OStream& o) const;
70
71
72
73
74protected:
75
76
77
78
79
80private:
81
82
83
84 Standard_Boolean Done;
85 math_Matrix U;
86 math_Matrix V;
87 math_Vector Diag;
88 Standard_Integer RowA;
89
90
91};
92
93
94#include <math_SVD.lxx>
95
96
97
98
99
100#endif // _math_SVD_HeaderFile