Skip to content

Instantly share code, notes, and snippets.

@jgomezdans
Created November 23, 2009 17:11
Show Gist options
  • Save jgomezdans/241201 to your computer and use it in GitHub Desktop.
Save jgomezdans/241201 to your computer and use it in GitHub Desktop.
# Find Cholesky decomposition
cvalue = numpy.linalg.cholesky( covar_matrix )
# Locally store size of matrix
dims = covar_matrix.shape
# Add normal deviate to value, preserving lower triangular
covar_proposed = numpy.multiply( cvalue + random_update, numpy.tri(dims[0]))
# Square and replace
covar_proposed = covar_proposed*transpose(covar_proposed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment