|
||||
File indexing completed on 2025-01-18 10:04:15
0001 // Copyright (c) 1997-1999 Matra Datavision 0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0003 // 0004 // This file is part of Open CASCADE Technology software library. 0005 // 0006 // This library is free software; you can redistribute it and/or modify it under 0007 // the terms of the GNU Lesser General Public License version 2.1 as published 0008 // by the Free Software Foundation, with special exception defined in the file 0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0010 // distribution for complete text of the license and disclaimer of any warranty. 0011 // 0012 // Alternatively, this file may be used under the terms of Open CASCADE 0013 // commercial license or contractual agreement. 0014 0015 #ifndef math_Recipes_HeaderFile 0016 #define math_Recipes_HeaderFile 0017 0018 #include <Message_ProgressRange.hxx> 0019 0020 #include <NCollection_Allocator.hxx> 0021 0022 template<typename T> class math_VectorBase; 0023 using math_IntegerVector = math_VectorBase<int>; 0024 using math_Vector = math_VectorBase<double>; 0025 class math_Matrix; 0026 0027 const Standard_Integer math_Status_UserAborted = -1; 0028 const Standard_Integer math_Status_OK = 0; 0029 const Standard_Integer math_Status_SingularMatrix = 1; 0030 const Standard_Integer math_Status_ArgumentError = 2; 0031 const Standard_Integer math_Status_NoConvergence = 3; 0032 0033 Standard_EXPORT Standard_Integer LU_Decompose(math_Matrix& a, 0034 math_IntegerVector& indx, 0035 Standard_Real& d, 0036 Standard_Real TINY = 1.0e-20, 0037 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0038 0039 // Given a matrix a(1..n, 1..n), this routine computes its LU decomposition, 0040 // The matrix a is replaced by this LU decomposition and the vector indx(1..n) 0041 // is an output which records the row permutation effected by the partial 0042 // pivoting; d is output as +1 or -1 depending on whether the number of row 0043 // interchanges was even or odd. 0044 0045 Standard_EXPORT Standard_Integer LU_Decompose(math_Matrix& a, 0046 math_IntegerVector& indx, 0047 Standard_Real& d, 0048 math_Vector& vv, 0049 Standard_Real TINY = 1.0e-30, 0050 const Message_ProgressRange& theProgress = Message_ProgressRange()); 0051 0052 // Idem to the previous LU_Decompose function. But the input Vector vv(1..n) is 0053 // used internally as a scratch area. 0054 0055 0056 Standard_EXPORT void LU_Solve(const math_Matrix& a, 0057 const math_IntegerVector& indx, 0058 math_Vector& b); 0059 0060 // Solves a * x = b for a vector x, where x is specified by a(1..n, 1..n), 0061 // indx(1..n) as returned by LU_Decompose. n is the dimension of the 0062 // square matrix A. b(1..n) is the input right-hand side and will be 0063 // replaced by the solution vector.Neither a and indx are destroyed, so 0064 // the routine may be called sequentially with different b's. 0065 0066 0067 Standard_EXPORT Standard_Integer LU_Invert(math_Matrix& a); 0068 0069 // Given a matrix a(1..n, 1..n) this routine computes its inverse. The matrix 0070 // a is replaced by its inverse. 0071 0072 0073 Standard_EXPORT Standard_Integer SVD_Decompose(math_Matrix& a, 0074 math_Vector& w, 0075 math_Matrix& v); 0076 0077 // Given a matrix a(1..m, 1..n), this routine computes its singular value 0078 // decomposition, a = u * w * transposed(v). The matrix u replaces a on 0079 // output. The diagonal matrix of singular values w is output as a vector 0080 // w(1..n). The matrix v is output as v(1..n, 1..n). m must be greater or 0081 // equal to n; if it is smaller, then a should be filled up to square with 0082 // zero rows. 0083 0084 0085 Standard_EXPORT Standard_Integer SVD_Decompose(math_Matrix& a, 0086 math_Vector& w, 0087 math_Matrix& v, 0088 math_Vector& rv1); 0089 0090 0091 // Idem to the previous LU_Decompose function. But the input Vector vv(1..m) 0092 // (the number of rows a(1..m, 1..n)) is used internally as a scratch area. 0093 0094 0095 Standard_EXPORT void SVD_Solve(const math_Matrix& u, 0096 const math_Vector& w, 0097 const math_Matrix& v, 0098 const math_Vector& b, 0099 math_Vector& x); 0100 0101 // Solves a * x = b for a vector x, where x is specified by u(1..m, 1..n), 0102 // w(1..n), v(1..n, 1..n) as returned by SVD_Decompose. m and n are the 0103 // dimensions of A, and will be equal for square matrices. b(1..m) is the 0104 // input right-hand side. x(1..n) is the output solution vector. 0105 // No input quantities are destroyed, so the routine may be called 0106 // sequentially with different b's. 0107 0108 0109 0110 Standard_EXPORT Standard_Integer DACTCL_Decompose(math_Vector& a, const math_IntegerVector& indx, 0111 const Standard_Real MinPivot = 1.e-20); 0112 0113 // Given a SYMMETRIC matrix a, this routine computes its 0114 // LU decomposition. 0115 // a is given through a vector of its non zero components of the upper 0116 // triangular matrix. 0117 // indx is the indice vector of the diagonal elements of a. 0118 // a is replaced by its LU decomposition. 0119 // The range of the matrix is n = indx.Length(), 0120 // and a.Length() = indx(n). 0121 0122 0123 0124 Standard_EXPORT Standard_Integer DACTCL_Solve(const math_Vector& a, math_Vector& b, 0125 const math_IntegerVector& indx, 0126 const Standard_Real MinPivot = 1.e-20); 0127 0128 // Solves a * x = b for a vector x and a matrix a coming from DACTCL_Decompose. 0129 // indx is the same vector as in DACTCL_Decompose. 0130 // the vector b is replaced by the vector solution x. 0131 0132 0133 0134 0135 Standard_EXPORT Standard_Integer Jacobi(math_Matrix& a, math_Vector& d, math_Matrix& v, Standard_Integer& nrot); 0136 0137 // Computes all eigenvalues and eigenvectors of a real symmetric matrix 0138 // a(1..n, 1..n). On output, elements of a above the diagonal are destroyed. 0139 // d(1..n) returns the eigenvalues of a. v(1..n, 1..n) is a matrix whose 0140 // columns contain, on output, the normalized eigenvectors of a. nrot returns 0141 // the number of Jacobi rotations that were required. 0142 // Eigenvalues are sorted into descending order, and eigenvectors are 0143 // arranges correspondingly. 0144 0145 #endif 0146 0147 0148 0149 0150 0151 0152 0153 0154
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |