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.
Files changed (72) hide show
  1. scm2cpp_learn/__init__.py +3836 -0
  2. scm2cpp_learn/_classifiers.cp312-win_amd64.pyd +0 -0
  3. scm2cpp_learn/_compat.py +284 -0
  4. scm2cpp_learn/_generated/__init__.py +0 -0
  5. scm2cpp_learn/_generated/_loader.py +41 -0
  6. scm2cpp_learn/_generated/_loader_accel_cublas.py +173 -0
  7. scm2cpp_learn/_generated/_loader_classifiers.py +308 -0
  8. scm2cpp_learn/_generated/_loader_derived_blas.py +29 -0
  9. scm2cpp_learn/_generated/_loader_derived_cublas.py +29 -0
  10. scm2cpp_learn/_generated/_loader_derived_loops.py +29 -0
  11. scm2cpp_learn/_generated/_loader_gpu_cuda.py +313 -0
  12. scm2cpp_learn/_generated/_loader_gramops_blas.py +692 -0
  13. scm2cpp_learn/_generated/_loader_gramops_loops.py +711 -0
  14. scm2cpp_learn/_generated/_loader_nmf_blas.py +29 -0
  15. scm2cpp_learn/_generated/_loader_nmf_cublas.py +29 -0
  16. scm2cpp_learn/_generated/_loader_nmf_loops.py +29 -0
  17. scm2cpp_learn/_generated/accel_cublas/accel.cpp +24 -0
  18. scm2cpp_learn/_generated/accel_cublas/accel.hpp +1178 -0
  19. scm2cpp_learn/_generated/accel_cublas/accel_capi.cpp +76 -0
  20. scm2cpp_learn/_generated/classifiers.cpp +37 -0
  21. scm2cpp_learn/_generated/classifiers.hpp +3745 -0
  22. scm2cpp_learn/_generated/classifiers_capi.cpp +115 -0
  23. scm2cpp_learn/_generated/derived_blas/lasso_design.cpp +5 -0
  24. scm2cpp_learn/_generated/derived_blas/lasso_design.hpp +156 -0
  25. scm2cpp_learn/_generated/derived_blas/lasso_design_capi.cpp +19 -0
  26. scm2cpp_learn/_generated/derived_cublas/lasso_design.cpp +5 -0
  27. scm2cpp_learn/_generated/derived_cublas/lasso_design.hpp +158 -0
  28. scm2cpp_learn/_generated/derived_cublas/lasso_design_capi.cpp +19 -0
  29. scm2cpp_learn/_generated/derived_loops/lasso_design.cpp +5 -0
  30. scm2cpp_learn/_generated/derived_loops/lasso_design.hpp +179 -0
  31. scm2cpp_learn/_generated/derived_loops/lasso_design_capi.cpp +19 -0
  32. scm2cpp_learn/_generated/gpu_cuda/gpu.cpp +37 -0
  33. scm2cpp_learn/_generated/gpu_cuda/gpu.hpp +3846 -0
  34. scm2cpp_learn/_generated/gpu_cuda/gpu_capi.cpp +308 -0
  35. scm2cpp_learn/_generated/gramops_blas/gramops.cpp +82 -0
  36. scm2cpp_learn/_generated/gramops_blas/gramops.hpp +5411 -0
  37. scm2cpp_learn/_generated/gramops_blas/gramops_capi.cpp +244 -0
  38. scm2cpp_learn/_generated/gramops_loops/gramops.cpp +82 -0
  39. scm2cpp_learn/_generated/gramops_loops/gramops.hpp +6395 -0
  40. scm2cpp_learn/_generated/gramops_loops/gramops_capi.cpp +250 -0
  41. scm2cpp_learn/_generated/lasso_cov.cpp +7 -0
  42. scm2cpp_learn/_generated/lasso_cov.hpp +152 -0
  43. scm2cpp_learn/_generated/lasso_cov_capi.cpp +25 -0
  44. scm2cpp_learn/_generated/nmf_blas/nmf_cd.cpp +5 -0
  45. scm2cpp_learn/_generated/nmf_blas/nmf_cd.hpp +132 -0
  46. scm2cpp_learn/_generated/nmf_blas/nmf_cd_capi.cpp +19 -0
  47. scm2cpp_learn/_generated/nmf_cublas/nmf_cd.cpp +5 -0
  48. scm2cpp_learn/_generated/nmf_cublas/nmf_cd.hpp +136 -0
  49. scm2cpp_learn/_generated/nmf_cublas/nmf_cd_capi.cpp +19 -0
  50. scm2cpp_learn/_generated/nmf_loops/nmf_cd.cpp +5 -0
  51. scm2cpp_learn/_generated/nmf_loops/nmf_cd.hpp +167 -0
  52. scm2cpp_learn/_generated/nmf_loops/nmf_cd_capi.cpp +19 -0
  53. scm2cpp_learn/_generated/scm2cpp-blas.hpp +158 -0
  54. scm2cpp_learn/_generated/scm2cpp-cublas.hpp +155 -0
  55. scm2cpp_learn/_generated/scm2cpp-cuda.hpp +285 -0
  56. scm2cpp_learn/_generated/scm2cpp.hpp +1627 -0
  57. scm2cpp_learn/_gramops_blas.cp312-win_amd64.pyd +0 -0
  58. scm2cpp_learn/_lasso_cov.cp312-win_amd64.pyd +0 -0
  59. scm2cpp_learn/_lasso_derived_blas.cp312-win_amd64.pyd +0 -0
  60. scm2cpp_learn/_libfind.py +153 -0
  61. scm2cpp_learn/_nmf_blas.cp312-win_amd64.pyd +0 -0
  62. scm2cpp_learn/batch_capi.cu +428 -0
  63. scm2cpp_learn-0.18.0.dist-info/DELVEWHEEL +2 -0
  64. scm2cpp_learn-0.18.0.dist-info/METADATA +1171 -0
  65. scm2cpp_learn-0.18.0.dist-info/RECORD +72 -0
  66. scm2cpp_learn-0.18.0.dist-info/WHEEL +5 -0
  67. scm2cpp_learn-0.18.0.dist-info/top_level.txt +1 -0
  68. scm2cpp_learn.libs/.load-order-scm2cpp_learn-0.18.0 +4 -0
  69. scm2cpp_learn.libs/libopenblas-0486735c359a67419d8832e3c40e2837.dll +4 -0
  70. scm2cpp_learn.libs/msvcp140-73438573e87f9a2fd944b01def13566d.dll +0 -0
  71. scm2cpp_learn.libs/vcruntime140-052ad6a20d375957e82aa6a3c441ea54.dll +0 -0
  72. scm2cpp_learn.libs/vcruntime140_1-a198370e11c6e7469d1cf0ef5b3f433d.dll +0 -0
