Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:15

0001 // Created on: 1991-05-13
0002 // Created by: Laurent PAINNOT
0003 // Copyright (c) 1991-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _math_SVD_HeaderFile
0018 #define _math_SVD_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <math_Matrix.hxx>
0024 #include <math_Vector.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <Standard_OStream.hxx>
0027 
0028 
0029 //! SVD implements the solution of a set of N linear equations
0030 //! of M unknowns without condition on N or M. The Singular
0031 //! Value Decomposition algorithm is used. For singular or
0032 //! nearly singular matrices SVD is a better choice than Gauss
0033 //! or GaussLeastSquare.
0034 class math_SVD 
0035 {
0036 public:
0037 
0038   DEFINE_STANDARD_ALLOC
0039 
0040   
0041 
0042   //! Given as input an n X m matrix A with n < m, n = m or n > m
0043   //! this constructor performs the Singular Value Decomposition.
0044   Standard_EXPORT math_SVD(const math_Matrix& A);
0045   
0046   //! Returns true if the computations are successful, otherwise returns false.
0047     Standard_Boolean IsDone() const;
0048   
0049 
0050   //! Given the input Vector B this routine solves the set of linear
0051   //! equations A . X = B.
0052   //! Exception NotDone is raised if the decomposition of A was not done
0053   //! successfully.
0054   //! Exception DimensionError is raised if the range of B is not
0055   //! equal to the rowrange of A.
0056   //! Exception DimensionError is raised if the range of X is not
0057   //! equal to the colrange of A.
0058   Standard_EXPORT void Solve (const math_Vector& B, math_Vector& X, const Standard_Real Eps = 1.0e-6);
0059   
0060   //! Computes the inverse Inv of matrix A such as A * Inverse = Identity.
0061   //! Exceptions
0062   //! StdFail_NotDone if the algorithm fails (and IsDone returns false).
0063   //! Standard_DimensionError if the ranges of Inv are
0064   //! compatible with the ranges of A.
0065   Standard_EXPORT void PseudoInverse (math_Matrix& Inv, const Standard_Real Eps = 1.0e-6);
0066   
0067   //! Prints information on the current state of the object.
0068   //! Is used to redefine the operator <<.
0069   Standard_EXPORT void Dump (Standard_OStream& o) const;
0070 
0071 
0072 
0073 
0074 protected:
0075 
0076 
0077 
0078 
0079 
0080 private:
0081 
0082 
0083 
0084   Standard_Boolean Done;
0085   math_Matrix U;
0086   math_Matrix V;
0087   math_Vector Diag;
0088   Standard_Integer RowA;
0089 
0090 
0091 };
0092 
0093 
0094 #include <math_SVD.lxx>
0095 
0096 
0097 
0098 
0099 
0100 #endif // _math_SVD_HeaderFile