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>
30 class StdFail_NotDone;
31 class Standard_DimensionError;
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.
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);
52 //! Returns true if the computations are successful, otherwise returns false.
53 Standard_Boolean IsDone() const;
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
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.
64 Standard_EXPORT void Solve (const math_Vector& B, math_Vector& X, const Standard_Real Eps = 1.0e-6);
66 //! Computes the inverse Inv of matrix A such as A * Inverse = Identity.
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.
71 Standard_EXPORT void PseudoInverse (math_Matrix& Inv, const Standard_Real Eps = 1.0e-6);
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;
90 Standard_Boolean Done;
94 Standard_Integer RowA;
100 #include <math_SVD.lxx>
106 #endif // _math_SVD_HeaderFile