@@ -0,0 +1,692 @@
1
+ # ctypes loader for libgramops.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_gramops_lib as _load_gramops_lib
10
+
11
+ _lib = _load_gramops_lib("blas")
12
+
13
+ _lib.scm2cpp_spd_inverse.restype = ctypes.c_int
14
+ _lib.scm2cpp_spd_inverse.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int]
15
+ def spd_inverse(a, inv, l, z, p):
16
+ a = np.ascontiguousarray(a, dtype=np.float64)
17
+ inv = np.ascontiguousarray(inv, dtype=np.float64)
18
+ l = np.ascontiguousarray(l, dtype=np.float64)
19
+ z = np.ascontiguousarray(z, dtype=np.float64)
20
+ return _lib.scm2cpp_spd_inverse(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), inv.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), l.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), p)
21
+
22
+ _lib.scm2cpp_enet_gap.restype = ctypes.c_int
23
+ _lib.scm2cpp_enet_gap.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_double, ctypes.c_int]
24
+ def enet_gap(w, q, qw, xta, out, alpha, ynorm2, m):
25
+ w = np.ascontiguousarray(w, dtype=np.float64)
26
+ q = np.ascontiguousarray(q, dtype=np.float64)
27
+ qw = np.ascontiguousarray(qw, dtype=np.float64)
28
+ xta = np.ascontiguousarray(xta, dtype=np.float64)
29
+ out = np.ascontiguousarray(out, dtype=np.float64)
30
+ assert out.size == 2, "out: expected 2 elements"
31
+ return _lib.scm2cpp_enet_gap(w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), qw.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), xta.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alpha, ynorm2, m)
32
+
33
+ _lib.scm2cpp_enet_safe_rule.restype = ctypes.c_int
34
+ _lib.scm2cpp_enet_safe_rule.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int]
35
+ def enet_safe_rule(w, qm, qw, xta, active, excl, out, alpha, m):
36
+ w = np.ascontiguousarray(w, dtype=np.float64)
37
+ qm = np.ascontiguousarray(qm, dtype=np.float64)
38
+ qw = np.ascontiguousarray(qw, dtype=np.float64)
39
+ xta = np.ascontiguousarray(xta, dtype=np.float64)
40
+ active = np.ascontiguousarray(active, dtype=np.int32)
41
+ excl = np.ascontiguousarray(excl, dtype=np.int32)
42
+ out = np.ascontiguousarray(out, dtype=np.float64)
43
+ assert out.size == 2, "out: expected 2 elements"
44
+ return _lib.scm2cpp_enet_safe_rule(w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), qm.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), qw.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), xta.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), active.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), excl.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alpha, m)
45
+
46
+ _lib.scm2cpp_enet_gram.restype = ctypes.c_int
47
+ _lib.scm2cpp_enet_gram.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_int]
48
+ def enet_gram(w, qm, q, qw, xta, active, excl, out, alpha, maxiter, tol, m):
49
+ w = np.ascontiguousarray(w, dtype=np.float64)
50
+ qm = np.ascontiguousarray(qm, dtype=np.float64)
51
+ q = np.ascontiguousarray(q, dtype=np.float64)
52
+ qw = np.ascontiguousarray(qw, dtype=np.float64)
53
+ xta = np.ascontiguousarray(xta, dtype=np.float64)
54
+ active = np.ascontiguousarray(active, dtype=np.int32)
55
+ excl = np.ascontiguousarray(excl, dtype=np.int32)
56
+ out = np.ascontiguousarray(out, dtype=np.float64)
57
+ assert out.size == 2, "out: expected 2 elements"
58
+ return _lib.scm2cpp_enet_gram(w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), qm.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), qw.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), xta.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), active.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), excl.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alpha, maxiter, tol, m)
59
+
60
+ _lib.scm2cpp_graphical_lasso.restype = ctypes.c_int
61
+ _lib.scm2cpp_graphical_lasso.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int]
62
+ def graphical_lasso(emp, cov, prec, alpha, maxiter, tol, enettol, p):
63
+ emp = np.ascontiguousarray(emp, dtype=np.float64)
64
+ cov = np.ascontiguousarray(cov, dtype=np.float64)
65
+ prec = np.ascontiguousarray(prec, dtype=np.float64)
66
+ return _lib.scm2cpp_graphical_lasso(emp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), cov.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), prec.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alpha, maxiter, tol, enettol, p)
67
+
68
+ _lib.scm2cpp_omp.restype = ctypes.c_int
69
+ _lib.scm2cpp_omp.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
70
+ def omp(x, y, coef, path, rec, kmax, n, p):
71
+ x = np.ascontiguousarray(x, dtype=np.float64)
72
+ y = np.ascontiguousarray(y, dtype=np.float64)
73
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
74
+ path = np.ascontiguousarray(path, dtype=np.float64)
75
+ return _lib.scm2cpp_omp(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), path.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rec, kmax, n, p)
76
+
77
+ _lib.scm2cpp_logistic_fg.restype = ctypes.c_double
78
+ _lib.scm2cpp_logistic_fg.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
79
+ def logistic_fg(coef, g, x, y, z, l2, multi, fitint, n, p, k):
80
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
81
+ g = np.ascontiguousarray(g, dtype=np.float64)
82
+ x = np.ascontiguousarray(x, dtype=np.float64)
83
+ y = np.ascontiguousarray(y, dtype=np.float64)
84
+ z = np.ascontiguousarray(z, dtype=np.float64)
85
+ return _lib.scm2cpp_logistic_fg(coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), l2, multi, fitint, n, p, k)
86
+
87
+ _lib.scm2cpp_logistic_lbfgs.restype = ctypes.c_int
88
+ _lib.scm2cpp_logistic_lbfgs.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
89
+ def logistic_lbfgs(x, y, coef, out, c, maxiter, tol, multi, fitint, n, p, k):
90
+ x = np.ascontiguousarray(x, dtype=np.float64)
91
+ y = np.ascontiguousarray(y, dtype=np.float64)
92
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
93
+ out = np.ascontiguousarray(out, dtype=np.float64)
94
+ return _lib.scm2cpp_logistic_lbfgs(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), c, maxiter, tol, multi, fitint, n, p, k)
95
+
96
+ _lib.scm2cpp_huber_fg.restype = ctypes.c_double
97
+ _lib.scm2cpp_huber_fg.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
98
+ def huber_fg(coef, g, x, y, z, epsilon, alpha, fitint, n, p):
99
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
100
+ g = np.ascontiguousarray(g, dtype=np.float64)
101
+ x = np.ascontiguousarray(x, dtype=np.float64)
102
+ y = np.ascontiguousarray(y, dtype=np.float64)
103
+ z = np.ascontiguousarray(z, dtype=np.float64)
104
+ return _lib.scm2cpp_huber_fg(coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), epsilon, alpha, fitint, n, p)
105
+
106
+ _lib.scm2cpp_huber.restype = ctypes.c_int
107
+ _lib.scm2cpp_huber.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
108
+ def huber(x, y, coef, out, epsilon, alpha, maxiter, tol, fitint, n, p):
109
+ x = np.ascontiguousarray(x, dtype=np.float64)
110
+ y = np.ascontiguousarray(y, dtype=np.float64)
111
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
112
+ out = np.ascontiguousarray(out, dtype=np.float64)
113
+ return _lib.scm2cpp_huber(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), epsilon, alpha, maxiter, tol, fitint, n, p)
114
+
115
+ _lib.scm2cpp_glm_fg.restype = ctypes.c_double
116
+ _lib.scm2cpp_glm_fg.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
117
+ def glm_fg(coef, g, x, y, z, family, power, l2, fitint, n, p):
118
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
119
+ g = np.ascontiguousarray(g, dtype=np.float64)
120
+ x = np.ascontiguousarray(x, dtype=np.float64)
121
+ y = np.ascontiguousarray(y, dtype=np.float64)
122
+ z = np.ascontiguousarray(z, dtype=np.float64)
123
+ return _lib.scm2cpp_glm_fg(coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), family, power, l2, fitint, n, p)
124
+
125
+ _lib.scm2cpp_glm.restype = ctypes.c_int
126
+ _lib.scm2cpp_glm.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), 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]
127
+ def glm(x, y, coef, out, family, power, alpha, maxiter, tol, fitint, n, p):
128
+ x = np.ascontiguousarray(x, dtype=np.float64)
129
+ y = np.ascontiguousarray(y, dtype=np.float64)
130
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
131
+ out = np.ascontiguousarray(out, dtype=np.float64)
132
+ return _lib.scm2cpp_glm(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), family, power, alpha, maxiter, tol, fitint, n, p)
133
+
134
+ _lib.scm2cpp_lb_abs.restype = ctypes.c_double
135
+ _lib.scm2cpp_lb_abs.argtypes = [ctypes.c_double]
136
+ def lb_abs(a):
137
+ return _lib.scm2cpp_lb_abs(a)
138
+
139
+ _lib.scm2cpp_lb_max.restype = ctypes.c_double
140
+ _lib.scm2cpp_lb_max.argtypes = [ctypes.c_double, ctypes.c_double]
141
+ def lb_max(a, b):
142
+ return _lib.scm2cpp_lb_max(a, b)
143
+
144
+ _lib.scm2cpp_lb_min.restype = ctypes.c_double
145
+ _lib.scm2cpp_lb_min.argtypes = [ctypes.c_double, ctypes.c_double]
146
+ def lb_min(a, b):
147
+ return _lib.scm2cpp_lb_min(a, b)
148
+
149
+ _lib.scm2cpp_lb_dcstep.restype = ctypes.c_int
150
+ _lib.scm2cpp_lb_dcstep.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double]
151
+ def lb_dcstep(cs, fp, dp, stpmin, stpmax):
152
+ cs = np.ascontiguousarray(cs, dtype=np.float64)
153
+ assert cs.size == 8, "cs: expected 8 elements"
154
+ return _lib.scm2cpp_lb_dcstep(cs.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), fp, dp, stpmin, stpmax)
155
+
156
+ _lib.scm2cpp_lb_search_start.restype = ctypes.c_int
157
+ _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]
158
+ def lb_search_start(ls, f, g, stp, stpmin, stpmax, ftol):
159
+ ls = np.ascontiguousarray(ls, dtype=np.float64)
160
+ assert ls.size == 16, "ls: expected 16 elements"
161
+ return _lib.scm2cpp_lb_search_start(ls.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), f, g, stp, stpmin, stpmax, ftol)
162
+
163
+ _lib.scm2cpp_lb_search_step.restype = ctypes.c_int
164
+ _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]
165
+ def lb_search_step(ls, cs, f, g, ftol, gtol, xtol, stpmin, stpmax):
166
+ ls = np.ascontiguousarray(ls, dtype=np.float64)
167
+ assert ls.size == 16, "ls: expected 16 elements"
168
+ cs = np.ascontiguousarray(cs, dtype=np.float64)
169
+ assert cs.size == 8, "cs: expected 8 elements"
170
+ 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)
171
+
172
+ _lib.scm2cpp_lb_dot.restype = ctypes.c_double
173
+ _lib.scm2cpp_lb_dot.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int]
174
+ def lb_dot(a, b, nv):
175
+ a = np.ascontiguousarray(a, dtype=np.float64)
176
+ b = np.ascontiguousarray(b, dtype=np.float64)
177
+ return _lib.scm2cpp_lb_dot(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), b.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), nv)
178
+
179
+ _lib.scm2cpp_lb_dot_row.restype = ctypes.c_double
180
+ _lib.scm2cpp_lb_dot_row.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int]
181
+ def lb_dot_row(mem, slot, v, nv):
182
+ mem = np.ascontiguousarray(mem, dtype=np.float64)
183
+ v = np.ascontiguousarray(v, dtype=np.float64)
184
+ return _lib.scm2cpp_lb_dot_row(mem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), slot, v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), nv)
185
+
186
+ _lib.scm2cpp_lb_dot_rows.restype = ctypes.c_double
187
+ _lib.scm2cpp_lb_dot_rows.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
188
+ def lb_dot_rows(a, ra, b, rb, nv):
189
+ a = np.ascontiguousarray(a, dtype=np.float64)
190
+ b = np.ascontiguousarray(b, dtype=np.float64)
191
+ return _lib.scm2cpp_lb_dot_rows(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ra, b.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rb, nv)
192
+
193
+ _lib.scm2cpp_lb_projgr.restype = ctypes.c_double
194
+ _lib.scm2cpp_lb_projgr.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int]
195
+ def lb_projgr(g, w, ib, lbv, nv):
196
+ g = np.ascontiguousarray(g, dtype=np.float64)
197
+ w = np.ascontiguousarray(w, dtype=np.float64)
198
+ return _lib.scm2cpp_lb_projgr(g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ib, lbv, nv)
199
+
200
+ _lib.scm2cpp_lb_hv.restype = ctypes.c_int
201
+ _lib.scm2cpp_lb_hv.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
202
+ def lb_hv(q, smem, ymem, rho, al, theta, col, head, m, nv):
203
+ q = np.ascontiguousarray(q, dtype=np.float64)
204
+ smem = np.ascontiguousarray(smem, dtype=np.float64)
205
+ ymem = np.ascontiguousarray(ymem, dtype=np.float64)
206
+ rho = np.ascontiguousarray(rho, dtype=np.float64)
207
+ al = np.ascontiguousarray(al, dtype=np.float64)
208
+ return _lib.scm2cpp_lb_hv(q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), smem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ymem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rho.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), al.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), theta, col, head, m, nv)
209
+
210
+ _lib.scm2cpp_lb_vbv.restype = ctypes.c_double
211
+ _lib.scm2cpp_lb_vbv.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
212
+ def lb_vbv(v, smem, ymem, rho, bm, sb, theta, col, head, m, nv):
213
+ v = np.ascontiguousarray(v, dtype=np.float64)
214
+ smem = np.ascontiguousarray(smem, dtype=np.float64)
215
+ ymem = np.ascontiguousarray(ymem, dtype=np.float64)
216
+ rho = np.ascontiguousarray(rho, dtype=np.float64)
217
+ bm = np.ascontiguousarray(bm, dtype=np.float64)
218
+ sb = np.ascontiguousarray(sb, dtype=np.float64)
219
+ return _lib.scm2cpp_lb_vbv(v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), smem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ymem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rho.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), bm.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sb.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), theta, col, head, m, nv)
220
+
221
+ _lib.scm2cpp_lb_direction.restype = ctypes.c_int
222
+ _lib.scm2cpp_lb_direction.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int]
223
+ def lb_direction(w, g, d, q, e, smem, ymem, rho, al, bm, sb, theta, col, head, m, ib, lbv, nv):
224
+ w = np.ascontiguousarray(w, dtype=np.float64)
225
+ g = np.ascontiguousarray(g, dtype=np.float64)
226
+ d = np.ascontiguousarray(d, dtype=np.float64)
227
+ q = np.ascontiguousarray(q, dtype=np.float64)
228
+ e = np.ascontiguousarray(e, dtype=np.float64)
229
+ smem = np.ascontiguousarray(smem, dtype=np.float64)
230
+ ymem = np.ascontiguousarray(ymem, dtype=np.float64)
231
+ rho = np.ascontiguousarray(rho, dtype=np.float64)
232
+ al = np.ascontiguousarray(al, dtype=np.float64)
233
+ bm = np.ascontiguousarray(bm, dtype=np.float64)
234
+ sb = np.ascontiguousarray(sb, dtype=np.float64)
235
+ return _lib.scm2cpp_lb_direction(w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), d.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), smem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ymem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rho.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), al.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), bm.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sb.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), theta, col, head, m, ib, lbv, nv)
236
+
237
+ _lib.scm2cpp_lbfgs.restype = ctypes.c_int
238
+ _lib.scm2cpp_lbfgs.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), 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_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
239
+ def lbfgs(kind, w, x, y, aux, work, out, m, maxiter, pgtol, ftol, maxls, ib, lbv, nv, n, p, k):
240
+ w = np.ascontiguousarray(w, dtype=np.float64)
241
+ x = np.ascontiguousarray(x, dtype=np.float64)
242
+ y = np.ascontiguousarray(y, dtype=np.float64)
243
+ aux = np.ascontiguousarray(aux, dtype=np.float64)
244
+ assert aux.size == 4, "aux: expected 4 elements"
245
+ work = np.ascontiguousarray(work, dtype=np.float64)
246
+ out = np.ascontiguousarray(out, dtype=np.float64)
247
+ return _lib.scm2cpp_lbfgs(kind, w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), aux.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), work.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m, maxiter, pgtol, ftol, maxls, ib, lbv, nv, n, p, k)
248
+
249
+ _lib.scm2cpp_lbfgs_fg.restype = ctypes.c_double
250
+ _lib.scm2cpp_lbfgs_fg.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
251
+ def lbfgs_fg(kind, w, g, x, y, aux, work, n, p, k):
252
+ w = np.ascontiguousarray(w, dtype=np.float64)
253
+ g = np.ascontiguousarray(g, dtype=np.float64)
254
+ x = np.ascontiguousarray(x, dtype=np.float64)
255
+ y = np.ascontiguousarray(y, dtype=np.float64)
256
+ aux = np.ascontiguousarray(aux, dtype=np.float64)
257
+ assert aux.size == 4, "aux: expected 4 elements"
258
+ work = np.ascontiguousarray(work, dtype=np.float64)
259
+ return _lib.scm2cpp_lbfgs_fg(kind, w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), aux.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), work.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p, k)
260
+
261
+ _lib.scm2cpp_gmm_mstep.restype = ctypes.c_int
262
+ _lib.scm2cpp_gmm_mstep.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
263
+ def gmm_mstep(x, resp, weights, means, prec, dw, cov, l, u, reg, norm, n, p, kc):
264
+ x = np.ascontiguousarray(x, dtype=np.float64)
265
+ resp = np.ascontiguousarray(resp, dtype=np.float64)
266
+ weights = np.ascontiguousarray(weights, dtype=np.float64)
267
+ means = np.ascontiguousarray(means, dtype=np.float64)
268
+ prec = np.ascontiguousarray(prec, dtype=np.float64)
269
+ dw = np.ascontiguousarray(dw, dtype=np.float64)
270
+ cov = np.ascontiguousarray(cov, dtype=np.float64)
271
+ l = np.ascontiguousarray(l, dtype=np.float64)
272
+ u = np.ascontiguousarray(u, dtype=np.float64)
273
+ return _lib.scm2cpp_gmm_mstep(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), resp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), weights.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), means.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), prec.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), dw.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), cov.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), l.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), u.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), reg, norm, n, p, kc)
274
+
275
+ _lib.scm2cpp_gmm_estep.restype = ctypes.c_double
276
+ _lib.scm2cpp_gmm_estep.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
277
+ def gmm_estep(x, resp, weights, means, prec, wlp, y, u, mu, n, p, kc):
278
+ x = np.ascontiguousarray(x, dtype=np.float64)
279
+ resp = np.ascontiguousarray(resp, dtype=np.float64)
280
+ weights = np.ascontiguousarray(weights, dtype=np.float64)
281
+ means = np.ascontiguousarray(means, dtype=np.float64)
282
+ prec = np.ascontiguousarray(prec, dtype=np.float64)
283
+ wlp = np.ascontiguousarray(wlp, dtype=np.float64)
284
+ y = np.ascontiguousarray(y, dtype=np.float64)
285
+ u = np.ascontiguousarray(u, dtype=np.float64)
286
+ mu = np.ascontiguousarray(mu, dtype=np.float64)
287
+ return _lib.scm2cpp_gmm_estep(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), resp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), weights.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), means.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), prec.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), wlp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), u.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), mu.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p, kc)
288
+
289
+ _lib.scm2cpp_gmm_abs.restype = ctypes.c_double
290
+ _lib.scm2cpp_gmm_abs.argtypes = [ctypes.c_double]
291
+ def gmm_abs(a):
292
+ return _lib.scm2cpp_gmm_abs(a)
293
+
294
+ _lib.scm2cpp_gmm.restype = ctypes.c_int
295
+ _lib.scm2cpp_gmm.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
296
+ def gmm(x, resp, weights, means, prec, labels, out, maxiter, tol, reg, n, p, kc):
297
+ x = np.ascontiguousarray(x, dtype=np.float64)
298
+ resp = np.ascontiguousarray(resp, dtype=np.float64)
299
+ weights = np.ascontiguousarray(weights, dtype=np.float64)
300
+ means = np.ascontiguousarray(means, dtype=np.float64)
301
+ prec = np.ascontiguousarray(prec, dtype=np.float64)
302
+ labels = np.ascontiguousarray(labels, dtype=np.float64)
303
+ out = np.ascontiguousarray(out, dtype=np.float64)
304
+ return _lib.scm2cpp_gmm(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), resp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), weights.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), means.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), prec.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), labels.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), maxiter, tol, reg, n, p, kc)
305
+
306
+ _lib.scm2cpp_eig_hypot.restype = ctypes.c_double
307
+ _lib.scm2cpp_eig_hypot.argtypes = [ctypes.c_double, ctypes.c_double]
308
+ def eig_hypot(a, b):
309
+ return _lib.scm2cpp_eig_hypot(a, b)
310
+
311
+ _lib.scm2cpp_sym_eigen.restype = ctypes.c_int
312
+ _lib.scm2cpp_sym_eigen.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int]
313
+ def sym_eigen(a, v, ev, e, m):
314
+ a = np.ascontiguousarray(a, dtype=np.float64)
315
+ v = np.ascontiguousarray(v, dtype=np.float64)
316
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
317
+ e = np.ascontiguousarray(e, dtype=np.float64)
318
+ return _lib.scm2cpp_sym_eigen(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m)
319
+
320
+ _lib.scm2cpp_eig_abs.restype = ctypes.c_double
321
+ _lib.scm2cpp_eig_abs.argtypes = [ctypes.c_double]
322
+ def eig_abs(a):
323
+ return _lib.scm2cpp_eig_abs(a)
324
+
325
+ _lib.scm2cpp_eig_order.restype = ctypes.c_int
326
+ _lib.scm2cpp_eig_order.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.c_int]
327
+ def eig_order(ev, ord, m):
328
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
329
+ ord = np.ascontiguousarray(ord, dtype=np.int32)
330
+ return _lib.scm2cpp_eig_order(ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ord.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), m)
331
+
332
+ _lib.scm2cpp_ica_tanh.restype = ctypes.c_double
333
+ _lib.scm2cpp_ica_tanh.argtypes = [ctypes.c_double]
334
+ def ica_tanh(x):
335
+ return _lib.scm2cpp_ica_tanh(x)
336
+
337
+ _lib.scm2cpp_ica_sym.restype = ctypes.c_int
338
+ _lib.scm2cpp_ica_sym.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int]
339
+ def ica_sym(w, a, v, ev, e, t, m):
340
+ w = np.ascontiguousarray(w, dtype=np.float64)
341
+ a = np.ascontiguousarray(a, dtype=np.float64)
342
+ v = np.ascontiguousarray(v, dtype=np.float64)
343
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
344
+ e = np.ascontiguousarray(e, dtype=np.float64)
345
+ t = np.ascontiguousarray(t, dtype=np.float64)
346
+ return _lib.scm2cpp_ica_sym(w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), t.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m)
347
+
348
+ _lib.scm2cpp_fastica.restype = ctypes.c_int
349
+ _lib.scm2cpp_fastica.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
350
+ def fastica(x, winit, comps, white, unmix, mean, maxiter, tol, n, p, nc):
351
+ x = np.ascontiguousarray(x, dtype=np.float64)
352
+ winit = np.ascontiguousarray(winit, dtype=np.float64)
353
+ comps = np.ascontiguousarray(comps, dtype=np.float64)
354
+ white = np.ascontiguousarray(white, dtype=np.float64)
355
+ unmix = np.ascontiguousarray(unmix, dtype=np.float64)
356
+ mean = np.ascontiguousarray(mean, dtype=np.float64)
357
+ return _lib.scm2cpp_fastica(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), winit.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), comps.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), white.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), unmix.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), mean.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), maxiter, tol, n, p, nc)
358
+
359
+ _lib.scm2cpp_pca.restype = ctypes.c_int
360
+ _lib.scm2cpp_pca.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
361
+ def pca(x, comps, ev, sv, mean, n, p):
362
+ x = np.ascontiguousarray(x, dtype=np.float64)
363
+ comps = np.ascontiguousarray(comps, dtype=np.float64)
364
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
365
+ sv = np.ascontiguousarray(sv, dtype=np.float64)
366
+ mean = np.ascontiguousarray(mean, dtype=np.float64)
367
+ return _lib.scm2cpp_pca(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), comps.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sv.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), mean.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p)
368
+
369
+ _lib.scm2cpp_ard_pinvh.restype = ctypes.c_int
370
+ _lib.scm2cpp_ard_pinvh.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int]
371
+ def ard_pinvh(a, s, v, ev, e, k):
372
+ a = np.ascontiguousarray(a, dtype=np.float64)
373
+ s = np.ascontiguousarray(s, dtype=np.float64)
374
+ v = np.ascontiguousarray(v, dtype=np.float64)
375
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
376
+ e = np.ascontiguousarray(e, dtype=np.float64)
377
+ return _lib.scm2cpp_ard_pinvh(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), s.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), k)
378
+
379
+ _lib.scm2cpp_ard_sigma_coef.restype = ctypes.c_int
380
+ _lib.scm2cpp_ard_sigma_coef.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int]
381
+ def ard_sigma_coef(xy, idx, lam, coef, sigma, a, v, ev, e, gk, alpha, k):
382
+ xy = np.ascontiguousarray(xy, dtype=np.float64)
383
+ idx = np.ascontiguousarray(idx, dtype=np.int32)
384
+ lam = np.ascontiguousarray(lam, dtype=np.float64)
385
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
386
+ sigma = np.ascontiguousarray(sigma, dtype=np.float64)
387
+ a = np.ascontiguousarray(a, dtype=np.float64)
388
+ v = np.ascontiguousarray(v, dtype=np.float64)
389
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
390
+ e = np.ascontiguousarray(e, dtype=np.float64)
391
+ gk = np.ascontiguousarray(gk, dtype=np.float64)
392
+ return _lib.scm2cpp_ard_sigma_coef(xy.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), idx.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), lam.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sigma.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), gk.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alpha, k)
393
+
394
+ _lib.scm2cpp_ard.restype = ctypes.c_int
395
+ _lib.scm2cpp_ard.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
396
+ def ard(x, y, coef, sigma, lam, out, maxiter, tol, alpha1, alpha2, lambda1, lambda2, thresh, hoist, n, p):
397
+ x = np.ascontiguousarray(x, dtype=np.float64)
398
+ y = np.ascontiguousarray(y, dtype=np.float64)
399
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
400
+ sigma = np.ascontiguousarray(sigma, dtype=np.float64)
401
+ lam = np.ascontiguousarray(lam, dtype=np.float64)
402
+ out = np.ascontiguousarray(out, dtype=np.float64)
403
+ return _lib.scm2cpp_ard(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sigma.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), lam.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), maxiter, tol, alpha1, alpha2, lambda1, lambda2, thresh, hoist, n, p)
404
+
405
+ _lib.scm2cpp_f_regression.restype = ctypes.c_int
406
+ _lib.scm2cpp_f_regression.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
407
+ def f_regression(x, y, r, f, center, n, p, q):
408
+ x = np.ascontiguousarray(x, dtype=np.float64)
409
+ y = np.ascontiguousarray(y, dtype=np.float64)
410
+ r = np.ascontiguousarray(r, dtype=np.float64)
411
+ f = np.ascontiguousarray(f, dtype=np.float64)
412
+ return _lib.scm2cpp_f_regression(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), r.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), f.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), center, n, p, q)
413
+
414
+ _lib.scm2cpp_f_classif.restype = ctypes.c_int
415
+ _lib.scm2cpp_f_classif.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
416
+ def f_classif(x, lab, f, n, p, k):
417
+ x = np.ascontiguousarray(x, dtype=np.float64)
418
+ lab = np.ascontiguousarray(lab, dtype=np.int32)
419
+ f = np.ascontiguousarray(f, dtype=np.float64)
420
+ return _lib.scm2cpp_f_classif(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), lab.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), f.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p, k)
421
+
422
+ _lib.scm2cpp_min_pos.restype = ctypes.c_double
423
+ _lib.scm2cpp_min_pos.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int]
424
+ def min_pos(v, m):
425
+ v = np.ascontiguousarray(v, dtype=np.float64)
426
+ return _lib.scm2cpp_min_pos(v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m)
427
+
428
+ _lib.scm2cpp_round_even.restype = ctypes.c_double
429
+ _lib.scm2cpp_round_even.argtypes = [ctypes.c_double]
430
+ def round_even(y):
431
+ return _lib.scm2cpp_round_even(y)
432
+
433
+ _lib.scm2cpp_cholesky_delete.restype = ctypes.c_int
434
+ _lib.scm2cpp_cholesky_delete.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
435
+ def cholesky_delete(l, go, n, k):
436
+ l = np.ascontiguousarray(l, dtype=np.float64)
437
+ return _lib.scm2cpp_cholesky_delete(l.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), go, n, k)
438
+
439
+ _lib.scm2cpp_swap_rc.restype = ctypes.c_int
440
+ _lib.scm2cpp_swap_rc.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
441
+ def swap_rc(g, a, b, p):
442
+ g = np.ascontiguousarray(g, dtype=np.float64)
443
+ return _lib.scm2cpp_swap_rc(g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a, b, p)
444
+
445
+ _lib.scm2cpp_lars.restype = ctypes.c_int
446
+ _lib.scm2cpp_lars.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int]
447
+ def lars(g, cov, coef, path, alphas, rec, nsamples, alphamin, method, maxiter, eps, p):
448
+ g = np.ascontiguousarray(g, dtype=np.float64)
449
+ cov = np.ascontiguousarray(cov, dtype=np.float64)
450
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
451
+ path = np.ascontiguousarray(path, dtype=np.float64)
452
+ alphas = np.ascontiguousarray(alphas, dtype=np.float64)
453
+ return _lib.scm2cpp_lars(g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), cov.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), path.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alphas.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rec, nsamples, alphamin, method, maxiter, eps, p)
454
+
455
+ _lib.scm2cpp_rfe_chol.restype = ctypes.c_int
456
+ _lib.scm2cpp_rfe_chol.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_int]
457
+ def rfe_chol(g, idx, l, alpha, k, p):
458
+ g = np.ascontiguousarray(g, dtype=np.float64)
459
+ idx = np.ascontiguousarray(idx, dtype=np.int32)
460
+ l = np.ascontiguousarray(l, dtype=np.float64)
461
+ return _lib.scm2cpp_rfe_chol(g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), idx.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), l.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alpha, k, p)
462
+
463
+ _lib.scm2cpp_rfe_solve.restype = ctypes.c_int
464
+ _lib.scm2cpp_rfe_solve.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
465
+ def rfe_solve(c, idx, w, l, k, p):
466
+ c = np.ascontiguousarray(c, dtype=np.float64)
467
+ idx = np.ascontiguousarray(idx, dtype=np.int32)
468
+ w = np.ascontiguousarray(w, dtype=np.float64)
469
+ l = np.ascontiguousarray(l, dtype=np.float64)
470
+ return _lib.scm2cpp_rfe_solve(c.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), idx.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), l.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), k, p)
471
+
472
+ _lib.scm2cpp_rfe.restype = ctypes.c_int
473
+ _lib.scm2cpp_rfe.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
474
+ def rfe(x, y, coef, support, ranking, alpha, nsel, step, n, p):
475
+ x = np.ascontiguousarray(x, dtype=np.float64)
476
+ y = np.ascontiguousarray(y, dtype=np.float64)
477
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
478
+ support = np.ascontiguousarray(support, dtype=np.int32)
479
+ ranking = np.ascontiguousarray(ranking, dtype=np.int32)
480
+ return _lib.scm2cpp_rfe(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), support.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), ranking.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), alpha, nsel, step, n, p)
481
+
482
+ _lib.scm2cpp_gram_xx.restype = ctypes.c_int
483
+ _lib.scm2cpp_gram_xx.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
484
+ def gram_xx(x, g, n, p):
485
+ x = np.ascontiguousarray(x, dtype=np.float64)
486
+ g = np.ascontiguousarray(g, dtype=np.float64)
487
+ return _lib.scm2cpp_gram_xx(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p)
488
+
489
+ _lib.scm2cpp_gram_xy.restype = ctypes.c_int
490
+ _lib.scm2cpp_gram_xy.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
491
+ def gram_xy(x, y, c, n, p, q):
492
+ x = np.ascontiguousarray(x, dtype=np.float64)
493
+ y = np.ascontiguousarray(y, dtype=np.float64)
494
+ c = np.ascontiguousarray(c, dtype=np.float64)
495
+ return _lib.scm2cpp_gram_xy(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), c.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p, q)
496
+
497
+ _lib.scm2cpp_spd_solve.restype = ctypes.c_int
498
+ _lib.scm2cpp_spd_solve.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
499
+ def spd_solve(a, b, m, q):
500
+ a = np.ascontiguousarray(a, dtype=np.float64)
501
+ b = np.ascontiguousarray(b, dtype=np.float64)
502
+ return _lib.scm2cpp_spd_solve(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), b.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m, q)
503
+
504
+ _lib.scm2cpp_gram_ridge_solve.restype = ctypes.c_int
505
+ _lib.scm2cpp_gram_ridge_solve.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_int]
506
+ def gram_ridge_solve(g, c, alpha, m, q):
507
+ g = np.ascontiguousarray(g, dtype=np.float64)
508
+ c = np.ascontiguousarray(c, dtype=np.float64)
509
+ return _lib.scm2cpp_gram_ridge_solve(g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), c.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alpha, m, q)
510
+
511
+ _lib.scm2cpp_ridge_gcv_primal.restype = ctypes.c_int
512
+ _lib.scm2cpp_ridge_gcv_primal.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
513
+ def ridge_gcv_primal(x, xm, yc, g, v, lam, z, r, n, p, t):
514
+ x = np.ascontiguousarray(x, dtype=np.float64)
515
+ xm = np.ascontiguousarray(xm, dtype=np.float64)
516
+ yc = np.ascontiguousarray(yc, dtype=np.float64)
517
+ g = np.ascontiguousarray(g, dtype=np.float64)
518
+ v = np.ascontiguousarray(v, dtype=np.float64)
519
+ lam = np.ascontiguousarray(lam, dtype=np.float64)
520
+ z = np.ascontiguousarray(z, dtype=np.float64)
521
+ r = np.ascontiguousarray(r, dtype=np.float64)
522
+ return _lib.scm2cpp_ridge_gcv_primal(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), xm.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), yc.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), lam.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), r.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p, t)
523
+
524
+ _lib.scm2cpp_ridge_gcv_dual.restype = ctypes.c_int
525
+ _lib.scm2cpp_ridge_gcv_dual.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
526
+ def ridge_gcv_dual(k, q, mu, yc, z, r, n, t):
527
+ k = np.ascontiguousarray(k, dtype=np.float64)
528
+ q = np.ascontiguousarray(q, dtype=np.float64)
529
+ mu = np.ascontiguousarray(mu, dtype=np.float64)
530
+ yc = np.ascontiguousarray(yc, dtype=np.float64)
531
+ z = np.ascontiguousarray(z, dtype=np.float64)
532
+ r = np.ascontiguousarray(r, dtype=np.float64)
533
+ return _lib.scm2cpp_ridge_gcv_dual(k.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), mu.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), yc.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), r.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, t)
534
+
535
+ _lib.scm2cpp_ridge_gcv_scan.restype = ctypes.c_int
536
+ _lib.scm2cpp_ridge_gcv_scan.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
537
+ def ridge_gcv_scan(z, lam, r, yc, alphas, h0, mse, loo, store, n, m, t, na):
538
+ z = np.ascontiguousarray(z, dtype=np.float64)
539
+ lam = np.ascontiguousarray(lam, dtype=np.float64)
540
+ r = np.ascontiguousarray(r, dtype=np.float64)
541
+ yc = np.ascontiguousarray(yc, dtype=np.float64)
542
+ alphas = np.ascontiguousarray(alphas, dtype=np.float64)
543
+ mse = np.ascontiguousarray(mse, dtype=np.float64)
544
+ loo = np.ascontiguousarray(loo, dtype=np.float64)
545
+ return _lib.scm2cpp_ridge_gcv_scan(z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), lam.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), r.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), yc.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alphas.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), h0, mse.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), loo.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), store, n, m, t, na)
546
+
547
+ _lib.scm2cpp_kpca_row_norms.restype = ctypes.c_int
548
+ _lib.scm2cpp_kpca_row_norms.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
549
+ def kpca_row_norms(x, s, n, p):
550
+ x = np.ascontiguousarray(x, dtype=np.float64)
551
+ s = np.ascontiguousarray(s, dtype=np.float64)
552
+ return _lib.scm2cpp_kpca_row_norms(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), s.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p)
553
+
554
+ _lib.scm2cpp_kpca_apply.restype = ctypes.c_int
555
+ _lib.scm2cpp_kpca_apply.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int]
556
+ def kpca_apply(g, sa, sb, kind, gamma, degree, coef0, na, nb):
557
+ g = np.ascontiguousarray(g, dtype=np.float64)
558
+ sa = np.ascontiguousarray(sa, dtype=np.float64)
559
+ sb = np.ascontiguousarray(sb, dtype=np.float64)
560
+ return _lib.scm2cpp_kpca_apply(g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sa.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sb.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), kind, gamma, degree, coef0, na, nb)
561
+
562
+ _lib.scm2cpp_kpca_kernel.restype = ctypes.c_int
563
+ _lib.scm2cpp_kpca_kernel.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
564
+ def kpca_kernel(x, y, k, kind, gamma, degree, coef0, na, nb, p):
565
+ x = np.ascontiguousarray(x, dtype=np.float64)
566
+ y = np.ascontiguousarray(y, dtype=np.float64)
567
+ k = np.ascontiguousarray(k, dtype=np.float64)
568
+ return _lib.scm2cpp_kpca_kernel(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), k.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), kind, gamma, degree, coef0, na, nb, p)
569
+
570
+ _lib.scm2cpp_kpca_kernel_self.restype = ctypes.c_int
571
+ _lib.scm2cpp_kpca_kernel_self.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int]
572
+ def kpca_kernel_self(x, k, kind, gamma, degree, coef0, n, p):
573
+ x = np.ascontiguousarray(x, dtype=np.float64)
574
+ k = np.ascontiguousarray(k, dtype=np.float64)
575
+ return _lib.scm2cpp_kpca_kernel_self(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), k.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), kind, gamma, degree, coef0, n, p)
576
+
577
+ _lib.scm2cpp_kpca_centre.restype = ctypes.c_int
578
+ _lib.scm2cpp_kpca_centre.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int]
579
+ def kpca_centre(k, m, n):
580
+ k = np.ascontiguousarray(k, dtype=np.float64)
581
+ m = np.ascontiguousarray(m, dtype=np.float64)
582
+ return _lib.scm2cpp_kpca_centre(k.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n)
583
+
584
+ _lib.scm2cpp_kpca_centre_new.restype = ctypes.c_int
585
+ _lib.scm2cpp_kpca_centre_new.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
586
+ def kpca_centre_new(k, m, nb, n):
587
+ k = np.ascontiguousarray(k, dtype=np.float64)
588
+ m = np.ascontiguousarray(m, dtype=np.float64)
589
+ return _lib.scm2cpp_kpca_centre_new(k.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), nb, n)
590
+
591
+ _lib.scm2cpp_kpca_flip.restype = ctypes.c_int
592
+ _lib.scm2cpp_kpca_flip.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
593
+ def kpca_flip(vecs, vals, n, c):
594
+ vecs = np.ascontiguousarray(vecs, dtype=np.float64)
595
+ vals = np.ascontiguousarray(vals, dtype=np.float64)
596
+ return _lib.scm2cpp_kpca_flip(vecs.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), vals.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, c)
597
+
598
+ _lib.scm2cpp_kpca_top_dense.restype = ctypes.c_int
599
+ _lib.scm2cpp_kpca_top_dense.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
600
+ def kpca_top_dense(k, vecs, vals, n, c):
601
+ k = np.ascontiguousarray(k, dtype=np.float64)
602
+ vecs = np.ascontiguousarray(vecs, dtype=np.float64)
603
+ vals = np.ascontiguousarray(vals, dtype=np.float64)
604
+ return _lib.scm2cpp_kpca_top_dense(k.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), vecs.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), vals.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, c)
605
+
606
+ _lib.scm2cpp_kpca_orth.restype = ctypes.c_int
607
+ _lib.scm2cpp_kpca_orth.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
608
+ def kpca_orth(y, g, n, b):
609
+ y = np.ascontiguousarray(y, dtype=np.float64)
610
+ g = np.ascontiguousarray(g, dtype=np.float64)
611
+ return _lib.scm2cpp_kpca_orth(y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, b)
612
+
613
+ _lib.scm2cpp_kpca_top_subspace.restype = ctypes.c_int
614
+ _lib.scm2cpp_kpca_top_subspace.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int]
615
+ def kpca_top_subspace(k, q, vecs, vals, n, b, c, tol, maxit):
616
+ k = np.ascontiguousarray(k, dtype=np.float64)
617
+ q = np.ascontiguousarray(q, dtype=np.float64)
618
+ vecs = np.ascontiguousarray(vecs, dtype=np.float64)
619
+ vals = np.ascontiguousarray(vals, dtype=np.float64)
620
+ return _lib.scm2cpp_kpca_top_subspace(k.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), vecs.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), vals.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, b, c, tol, maxit)
621
+
622
+ _lib.scm2cpp_kpca_linear.restype = ctypes.c_int
623
+ _lib.scm2cpp_kpca_linear.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
624
+ def kpca_linear(x, xm, g, vecs, vals, n, p, c):
625
+ x = np.ascontiguousarray(x, dtype=np.float64)
626
+ xm = np.ascontiguousarray(xm, dtype=np.float64)
627
+ g = np.ascontiguousarray(g, dtype=np.float64)
628
+ vecs = np.ascontiguousarray(vecs, dtype=np.float64)
629
+ vals = np.ascontiguousarray(vals, dtype=np.float64)
630
+ return _lib.scm2cpp_kpca_linear(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), xm.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), vecs.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), vals.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p, c)
631
+
632
+ _lib.scm2cpp_lda_moments.restype = ctypes.c_int
633
+ _lib.scm2cpp_lda_moments.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
634
+ def lda_moments(x, lab, g, means, counts, n, p, k):
635
+ x = np.ascontiguousarray(x, dtype=np.float64)
636
+ lab = np.ascontiguousarray(lab, dtype=np.int32)
637
+ g = np.ascontiguousarray(g, dtype=np.float64)
638
+ means = np.ascontiguousarray(means, dtype=np.float64)
639
+ counts = np.ascontiguousarray(counts, dtype=np.float64)
640
+ return _lib.scm2cpp_lda_moments(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), lab.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), means.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), counts.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p, k)
641
+
642
+ _lib.scm2cpp_lda_within.restype = ctypes.c_int
643
+ _lib.scm2cpp_lda_within.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_int]
644
+ def lda_within(g, means, counts, n, p, k):
645
+ g = np.ascontiguousarray(g, dtype=np.float64)
646
+ means = np.ascontiguousarray(means, dtype=np.float64)
647
+ counts = np.ascontiguousarray(counts, dtype=np.float64)
648
+ return _lib.scm2cpp_lda_within(g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), means.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), counts.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p, k)
649
+
650
+ _lib.scm2cpp_lda_svd_first.restype = ctypes.c_int
651
+ _lib.scm2cpp_lda_svd_first.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int]
652
+ def lda_svd_first(sw, std, v, s, p):
653
+ sw = np.ascontiguousarray(sw, dtype=np.float64)
654
+ std = np.ascontiguousarray(std, dtype=np.float64)
655
+ v = np.ascontiguousarray(v, dtype=np.float64)
656
+ s = np.ascontiguousarray(s, dtype=np.float64)
657
+ return _lib.scm2cpp_lda_svd_first(sw.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), std.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), s.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), p)
658
+
659
+ _lib.scm2cpp_lda_eigen.restype = ctypes.c_int
660
+ _lib.scm2cpp_lda_eigen.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int]
661
+ def lda_eigen(sb, sw, v, ev, p):
662
+ sb = np.ascontiguousarray(sb, dtype=np.float64)
663
+ sw = np.ascontiguousarray(sw, dtype=np.float64)
664
+ v = np.ascontiguousarray(v, dtype=np.float64)
665
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
666
+ return _lib.scm2cpp_lda_eigen(sb.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sw.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), p)
667
+
668
+ _lib.scm2cpp_tsvd_flip.restype = ctypes.c_int
669
+ _lib.scm2cpp_tsvd_flip.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
670
+ def tsvd_flip(v, z, n, p, k):
671
+ v = np.ascontiguousarray(v, dtype=np.float64)
672
+ z = np.ascontiguousarray(z, dtype=np.float64)
673
+ return _lib.scm2cpp_tsvd_flip(v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p, k)
674
+
675
+ _lib.scm2cpp_tsvd_tall.restype = ctypes.c_int
676
+ _lib.scm2cpp_tsvd_tall.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
677
+ def tsvd_tall(x, v, s, z, n, p, k):
678
+ x = np.ascontiguousarray(x, dtype=np.float64)
679
+ v = np.ascontiguousarray(v, dtype=np.float64)
680
+ s = np.ascontiguousarray(s, dtype=np.float64)
681
+ z = np.ascontiguousarray(z, dtype=np.float64)
682
+ return _lib.scm2cpp_tsvd_tall(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), s.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p, k)
683
+
684
+ _lib.scm2cpp_tsvd_wide.restype = ctypes.c_int
685
+ _lib.scm2cpp_tsvd_wide.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
686
+ def tsvd_wide(x, v, s, z, n, p, k):
687
+ x = np.ascontiguousarray(x, dtype=np.float64)
688
+ v = np.ascontiguousarray(v, dtype=np.float64)
689
+ s = np.ascontiguousarray(s, dtype=np.float64)
690
+ z = np.ascontiguousarray(z, dtype=np.float64)
691
+ return _lib.scm2cpp_tsvd_wide(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), s.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p, k)
692
+