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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _math_SVD_HeaderFile
18 #define _math_SVD_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
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>
32 //! SVD implements the solution of a set of N linear equations
33 //! of M unknowns without condition on N or M. The Singular
34 //! Value Decomposition algorithm is used. For singular or
35 //! nearly singular matrices SVD is a better choice than Gauss
36 //! or GaussLeastSquare.
45 //! Given as input an n X m matrix A with n < m, n = m or n > m
46 //! this constructor performs the Singular Value Decomposition.
47 Standard_EXPORT math_SVD(const math_Matrix& A);
49 //! Returns true if the computations are successful, otherwise returns false.
50 Standard_Boolean IsDone() const;
53 //! Given the input Vector B this routine solves the set of linear
54 //! equations A . X = B.
55 //! Exception NotDone is raised if the decomposition of A was not done
57 //! Exception DimensionError is raised if the range of B is not
58 //! equal to the rowrange of A.
59 //! Exception DimensionError is raised if the range of X is not
60 //! equal to the colrange of A.
61 Standard_EXPORT void Solve (const math_Vector& B, math_Vector& X, const Standard_Real Eps = 1.0e-6);
63 //! Computes the inverse Inv of matrix A such as A * Inverse = Identity.
65 //! StdFail_NotDone if the algorithm fails (and IsDone returns false).
66 //! Standard_DimensionError if the ranges of Inv are
67 //! compatible with the ranges of A.
68 Standard_EXPORT void PseudoInverse (math_Matrix& Inv, const Standard_Real Eps = 1.0e-6);
70 //! Prints information on the current state of the object.
71 //! Is used to redefine the operator <<.
72 Standard_EXPORT void Dump (Standard_OStream& o) const;
87 Standard_Boolean Done;
91 Standard_Integer RowA;
97 #include <math_SVD.lxx>
103 #endif // _math_SVD_HeaderFile