Generalized Linear Least Squares Problems

Robert Kern rkern at ucsd.edu
Wed Jun 1 16:06:13 EDT 2005


Colin J. Williams wrote:
> Tim Leslie wrote:
> 
>>On 31 May 2005 03:12:49 -0700, venkat <vvenkatagr at yahoo.com> wrote:
>>
>>>Hi,
>>>
>>>I want to solve linear least sqaure problem( min||c-Ax||2 subject to
>>>Bx=d ). How do I do it in python. lapack has a routine for doing this
>>>(DGGLSE). Can I access this from python?
>>
>>Check out scipy, in particular the linear algebra package.
>>
>>http://www.scipy.org/documentation/apidocs/scipy/scipy.linalg.html
>>
>>Cheers,
>>
>>Tim
> 
> Or you could try numarray, available for use with Python 2.4

Neither of these solve the generalized least squares problem.

However, it is easier to add to scipy.linalg. Look at the file 
scipy/Lib/linalg/generic_flapack.py and copy and modify the block for 
DGELSS to work for DGGLSE. Then modify the Python function 
scipy.linalg.lstsq to take the optional extra arguments and do the 
generalized problem. Finally, contribute your changes back to scipy and 
win the accolades you deserve.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list