scm2cpp-learn 0.18.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scm2cpp_learn/__init__.py +3836 -0
- scm2cpp_learn/_classifiers.cp312-win_amd64.pyd +0 -0
- scm2cpp_learn/_compat.py +284 -0
- scm2cpp_learn/_generated/__init__.py +0 -0
- scm2cpp_learn/_generated/_loader.py +41 -0
- scm2cpp_learn/_generated/_loader_accel_cublas.py +173 -0
- scm2cpp_learn/_generated/_loader_classifiers.py +308 -0
- scm2cpp_learn/_generated/_loader_derived_blas.py +29 -0
- scm2cpp_learn/_generated/_loader_derived_cublas.py +29 -0
- scm2cpp_learn/_generated/_loader_derived_loops.py +29 -0
- scm2cpp_learn/_generated/_loader_gpu_cuda.py +313 -0
- scm2cpp_learn/_generated/_loader_gramops_blas.py +692 -0
- scm2cpp_learn/_generated/_loader_gramops_loops.py +711 -0
- scm2cpp_learn/_generated/_loader_nmf_blas.py +29 -0
- scm2cpp_learn/_generated/_loader_nmf_cublas.py +29 -0
- scm2cpp_learn/_generated/_loader_nmf_loops.py +29 -0
- scm2cpp_learn/_generated/accel_cublas/accel.cpp +24 -0
- scm2cpp_learn/_generated/accel_cublas/accel.hpp +1178 -0
- scm2cpp_learn/_generated/accel_cublas/accel_capi.cpp +76 -0
- scm2cpp_learn/_generated/classifiers.cpp +37 -0
- scm2cpp_learn/_generated/classifiers.hpp +3745 -0
- scm2cpp_learn/_generated/classifiers_capi.cpp +115 -0
- scm2cpp_learn/_generated/derived_blas/lasso_design.cpp +5 -0
- scm2cpp_learn/_generated/derived_blas/lasso_design.hpp +156 -0
- scm2cpp_learn/_generated/derived_blas/lasso_design_capi.cpp +19 -0
- scm2cpp_learn/_generated/derived_cublas/lasso_design.cpp +5 -0
- scm2cpp_learn/_generated/derived_cublas/lasso_design.hpp +158 -0
- scm2cpp_learn/_generated/derived_cublas/lasso_design_capi.cpp +19 -0
- scm2cpp_learn/_generated/derived_loops/lasso_design.cpp +5 -0
- scm2cpp_learn/_generated/derived_loops/lasso_design.hpp +179 -0
- scm2cpp_learn/_generated/derived_loops/lasso_design_capi.cpp +19 -0
- scm2cpp_learn/_generated/gpu_cuda/gpu.cpp +37 -0
- scm2cpp_learn/_generated/gpu_cuda/gpu.hpp +3846 -0
- scm2cpp_learn/_generated/gpu_cuda/gpu_capi.cpp +308 -0
- scm2cpp_learn/_generated/gramops_blas/gramops.cpp +82 -0
- scm2cpp_learn/_generated/gramops_blas/gramops.hpp +5411 -0
- scm2cpp_learn/_generated/gramops_blas/gramops_capi.cpp +244 -0
- scm2cpp_learn/_generated/gramops_loops/gramops.cpp +82 -0
- scm2cpp_learn/_generated/gramops_loops/gramops.hpp +6395 -0
- scm2cpp_learn/_generated/gramops_loops/gramops_capi.cpp +250 -0
- scm2cpp_learn/_generated/lasso_cov.cpp +7 -0
- scm2cpp_learn/_generated/lasso_cov.hpp +152 -0
- scm2cpp_learn/_generated/lasso_cov_capi.cpp +25 -0
- scm2cpp_learn/_generated/nmf_blas/nmf_cd.cpp +5 -0
- scm2cpp_learn/_generated/nmf_blas/nmf_cd.hpp +132 -0
- scm2cpp_learn/_generated/nmf_blas/nmf_cd_capi.cpp +19 -0
- scm2cpp_learn/_generated/nmf_cublas/nmf_cd.cpp +5 -0
- scm2cpp_learn/_generated/nmf_cublas/nmf_cd.hpp +136 -0
- scm2cpp_learn/_generated/nmf_cublas/nmf_cd_capi.cpp +19 -0
- scm2cpp_learn/_generated/nmf_loops/nmf_cd.cpp +5 -0
- scm2cpp_learn/_generated/nmf_loops/nmf_cd.hpp +167 -0
- scm2cpp_learn/_generated/nmf_loops/nmf_cd_capi.cpp +19 -0
- scm2cpp_learn/_generated/scm2cpp-blas.hpp +158 -0
- scm2cpp_learn/_generated/scm2cpp-cublas.hpp +155 -0
- scm2cpp_learn/_generated/scm2cpp-cuda.hpp +285 -0
- scm2cpp_learn/_generated/scm2cpp.hpp +1627 -0
- scm2cpp_learn/_gramops_blas.cp312-win_amd64.pyd +0 -0
- scm2cpp_learn/_lasso_cov.cp312-win_amd64.pyd +0 -0
- scm2cpp_learn/_lasso_derived_blas.cp312-win_amd64.pyd +0 -0
- scm2cpp_learn/_libfind.py +153 -0
- scm2cpp_learn/_nmf_blas.cp312-win_amd64.pyd +0 -0
- scm2cpp_learn/batch_capi.cu +428 -0
- scm2cpp_learn-0.18.0.dist-info/DELVEWHEEL +2 -0
- scm2cpp_learn-0.18.0.dist-info/METADATA +1171 -0
- scm2cpp_learn-0.18.0.dist-info/RECORD +72 -0
- scm2cpp_learn-0.18.0.dist-info/WHEEL +5 -0
- scm2cpp_learn-0.18.0.dist-info/top_level.txt +1 -0
- scm2cpp_learn.libs/.load-order-scm2cpp_learn-0.18.0 +4 -0
- scm2cpp_learn.libs/libopenblas-0486735c359a67419d8832e3c40e2837.dll +4 -0
- scm2cpp_learn.libs/msvcp140-73438573e87f9a2fd944b01def13566d.dll +0 -0
- scm2cpp_learn.libs/vcruntime140-052ad6a20d375957e82aa6a3c441ea54.dll +0 -0
- scm2cpp_learn.libs/vcruntime140_1-a198370e11c6e7469d1cf0ef5b3f433d.dll +0 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# ctypes loader for libgpu.so, generated alongside it.
|
|
2
|
+
# Arrays are numpy arrays of the declared dtype; they are made
|
|
3
|
+
# contiguous on the way in and mutated in place where the translated
|
|
4
|
+
# function mutates them.
|
|
5
|
+
import ctypes
|
|
6
|
+
import numpy as np
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from .._libfind import load_gpu_lib as _load_gpu_lib
|
|
10
|
+
|
|
11
|
+
_lib = _load_gpu_lib()
|
|
12
|
+
|
|
13
|
+
_lib.scm2cpp_eig_hypot.restype = ctypes.c_double
|
|
14
|
+
_lib.scm2cpp_eig_hypot.argtypes = [ctypes.c_double, ctypes.c_double]
|
|
15
|
+
def eig_hypot(a, b):
|
|
16
|
+
return _lib.scm2cpp_eig_hypot(a, b)
|
|
17
|
+
|
|
18
|
+
_lib.scm2cpp_sym_eigen.restype = ctypes.c_int
|
|
19
|
+
_lib.scm2cpp_sym_eigen.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
|
|
20
|
+
def sym_eigen(a, v, ev, e, m):
|
|
21
|
+
a = np.ascontiguousarray(a, dtype=np.float64)
|
|
22
|
+
v = np.ascontiguousarray(v, dtype=np.float64)
|
|
23
|
+
ev = np.ascontiguousarray(ev, dtype=np.float64)
|
|
24
|
+
e = np.ascontiguousarray(e, dtype=np.float64)
|
|
25
|
+
return _lib.scm2cpp_sym_eigen(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.size, v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.size, ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.size, e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.size, m)
|
|
26
|
+
|
|
27
|
+
_lib.scm2cpp_eig_abs.restype = ctypes.c_double
|
|
28
|
+
_lib.scm2cpp_eig_abs.argtypes = [ctypes.c_double]
|
|
29
|
+
def eig_abs(a):
|
|
30
|
+
return _lib.scm2cpp_eig_abs(a)
|
|
31
|
+
|
|
32
|
+
_lib.scm2cpp_eig_order.restype = ctypes.c_int
|
|
33
|
+
_lib.scm2cpp_eig_order.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.c_int, ctypes.c_int]
|
|
34
|
+
def eig_order(ev, ord, m):
|
|
35
|
+
ev = np.ascontiguousarray(ev, dtype=np.float64)
|
|
36
|
+
ord = np.ascontiguousarray(ord, dtype=np.int32)
|
|
37
|
+
return _lib.scm2cpp_eig_order(ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.size, ord.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), ord.size, m)
|
|
38
|
+
|
|
39
|
+
_lib.scm2cpp_sym_eigen_top.restype = ctypes.c_int
|
|
40
|
+
_lib.scm2cpp_sym_eigen_top.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
41
|
+
def sym_eigen_top(a, v, ev, e, m, k):
|
|
42
|
+
a = np.ascontiguousarray(a, dtype=np.float64)
|
|
43
|
+
v = np.ascontiguousarray(v, dtype=np.float64)
|
|
44
|
+
ev = np.ascontiguousarray(ev, dtype=np.float64)
|
|
45
|
+
e = np.ascontiguousarray(e, dtype=np.float64)
|
|
46
|
+
return _lib.scm2cpp_sym_eigen_top(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.size, v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.size, ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.size, e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.size, m, k)
|
|
47
|
+
|
|
48
|
+
_lib.scm2cpp_sym_eigen_gen.restype = ctypes.c_int
|
|
49
|
+
_lib.scm2cpp_sym_eigen_gen.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
|
|
50
|
+
def sym_eigen_gen(a, b, v, ev, e, m):
|
|
51
|
+
a = np.ascontiguousarray(a, dtype=np.float64)
|
|
52
|
+
b = np.ascontiguousarray(b, dtype=np.float64)
|
|
53
|
+
v = np.ascontiguousarray(v, dtype=np.float64)
|
|
54
|
+
ev = np.ascontiguousarray(ev, dtype=np.float64)
|
|
55
|
+
e = np.ascontiguousarray(e, dtype=np.float64)
|
|
56
|
+
return _lib.scm2cpp_sym_eigen_gen(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.size, b.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), b.size, v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.size, ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.size, e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.size, m)
|
|
57
|
+
|
|
58
|
+
_lib.scm2cpp_ica_tanh.restype = ctypes.c_double
|
|
59
|
+
_lib.scm2cpp_ica_tanh.argtypes = [ctypes.c_double]
|
|
60
|
+
def ica_tanh(x):
|
|
61
|
+
return _lib.scm2cpp_ica_tanh(x)
|
|
62
|
+
|
|
63
|
+
_lib.scm2cpp_ica_sym.restype = ctypes.c_int
|
|
64
|
+
_lib.scm2cpp_ica_sym.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
|
|
65
|
+
def ica_sym(w, a, v, ev, e, t, m):
|
|
66
|
+
w = np.ascontiguousarray(w, dtype=np.float64)
|
|
67
|
+
a = np.ascontiguousarray(a, dtype=np.float64)
|
|
68
|
+
v = np.ascontiguousarray(v, dtype=np.float64)
|
|
69
|
+
ev = np.ascontiguousarray(ev, dtype=np.float64)
|
|
70
|
+
e = np.ascontiguousarray(e, dtype=np.float64)
|
|
71
|
+
t = np.ascontiguousarray(t, dtype=np.float64)
|
|
72
|
+
return _lib.scm2cpp_ica_sym(w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), w.size, a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.size, v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.size, ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.size, e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.size, t.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), t.size, m)
|
|
73
|
+
|
|
74
|
+
_lib.scm2cpp_fastica.restype = ctypes.c_int
|
|
75
|
+
_lib.scm2cpp_fastica.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
76
|
+
def fastica(x, winit, comps, white, unmix, mean, maxiter, tol, n, p, nc):
|
|
77
|
+
x = np.ascontiguousarray(x, dtype=np.float64)
|
|
78
|
+
winit = np.ascontiguousarray(winit, dtype=np.float64)
|
|
79
|
+
comps = np.ascontiguousarray(comps, dtype=np.float64)
|
|
80
|
+
white = np.ascontiguousarray(white, dtype=np.float64)
|
|
81
|
+
unmix = np.ascontiguousarray(unmix, dtype=np.float64)
|
|
82
|
+
mean = np.ascontiguousarray(mean, dtype=np.float64)
|
|
83
|
+
return _lib.scm2cpp_fastica(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, winit.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), winit.size, comps.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), comps.size, white.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), white.size, unmix.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), unmix.size, mean.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), mean.size, maxiter, tol, n, p, nc)
|
|
84
|
+
|
|
85
|
+
_lib.scm2cpp_gmm_mstep.restype = ctypes.c_int
|
|
86
|
+
_lib.scm2cpp_gmm_mstep.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
87
|
+
def gmm_mstep(x, resp, weights, means, prec, dw, cov, l, u, reg, norm, n, p, kc):
|
|
88
|
+
x = np.ascontiguousarray(x, dtype=np.float64)
|
|
89
|
+
resp = np.ascontiguousarray(resp, dtype=np.float64)
|
|
90
|
+
weights = np.ascontiguousarray(weights, dtype=np.float64)
|
|
91
|
+
means = np.ascontiguousarray(means, dtype=np.float64)
|
|
92
|
+
prec = np.ascontiguousarray(prec, dtype=np.float64)
|
|
93
|
+
dw = np.ascontiguousarray(dw, dtype=np.float64)
|
|
94
|
+
cov = np.ascontiguousarray(cov, dtype=np.float64)
|
|
95
|
+
l = np.ascontiguousarray(l, dtype=np.float64)
|
|
96
|
+
u = np.ascontiguousarray(u, dtype=np.float64)
|
|
97
|
+
return _lib.scm2cpp_gmm_mstep(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, resp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), resp.size, weights.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), weights.size, means.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), means.size, prec.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), prec.size, dw.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), dw.size, cov.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), cov.size, l.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), l.size, u.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), u.size, reg, norm, n, p, kc)
|
|
98
|
+
|
|
99
|
+
_lib.scm2cpp_gmm_estep.restype = ctypes.c_double
|
|
100
|
+
_lib.scm2cpp_gmm_estep.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
101
|
+
def gmm_estep(x, resp, weights, means, prec, wlp, y, u, mu, n, p, kc):
|
|
102
|
+
x = np.ascontiguousarray(x, dtype=np.float64)
|
|
103
|
+
resp = np.ascontiguousarray(resp, dtype=np.float64)
|
|
104
|
+
weights = np.ascontiguousarray(weights, dtype=np.float64)
|
|
105
|
+
means = np.ascontiguousarray(means, dtype=np.float64)
|
|
106
|
+
prec = np.ascontiguousarray(prec, dtype=np.float64)
|
|
107
|
+
wlp = np.ascontiguousarray(wlp, dtype=np.float64)
|
|
108
|
+
y = np.ascontiguousarray(y, dtype=np.float64)
|
|
109
|
+
u = np.ascontiguousarray(u, dtype=np.float64)
|
|
110
|
+
mu = np.ascontiguousarray(mu, dtype=np.float64)
|
|
111
|
+
return _lib.scm2cpp_gmm_estep(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, resp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), resp.size, weights.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), weights.size, means.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), means.size, prec.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), prec.size, wlp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), wlp.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, u.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), u.size, mu.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), mu.size, n, p, kc)
|
|
112
|
+
|
|
113
|
+
_lib.scm2cpp_gmm_abs.restype = ctypes.c_double
|
|
114
|
+
_lib.scm2cpp_gmm_abs.argtypes = [ctypes.c_double]
|
|
115
|
+
def gmm_abs(a):
|
|
116
|
+
return _lib.scm2cpp_gmm_abs(a)
|
|
117
|
+
|
|
118
|
+
_lib.scm2cpp_gmm.restype = ctypes.c_int
|
|
119
|
+
_lib.scm2cpp_gmm.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
120
|
+
def gmm(x, resp, weights, means, prec, labels, out, maxiter, tol, reg, n, p, kc):
|
|
121
|
+
x = np.ascontiguousarray(x, dtype=np.float64)
|
|
122
|
+
resp = np.ascontiguousarray(resp, dtype=np.float64)
|
|
123
|
+
weights = np.ascontiguousarray(weights, dtype=np.float64)
|
|
124
|
+
means = np.ascontiguousarray(means, dtype=np.float64)
|
|
125
|
+
prec = np.ascontiguousarray(prec, dtype=np.float64)
|
|
126
|
+
labels = np.ascontiguousarray(labels, dtype=np.float64)
|
|
127
|
+
out = np.ascontiguousarray(out, dtype=np.float64)
|
|
128
|
+
return _lib.scm2cpp_gmm(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, resp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), resp.size, weights.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), weights.size, means.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), means.size, prec.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), prec.size, labels.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), labels.size, out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.size, maxiter, tol, reg, n, p, kc)
|
|
129
|
+
|
|
130
|
+
_lib.scm2cpp_logistic_fg.restype = ctypes.c_double
|
|
131
|
+
_lib.scm2cpp_logistic_fg.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
132
|
+
def logistic_fg(coef, g, x, y, z, l2, multi, fitint, n, p, k):
|
|
133
|
+
coef = np.ascontiguousarray(coef, dtype=np.float64)
|
|
134
|
+
g = np.ascontiguousarray(g, dtype=np.float64)
|
|
135
|
+
x = np.ascontiguousarray(x, dtype=np.float64)
|
|
136
|
+
y = np.ascontiguousarray(y, dtype=np.float64)
|
|
137
|
+
z = np.ascontiguousarray(z, dtype=np.float64)
|
|
138
|
+
return _lib.scm2cpp_logistic_fg(coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.size, g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.size, x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.size, l2, multi, fitint, n, p, k)
|
|
139
|
+
|
|
140
|
+
_lib.scm2cpp_logistic_lbfgs.restype = ctypes.c_int
|
|
141
|
+
_lib.scm2cpp_logistic_lbfgs.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
142
|
+
def logistic_lbfgs(x, y, coef, out, c, maxiter, tol, multi, fitint, n, p, k):
|
|
143
|
+
x = np.ascontiguousarray(x, dtype=np.float64)
|
|
144
|
+
y = np.ascontiguousarray(y, dtype=np.float64)
|
|
145
|
+
coef = np.ascontiguousarray(coef, dtype=np.float64)
|
|
146
|
+
out = np.ascontiguousarray(out, dtype=np.float64)
|
|
147
|
+
return _lib.scm2cpp_logistic_lbfgs(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.size, out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.size, c, maxiter, tol, multi, fitint, n, p, k)
|
|
148
|
+
|
|
149
|
+
_lib.scm2cpp_huber_fg.restype = ctypes.c_double
|
|
150
|
+
_lib.scm2cpp_huber_fg.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
151
|
+
def huber_fg(coef, g, x, y, z, epsilon, alpha, fitint, n, p):
|
|
152
|
+
coef = np.ascontiguousarray(coef, dtype=np.float64)
|
|
153
|
+
g = np.ascontiguousarray(g, dtype=np.float64)
|
|
154
|
+
x = np.ascontiguousarray(x, dtype=np.float64)
|
|
155
|
+
y = np.ascontiguousarray(y, dtype=np.float64)
|
|
156
|
+
z = np.ascontiguousarray(z, dtype=np.float64)
|
|
157
|
+
return _lib.scm2cpp_huber_fg(coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.size, g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.size, x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.size, epsilon, alpha, fitint, n, p)
|
|
158
|
+
|
|
159
|
+
_lib.scm2cpp_huber.restype = ctypes.c_int
|
|
160
|
+
_lib.scm2cpp_huber.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
161
|
+
def huber(x, y, coef, out, epsilon, alpha, maxiter, tol, fitint, n, p):
|
|
162
|
+
x = np.ascontiguousarray(x, dtype=np.float64)
|
|
163
|
+
y = np.ascontiguousarray(y, dtype=np.float64)
|
|
164
|
+
coef = np.ascontiguousarray(coef, dtype=np.float64)
|
|
165
|
+
out = np.ascontiguousarray(out, dtype=np.float64)
|
|
166
|
+
return _lib.scm2cpp_huber(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.size, out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.size, epsilon, alpha, maxiter, tol, fitint, n, p)
|
|
167
|
+
|
|
168
|
+
_lib.scm2cpp_glm_fg.restype = ctypes.c_double
|
|
169
|
+
_lib.scm2cpp_glm_fg.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
170
|
+
def glm_fg(coef, g, x, y, z, family, power, l2, fitint, n, p):
|
|
171
|
+
coef = np.ascontiguousarray(coef, dtype=np.float64)
|
|
172
|
+
g = np.ascontiguousarray(g, dtype=np.float64)
|
|
173
|
+
x = np.ascontiguousarray(x, dtype=np.float64)
|
|
174
|
+
y = np.ascontiguousarray(y, dtype=np.float64)
|
|
175
|
+
z = np.ascontiguousarray(z, dtype=np.float64)
|
|
176
|
+
return _lib.scm2cpp_glm_fg(coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.size, g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.size, x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.size, family, power, l2, fitint, n, p)
|
|
177
|
+
|
|
178
|
+
_lib.scm2cpp_glm.restype = ctypes.c_int
|
|
179
|
+
_lib.scm2cpp_glm.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
180
|
+
def glm(x, y, coef, out, family, power, alpha, maxiter, tol, fitint, n, p):
|
|
181
|
+
x = np.ascontiguousarray(x, dtype=np.float64)
|
|
182
|
+
y = np.ascontiguousarray(y, dtype=np.float64)
|
|
183
|
+
coef = np.ascontiguousarray(coef, dtype=np.float64)
|
|
184
|
+
out = np.ascontiguousarray(out, dtype=np.float64)
|
|
185
|
+
return _lib.scm2cpp_glm(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.size, out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.size, family, power, alpha, maxiter, tol, fitint, n, p)
|
|
186
|
+
|
|
187
|
+
_lib.scm2cpp_lb_abs.restype = ctypes.c_double
|
|
188
|
+
_lib.scm2cpp_lb_abs.argtypes = [ctypes.c_double]
|
|
189
|
+
def lb_abs(a):
|
|
190
|
+
return _lib.scm2cpp_lb_abs(a)
|
|
191
|
+
|
|
192
|
+
_lib.scm2cpp_lb_max.restype = ctypes.c_double
|
|
193
|
+
_lib.scm2cpp_lb_max.argtypes = [ctypes.c_double, ctypes.c_double]
|
|
194
|
+
def lb_max(a, b):
|
|
195
|
+
return _lib.scm2cpp_lb_max(a, b)
|
|
196
|
+
|
|
197
|
+
_lib.scm2cpp_lb_min.restype = ctypes.c_double
|
|
198
|
+
_lib.scm2cpp_lb_min.argtypes = [ctypes.c_double, ctypes.c_double]
|
|
199
|
+
def lb_min(a, b):
|
|
200
|
+
return _lib.scm2cpp_lb_min(a, b)
|
|
201
|
+
|
|
202
|
+
_lib.scm2cpp_lb_dcstep.restype = ctypes.c_int
|
|
203
|
+
_lib.scm2cpp_lb_dcstep.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double]
|
|
204
|
+
def lb_dcstep(cs, fp, dp, stpmin, stpmax):
|
|
205
|
+
cs = np.ascontiguousarray(cs, dtype=np.float64)
|
|
206
|
+
assert cs.size == 8, "cs: expected 8 elements"
|
|
207
|
+
return _lib.scm2cpp_lb_dcstep(cs.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), fp, dp, stpmin, stpmax)
|
|
208
|
+
|
|
209
|
+
_lib.scm2cpp_lb_search_start.restype = ctypes.c_int
|
|
210
|
+
_lib.scm2cpp_lb_search_start.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double]
|
|
211
|
+
def lb_search_start(ls, f, g, stp, stpmin, stpmax, ftol):
|
|
212
|
+
ls = np.ascontiguousarray(ls, dtype=np.float64)
|
|
213
|
+
assert ls.size == 16, "ls: expected 16 elements"
|
|
214
|
+
return _lib.scm2cpp_lb_search_start(ls.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), f, g, stp, stpmin, stpmax, ftol)
|
|
215
|
+
|
|
216
|
+
_lib.scm2cpp_lb_search_step.restype = ctypes.c_int
|
|
217
|
+
_lib.scm2cpp_lb_search_step.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double]
|
|
218
|
+
def lb_search_step(ls, cs, f, g, ftol, gtol, xtol, stpmin, stpmax):
|
|
219
|
+
ls = np.ascontiguousarray(ls, dtype=np.float64)
|
|
220
|
+
assert ls.size == 16, "ls: expected 16 elements"
|
|
221
|
+
cs = np.ascontiguousarray(cs, dtype=np.float64)
|
|
222
|
+
assert cs.size == 8, "cs: expected 8 elements"
|
|
223
|
+
return _lib.scm2cpp_lb_search_step(ls.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), cs.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), f, g, ftol, gtol, xtol, stpmin, stpmax)
|
|
224
|
+
|
|
225
|
+
_lib.scm2cpp_lb_dot.restype = ctypes.c_double
|
|
226
|
+
_lib.scm2cpp_lb_dot.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
|
|
227
|
+
def lb_dot(a, b, nv):
|
|
228
|
+
a = np.ascontiguousarray(a, dtype=np.float64)
|
|
229
|
+
b = np.ascontiguousarray(b, dtype=np.float64)
|
|
230
|
+
return _lib.scm2cpp_lb_dot(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.size, b.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), b.size, nv)
|
|
231
|
+
|
|
232
|
+
_lib.scm2cpp_lb_dot_row.restype = ctypes.c_double
|
|
233
|
+
_lib.scm2cpp_lb_dot_row.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
|
|
234
|
+
def lb_dot_row(mem, slot, v, nv):
|
|
235
|
+
mem = np.ascontiguousarray(mem, dtype=np.float64)
|
|
236
|
+
v = np.ascontiguousarray(v, dtype=np.float64)
|
|
237
|
+
return _lib.scm2cpp_lb_dot_row(mem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), mem.size, slot, v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.size, nv)
|
|
238
|
+
|
|
239
|
+
_lib.scm2cpp_lb_dot_rows.restype = ctypes.c_double
|
|
240
|
+
_lib.scm2cpp_lb_dot_rows.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
241
|
+
def lb_dot_rows(a, ra, b, rb, nv):
|
|
242
|
+
a = np.ascontiguousarray(a, dtype=np.float64)
|
|
243
|
+
b = np.ascontiguousarray(b, dtype=np.float64)
|
|
244
|
+
return _lib.scm2cpp_lb_dot_rows(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.size, ra, b.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), b.size, rb, nv)
|
|
245
|
+
|
|
246
|
+
_lib.scm2cpp_lb_projgr.restype = ctypes.c_double
|
|
247
|
+
_lib.scm2cpp_lb_projgr.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int]
|
|
248
|
+
def lb_projgr(g, w, ib, lbv, nv):
|
|
249
|
+
g = np.ascontiguousarray(g, dtype=np.float64)
|
|
250
|
+
w = np.ascontiguousarray(w, dtype=np.float64)
|
|
251
|
+
return _lib.scm2cpp_lb_projgr(g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.size, w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), w.size, ib, lbv, nv)
|
|
252
|
+
|
|
253
|
+
_lib.scm2cpp_lb_hv.restype = ctypes.c_int
|
|
254
|
+
_lib.scm2cpp_lb_hv.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
255
|
+
def lb_hv(q, smem, ymem, rho, al, theta, col, head, m, nv):
|
|
256
|
+
q = np.ascontiguousarray(q, dtype=np.float64)
|
|
257
|
+
smem = np.ascontiguousarray(smem, dtype=np.float64)
|
|
258
|
+
ymem = np.ascontiguousarray(ymem, dtype=np.float64)
|
|
259
|
+
rho = np.ascontiguousarray(rho, dtype=np.float64)
|
|
260
|
+
al = np.ascontiguousarray(al, dtype=np.float64)
|
|
261
|
+
return _lib.scm2cpp_lb_hv(q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), q.size, smem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), smem.size, ymem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ymem.size, rho.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rho.size, al.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), al.size, theta, col, head, m, nv)
|
|
262
|
+
|
|
263
|
+
_lib.scm2cpp_lb_vbv.restype = ctypes.c_double
|
|
264
|
+
_lib.scm2cpp_lb_vbv.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
265
|
+
def lb_vbv(v, smem, ymem, rho, bm, sb, theta, col, head, m, nv):
|
|
266
|
+
v = np.ascontiguousarray(v, dtype=np.float64)
|
|
267
|
+
smem = np.ascontiguousarray(smem, dtype=np.float64)
|
|
268
|
+
ymem = np.ascontiguousarray(ymem, dtype=np.float64)
|
|
269
|
+
rho = np.ascontiguousarray(rho, dtype=np.float64)
|
|
270
|
+
bm = np.ascontiguousarray(bm, dtype=np.float64)
|
|
271
|
+
sb = np.ascontiguousarray(sb, dtype=np.float64)
|
|
272
|
+
return _lib.scm2cpp_lb_vbv(v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.size, smem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), smem.size, ymem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ymem.size, rho.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rho.size, bm.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), bm.size, sb.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sb.size, theta, col, head, m, nv)
|
|
273
|
+
|
|
274
|
+
_lib.scm2cpp_lb_direction.restype = ctypes.c_int
|
|
275
|
+
_lib.scm2cpp_lb_direction.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int]
|
|
276
|
+
def lb_direction(w, g, d, q, e, smem, ymem, rho, al, bm, sb, theta, col, head, m, ib, lbv, nv):
|
|
277
|
+
w = np.ascontiguousarray(w, dtype=np.float64)
|
|
278
|
+
g = np.ascontiguousarray(g, dtype=np.float64)
|
|
279
|
+
d = np.ascontiguousarray(d, dtype=np.float64)
|
|
280
|
+
q = np.ascontiguousarray(q, dtype=np.float64)
|
|
281
|
+
e = np.ascontiguousarray(e, dtype=np.float64)
|
|
282
|
+
smem = np.ascontiguousarray(smem, dtype=np.float64)
|
|
283
|
+
ymem = np.ascontiguousarray(ymem, dtype=np.float64)
|
|
284
|
+
rho = np.ascontiguousarray(rho, dtype=np.float64)
|
|
285
|
+
al = np.ascontiguousarray(al, dtype=np.float64)
|
|
286
|
+
bm = np.ascontiguousarray(bm, dtype=np.float64)
|
|
287
|
+
sb = np.ascontiguousarray(sb, dtype=np.float64)
|
|
288
|
+
return _lib.scm2cpp_lb_direction(w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), w.size, g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.size, d.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), d.size, q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), q.size, e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.size, smem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), smem.size, ymem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ymem.size, rho.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rho.size, al.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), al.size, bm.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), bm.size, sb.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sb.size, theta, col, head, m, ib, lbv, nv)
|
|
289
|
+
|
|
290
|
+
_lib.scm2cpp_lbfgs.restype = ctypes.c_int
|
|
291
|
+
_lib.scm2cpp_lbfgs.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
292
|
+
def lbfgs(kind, w, x, y, aux, work, out, m, maxiter, pgtol, ftol, maxls, ib, lbv, nv, n, p, k):
|
|
293
|
+
w = np.ascontiguousarray(w, dtype=np.float64)
|
|
294
|
+
x = np.ascontiguousarray(x, dtype=np.float64)
|
|
295
|
+
y = np.ascontiguousarray(y, dtype=np.float64)
|
|
296
|
+
aux = np.ascontiguousarray(aux, dtype=np.float64)
|
|
297
|
+
assert aux.size == 4, "aux: expected 4 elements"
|
|
298
|
+
work = np.ascontiguousarray(work, dtype=np.float64)
|
|
299
|
+
out = np.ascontiguousarray(out, dtype=np.float64)
|
|
300
|
+
return _lib.scm2cpp_lbfgs(kind, w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), w.size, x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, aux.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), work.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), work.size, out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.size, m, maxiter, pgtol, ftol, maxls, ib, lbv, nv, n, p, k)
|
|
301
|
+
|
|
302
|
+
_lib.scm2cpp_lbfgs_fg.restype = ctypes.c_double
|
|
303
|
+
_lib.scm2cpp_lbfgs_fg.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
|
|
304
|
+
def lbfgs_fg(kind, w, g, x, y, aux, work, n, p, k):
|
|
305
|
+
w = np.ascontiguousarray(w, dtype=np.float64)
|
|
306
|
+
g = np.ascontiguousarray(g, dtype=np.float64)
|
|
307
|
+
x = np.ascontiguousarray(x, dtype=np.float64)
|
|
308
|
+
y = np.ascontiguousarray(y, dtype=np.float64)
|
|
309
|
+
aux = np.ascontiguousarray(aux, dtype=np.float64)
|
|
310
|
+
assert aux.size == 4, "aux: expected 4 elements"
|
|
311
|
+
work = np.ascontiguousarray(work, dtype=np.float64)
|
|
312
|
+
return _lib.scm2cpp_lbfgs_fg(kind, w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), w.size, g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.size, x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, aux.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), work.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), work.size, n, p, k)
|
|
313
|
+
|