Somewhat fast updating and downdating of Cholesky factors in Python
Python
Switch branches/tags
Nothing to show
Latest commit 0d92a52 Apr 6, 2016 @jcrudy jcrudy Merge pull request #2 from bnaul/patch-1
Update README.md
Permalink
Failed to load latest commit information.
bin Added more documentation and added Cython as dependency Feb 16, 2013
choldate
.gitignore Python 3 fix Mar 24, 2016
CHANGES.txt Added license and release date Feb 16, 2013
LICENSE.txt Added license and release date Feb 16, 2013
MANIFEST.in
README.md Update README.md Apr 5, 2016
setup.py

README.md

choldate

Somewhat fast updating and downdating of Cholesky factors in Python

##installation

Install from GitHub: pip install git+git://github.com/jcrudy/choldate.git

Or, clone the GitHub repository and install from source, e.g.,

  1. git clone git://github.com/jcrudy/choldate.git
  2. cd choldate; python setup.py install

I am new to packaging Python modules. If it doesn't work on your system, get in touch and I'll try to help you.

##usage

from choldate import cholupdate, choldowndate
import numpy

#Create a random positive definite matrix, V
numpy.random.seed(1)
X = numpy.random.normal(size=(100,10))
V = numpy.dot(X.transpose(),X)

#Calculate the upper Cholesky factor, R
R = numpy.linalg.cholesky(V).transpose()

#Create a random update vector, u
u = numpy.random.normal(size=R.shape[0])

#Calculate the updated positive definite matrix, V1, and its Cholesky factor, R1
V1 = V + numpy.outer(u,u)
R1 = numpy.linalg.cholesky(V1).transpose()

#The following is equivalent to the above
R1_ = R.copy()
cholupdate(R1_,u.copy())
assert(numpy.all((R1 - R1_)**2 < 1e-16))

#And downdating is the inverse of updating
R_ = R1.copy()
choldowndate(R_,u.copy())
assert(numpy.all((R - R_)**2 < 1e-16))