|
||||
File indexing completed on 2025-01-18 10:04:14
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_GaussLeastSquare_HeaderFile 0018 #define _math_GaussLeastSquare_HeaderFile 0019 0020 #include <Standard.hxx> 0021 #include <Standard_DefineAlloc.hxx> 0022 #include <Standard_Handle.hxx> 0023 0024 #include <math_Matrix.hxx> 0025 #include <math_IntegerVector.hxx> 0026 #include <math_Vector.hxx> 0027 #include <Standard_OStream.hxx> 0028 0029 0030 0031 //! This class implements the least square solution of a set of 0032 //! n linear equations of m unknowns (n >= m) using the gauss LU 0033 //! decomposition algorithm. 0034 //! This algorithm is more likely subject to numerical instability 0035 //! than math_SVD. 0036 class math_GaussLeastSquare 0037 { 0038 public: 0039 0040 DEFINE_STANDARD_ALLOC 0041 0042 0043 //! Given an input n X m matrix A with n >= m this constructor 0044 //! performs the LU decomposition with partial pivoting 0045 //! (interchange of rows) of the matrix AA = A.Transposed() * A; 0046 //! This LU decomposition is stored internally and may be used 0047 //! to do subsequent calculation. 0048 //! If the largest pivot found is less than MinPivot the matrix <A> 0049 //! is considered as singular. 0050 Standard_EXPORT math_GaussLeastSquare(const math_Matrix& A, const Standard_Real MinPivot = 1.0e-20); 0051 0052 //! Returns true if the computations are successful, otherwise returns false.e 0053 Standard_Boolean IsDone() const; 0054 0055 //! Given the input Vector <B> this routine solves the set 0056 //! of linear equations A . X = B. 0057 //! Exception NotDone is raised if the decomposition of A was 0058 //! not done successfully. 0059 //! Exception DimensionError is raised if the range of B Inv is 0060 //! not equal to the rowrange of A. 0061 //! Exception DimensionError is raised if the range of X Inv is 0062 //! not equal to the colrange of A. 0063 Standard_EXPORT void Solve (const math_Vector& B, math_Vector& X) const; 0064 0065 //! Prints on the stream o information on the current state 0066 //! of the object. 0067 //! Is used to redefine the operator <<. 0068 Standard_EXPORT void Dump (Standard_OStream& o) const; 0069 0070 0071 0072 0073 protected: 0074 0075 0076 0077 Standard_Boolean Singular; 0078 math_Matrix LU; 0079 math_Matrix A2; 0080 math_IntegerVector Index; 0081 Standard_Real D; 0082 0083 0084 private: 0085 0086 0087 0088 Standard_Boolean Done; 0089 0090 0091 }; 0092 0093 0094 #include <math_GaussLeastSquare.lxx> 0095 0096 0097 0098 0099 0100 #endif // _math_GaussLeastSquare_HeaderFile
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |