mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-30 14:35:15 +02:00
Commented out cholupdate since it uses weave and appears not to be used
This commit is contained in:
parent
e5080eb0ad
commit
046bd3d955
1 changed files with 29 additions and 28 deletions
|
|
@ -489,34 +489,35 @@ def symmetrify_numpy(A, upper=False):
|
||||||
else:
|
else:
|
||||||
A[triu] = A.T[triu]
|
A[triu] = A.T[triu]
|
||||||
|
|
||||||
def cholupdate(L, x):
|
#This function appears to be unused. It's use of weave makes it problematic
|
||||||
"""
|
#Commenting out for now
|
||||||
update the LOWER cholesky factor of a pd matrix IN PLACE
|
#def cholupdate(L, x):
|
||||||
|
# """
|
||||||
if L is the lower chol. of K, then this function computes L\_
|
# update the LOWER cholesky factor of a pd matrix IN PLACE
|
||||||
where L\_ is the lower chol of K + x*x^T
|
#
|
||||||
|
# if L is the lower chol. of K, then this function computes L\_
|
||||||
"""
|
# where L\_ is the lower chol of K + x*x^T
|
||||||
support_code = """
|
# """
|
||||||
#include <math.h>
|
# support_code = """
|
||||||
"""
|
# #include <math.h>
|
||||||
code = """
|
# """
|
||||||
double r,c,s;
|
# code = """
|
||||||
int j,i;
|
# double r,c,s;
|
||||||
for(j=0; j<N; j++){
|
# int j,i;
|
||||||
r = sqrt(L(j,j)*L(j,j) + x(j)*x(j));
|
# for(j=0; j<N; j++){
|
||||||
c = r / L(j,j);
|
# r = sqrt(L(j,j)*L(j,j) + x(j)*x(j));
|
||||||
s = x(j) / L(j,j);
|
# c = r / L(j,j);
|
||||||
L(j,j) = r;
|
# s = x(j) / L(j,j);
|
||||||
for (i=j+1; i<N; i++){
|
# L(j,j) = r;
|
||||||
L(i,j) = (L(i,j) + s*x(i))/c;
|
# for (i=j+1; i<N; i++){
|
||||||
x(i) = c*x(i) - s*L(i,j);
|
# L(i,j) = (L(i,j) + s*x(i))/c;
|
||||||
}
|
# x(i) = c*x(i) - s*L(i,j);
|
||||||
}
|
# }
|
||||||
"""
|
# }
|
||||||
x = x.copy()
|
# """
|
||||||
N = x.size
|
# x = x.copy()
|
||||||
weave.inline(code, support_code=support_code, arg_names=['N', 'L', 'x'], type_converters=weave.converters.blitz)
|
# N = x.size
|
||||||
|
# weave.inline(code, support_code=support_code, arg_names=['N', 'L', 'x'], type_converters=weave.converters.blitz)
|
||||||
|
|
||||||
def backsub_both_sides(L, X, transpose='left'):
|
def backsub_both_sides(L, X, transpose='left'):
|
||||||
""" Return L^-T * X * L^-1, assumuing X is symmetrical and L is lower cholesky"""
|
""" Return L^-T * X * L^-1, assumuing X is symmetrical and L is lower cholesky"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue