Changeset 1566 in Sophya
- Timestamp:
- Jul 5, 2001, 5:45:50 PM (24 years ago)
- Location:
- trunk/SophyaExt/LinAlg
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/LinAlg/intflapack.cc
r1494 r1566 154 154 } 155 155 156 //! Interface to Lapack least squares solver driver s/d/c/zgels(). 157 /*! Solves the linear least squares problem defined by an m-by-n matrix 158 \b a and an m element vector \b b . 159 A solution \b x to the overdetermined system of linear equations 160 b = a * x is computed, minimizing the norm of b-a*x. 161 Underdetermined systems (m<n) are not yet handled. 162 Inout arrays should have FortranMemory mapping (column packed). 163 \param a : input matrix, overwritten on output 164 \param b : input-output, input vector b, contains x on exit. 165 \return : return code from lapack driver _gels() 166 \warning : b is not resized. 167 */ 168 /* 169 $CHECK$ - A faire - cas m<n 170 If the linear system is underdetermined, the minimum norm 171 solution is computed. 172 */ 173 156 174 template <class T> 157 175 int LapackServer<T>::LeastSquareSolve(TArray<T>& a, TArray<T> & b) … … 170 188 171 189 if (!a.IsPacked(rowa) || !b.IsPacked(rowb)) 172 throw(SzMismatchError("LapackServer::LinSolve(a,b) a Or b Not Column Packed")); 173 174 if ( a.Size(rowa) < a.Size(cola)) 175 throw(SzMismatchError("LapackServer::LeastSquareSolve(a,b) NRows<NCols ")); 176 190 throw(SzMismatchError("LapackServer::LeastSquareSolve(a,b) a Or b Not Column Packed")); 191 192 if ( a.Size(rowa) < a.Size(cola)) { // $CHECK$ - m<n a changer 193 cout << " LapackServer<T>::LeastSquareSolve() - m<n - Not yet implemented for " 194 << " underdetermined systems ! " << endl; 195 throw(SzMismatchError("LapackServer::LeastSquareSolve(a,b) NRows<NCols - ")); 196 } 177 197 int_4 m = a.Size(rowa); 178 198 int_4 n = a.Size(cola); -
trunk/SophyaExt/LinAlg/intflapack.h
r1494 r1566 42 42 { LapackServer<T> lps; return( lps.LinSolve(a, b) ); } 43 43 44 /*! \ingroup LinAlg 45 \fn LapackLeastSquareSolve(TArray<T>&, TArray<T> &) 46 \brief Solves the linear least squares problem A*X - B 47 */ 44 48 template <class T> 45 49 inline int LapackLeastSquareSolve(TArray<T>& a, TArray<T> & b)
Note:
See TracChangeset
for help on using the changeset viewer.