Skip to content

Python wrapper for the bounded variable least squares algorithm by Lawson and Hanson

License

Notifications You must be signed in to change notification settings

treverhines/BVLS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BVLS

Description

This is a python wrapper for the bounded variable least squares (BVLS) solver (the fortran source code has been distributed under the GNU LGPL license and can be found here). The algorithm finds the vector m such that G.dot(m) is the best prediction to the observation vector d in a least squares sense with the constraint that bounds[0] >= m and bounds[1] <= m.

Installation

Compiling the Fortran code and creating the python wrapper is done with the following shell commands

$ git clone http://www.github.com/treverhines/BVLS 
$ cd BVLS 
$ python setup.py install 

This will install a python module named bvls which gives access to all the subroutines in bvls.f90.

Usage

The following python code sets up and solves a bounded value least squares problem

import bvls
import numpy as np
G = np.random.random((10,2))
m = np.array([1.0,2.0])
d = G.dot(m)    
lower_bounds = np.array([0.0,0.0])
upper_bounds = np.array([1.5,1.5])
bounds = [lower_bounds,upper_bounds]
soln = bvls.bvls(G,d,bounds)

See the documentation in bvls.f90 for additional details

About

Python wrapper for the bounded variable least squares algorithm by Lawson and Hanson

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published