mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-02 14:45:15 +02:00
Merge branch 'devel' of https://github.com/SheffieldML/GPy into devel
This commit is contained in:
commit
66daf2ad45
2 changed files with 14 additions and 10 deletions
|
|
@ -325,6 +325,7 @@ def symmetrify(A, upper=False):
|
||||||
"""
|
"""
|
||||||
N, M = A.shape
|
N, M = A.shape
|
||||||
assert N == M
|
assert N == M
|
||||||
|
|
||||||
c_contig_code = """
|
c_contig_code = """
|
||||||
int iN;
|
int iN;
|
||||||
for (int i=1; i<N; i++){
|
for (int i=1; i<N; i++){
|
||||||
|
|
@ -343,6 +344,8 @@ def symmetrify(A, upper=False):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
N = int(N) # for safe type casting
|
||||||
if A.flags['C_CONTIGUOUS'] and upper:
|
if A.flags['C_CONTIGUOUS'] and upper:
|
||||||
weave.inline(f_contig_code, ['A', 'N'], extra_compile_args=['-O3'])
|
weave.inline(f_contig_code, ['A', 'N'], extra_compile_args=['-O3'])
|
||||||
elif A.flags['C_CONTIGUOUS'] and not upper:
|
elif A.flags['C_CONTIGUOUS'] and not upper:
|
||||||
|
|
@ -403,4 +406,3 @@ def backsub_both_sides(L, X, transpose='left'):
|
||||||
else:
|
else:
|
||||||
tmp, _ = lapack.dtrtrs(L, np.asfortranarray(X), lower=1, trans=0)
|
tmp, _ = lapack.dtrtrs(L, np.asfortranarray(X), lower=1, trans=0)
|
||||||
return lapack.dtrtrs(L, np.asfortranarray(tmp.T), lower=1, trans=0)[0].T
|
return lapack.dtrtrs(L, np.asfortranarray(tmp.T), lower=1, trans=0)[0].T
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ def fast_array_equal(A, B):
|
||||||
int i, j;
|
int i, j;
|
||||||
return_val = 1;
|
return_val = 1;
|
||||||
|
|
||||||
#pragma omp parallel for private(i, j)
|
// #pragma omp parallel for private(i, j)
|
||||||
for(i=0;i<N;i++){
|
for(i=0;i<N;i++){
|
||||||
for(j=0;j<D;j++){
|
for(j=0;j<D;j++){
|
||||||
if(A(i, j) != B(i, j)){
|
if(A(i, j) != B(i, j)){
|
||||||
|
|
@ -76,7 +76,7 @@ def fast_array_equal(A, B):
|
||||||
int i, j, z;
|
int i, j, z;
|
||||||
return_val = 1;
|
return_val = 1;
|
||||||
|
|
||||||
#pragma omp parallel for private(i, j, z)
|
// #pragma omp parallel for private(i, j, z)
|
||||||
for(i=0;i<N;i++){
|
for(i=0;i<N;i++){
|
||||||
for(j=0;j<D;j++){
|
for(j=0;j<D;j++){
|
||||||
for(z=0;z<Q;z++){
|
for(z=0;z<Q;z++){
|
||||||
|
|
@ -90,7 +90,7 @@ def fast_array_equal(A, B):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
support_code = """
|
support_code = """
|
||||||
#include <omp.h>
|
// #include <omp.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -107,15 +107,17 @@ def fast_array_equal(A, B):
|
||||||
return False
|
return False
|
||||||
elif A.shape == B.shape:
|
elif A.shape == B.shape:
|
||||||
if A.ndim == 2:
|
if A.ndim == 2:
|
||||||
N, D = A.shape
|
N, D = [int(i) for i in A.shape]
|
||||||
value = weave.inline(code2, support_code=support_code, libraries=['gomp'],
|
value = weave.inline(code2, support_code=support_code,
|
||||||
arg_names=['A', 'B', 'N', 'D'],
|
arg_names=['A', 'B', 'N', 'D'],
|
||||||
type_converters=weave.converters.blitz,**weave_options)
|
type_converters=weave.converters.blitz)
|
||||||
|
# libraries=['gomp'], **weave_options)
|
||||||
elif A.ndim == 3:
|
elif A.ndim == 3:
|
||||||
N, D, Q = A.shape
|
N, D, Q = [int(i) for i in A.shape]
|
||||||
value = weave.inline(code3, support_code=support_code, libraries=['gomp'],
|
value = weave.inline(code3, support_code=support_code,
|
||||||
arg_names=['A', 'B', 'N', 'D', 'Q'],
|
arg_names=['A', 'B', 'N', 'D', 'Q'],
|
||||||
type_converters=weave.converters.blitz,**weave_options)
|
type_converters=weave.converters.blitz)
|
||||||
|
#libraries=['gomp'], **weave_options)
|
||||||
else:
|
else:
|
||||||
value = np.array_equal(A,B)
|
value = np.array_equal(A,B)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue