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,711 @@
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("loops")
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_sym_eigen_top.restype = ctypes.c_int
333
+ _lib.scm2cpp_sym_eigen_top.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]
334
+ def sym_eigen_top(a, v, ev, e, m, k):
335
+ a = np.ascontiguousarray(a, dtype=np.float64)
336
+ v = np.ascontiguousarray(v, dtype=np.float64)
337
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
338
+ e = np.ascontiguousarray(e, dtype=np.float64)
339
+ return _lib.scm2cpp_sym_eigen_top(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, k)
340
+
341
+ _lib.scm2cpp_sym_eigen_gen.restype = ctypes.c_int
342
+ _lib.scm2cpp_sym_eigen_gen.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]
343
+ def sym_eigen_gen(a, b, v, ev, e, m):
344
+ a = np.ascontiguousarray(a, dtype=np.float64)
345
+ b = np.ascontiguousarray(b, dtype=np.float64)
346
+ v = np.ascontiguousarray(v, dtype=np.float64)
347
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
348
+ e = np.ascontiguousarray(e, dtype=np.float64)
349
+ return _lib.scm2cpp_sym_eigen_gen(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), b.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)
350
+
351
+ _lib.scm2cpp_ica_tanh.restype = ctypes.c_double
352
+ _lib.scm2cpp_ica_tanh.argtypes = [ctypes.c_double]
353
+ def ica_tanh(x):
354
+ return _lib.scm2cpp_ica_tanh(x)
355
+
356
+ _lib.scm2cpp_ica_sym.restype = ctypes.c_int
357
+ _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]
358
+ def ica_sym(w, a, v, ev, e, t, m):
359
+ w = np.ascontiguousarray(w, dtype=np.float64)
360
+ a = np.ascontiguousarray(a, dtype=np.float64)
361
+ v = np.ascontiguousarray(v, dtype=np.float64)
362
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
363
+ e = np.ascontiguousarray(e, dtype=np.float64)
364
+ t = np.ascontiguousarray(t, dtype=np.float64)
365
+ 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)
366
+
367
+ _lib.scm2cpp_fastica.restype = ctypes.c_int
368
+ _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]
369
+ def fastica(x, winit, comps, white, unmix, mean, maxiter, tol, n, p, nc):
370
+ x = np.ascontiguousarray(x, dtype=np.float64)
371
+ winit = np.ascontiguousarray(winit, dtype=np.float64)
372
+ comps = np.ascontiguousarray(comps, dtype=np.float64)
373
+ white = np.ascontiguousarray(white, dtype=np.float64)
374
+ unmix = np.ascontiguousarray(unmix, dtype=np.float64)
375
+ mean = np.ascontiguousarray(mean, dtype=np.float64)
376
+ 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)
377
+
378
+ _lib.scm2cpp_pca.restype = ctypes.c_int
379
+ _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]
380
+ def pca(x, comps, ev, sv, mean, n, p):
381
+ x = np.ascontiguousarray(x, dtype=np.float64)
382
+ comps = np.ascontiguousarray(comps, dtype=np.float64)
383
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
384
+ sv = np.ascontiguousarray(sv, dtype=np.float64)
385
+ mean = np.ascontiguousarray(mean, dtype=np.float64)
386
+ 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)
387
+
388
+ _lib.scm2cpp_ard_pinvh.restype = ctypes.c_int
389
+ _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]
390
+ def ard_pinvh(a, s, v, ev, e, k):
391
+ a = np.ascontiguousarray(a, dtype=np.float64)
392
+ s = np.ascontiguousarray(s, dtype=np.float64)
393
+ v = np.ascontiguousarray(v, dtype=np.float64)
394
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
395
+ e = np.ascontiguousarray(e, dtype=np.float64)
396
+ 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)
397
+
398
+ _lib.scm2cpp_ard_sigma_coef.restype = ctypes.c_int
399
+ _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]
400
+ def ard_sigma_coef(xy, idx, lam, coef, sigma, a, v, ev, e, gk, alpha, k):
401
+ xy = np.ascontiguousarray(xy, dtype=np.float64)
402
+ idx = np.ascontiguousarray(idx, dtype=np.int32)
403
+ lam = np.ascontiguousarray(lam, dtype=np.float64)
404
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
405
+ sigma = np.ascontiguousarray(sigma, dtype=np.float64)
406
+ a = np.ascontiguousarray(a, dtype=np.float64)
407
+ v = np.ascontiguousarray(v, dtype=np.float64)
408
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
409
+ e = np.ascontiguousarray(e, dtype=np.float64)
410
+ gk = np.ascontiguousarray(gk, dtype=np.float64)
411
+ 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)
412
+
413
+ _lib.scm2cpp_ard.restype = ctypes.c_int
414
+ _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]
415
+ def ard(x, y, coef, sigma, lam, out, maxiter, tol, alpha1, alpha2, lambda1, lambda2, thresh, hoist, n, p):
416
+ x = np.ascontiguousarray(x, dtype=np.float64)
417
+ y = np.ascontiguousarray(y, dtype=np.float64)
418
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
419
+ sigma = np.ascontiguousarray(sigma, dtype=np.float64)
420
+ lam = np.ascontiguousarray(lam, dtype=np.float64)
421
+ out = np.ascontiguousarray(out, dtype=np.float64)
422
+ 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)
423
+
424
+ _lib.scm2cpp_f_regression.restype = ctypes.c_int
425
+ _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]
426
+ def f_regression(x, y, r, f, center, n, p, q):
427
+ x = np.ascontiguousarray(x, dtype=np.float64)
428
+ y = np.ascontiguousarray(y, dtype=np.float64)
429
+ r = np.ascontiguousarray(r, dtype=np.float64)
430
+ f = np.ascontiguousarray(f, dtype=np.float64)
431
+ 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)
432
+
433
+ _lib.scm2cpp_f_classif.restype = ctypes.c_int
434
+ _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]
435
+ def f_classif(x, lab, f, n, p, k):
436
+ x = np.ascontiguousarray(x, dtype=np.float64)
437
+ lab = np.ascontiguousarray(lab, dtype=np.int32)
438
+ f = np.ascontiguousarray(f, dtype=np.float64)
439
+ 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)
440
+
441
+ _lib.scm2cpp_min_pos.restype = ctypes.c_double
442
+ _lib.scm2cpp_min_pos.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int]
443
+ def min_pos(v, m):
444
+ v = np.ascontiguousarray(v, dtype=np.float64)
445
+ return _lib.scm2cpp_min_pos(v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m)
446
+
447
+ _lib.scm2cpp_round_even.restype = ctypes.c_double
448
+ _lib.scm2cpp_round_even.argtypes = [ctypes.c_double]
449
+ def round_even(y):
450
+ return _lib.scm2cpp_round_even(y)
451
+
452
+ _lib.scm2cpp_cholesky_delete.restype = ctypes.c_int
453
+ _lib.scm2cpp_cholesky_delete.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
454
+ def cholesky_delete(l, go, n, k):
455
+ l = np.ascontiguousarray(l, dtype=np.float64)
456
+ return _lib.scm2cpp_cholesky_delete(l.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), go, n, k)
457
+
458
+ _lib.scm2cpp_swap_rc.restype = ctypes.c_int
459
+ _lib.scm2cpp_swap_rc.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
460
+ def swap_rc(g, a, b, p):
461
+ g = np.ascontiguousarray(g, dtype=np.float64)
462
+ return _lib.scm2cpp_swap_rc(g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a, b, p)
463
+
464
+ _lib.scm2cpp_lars.restype = ctypes.c_int
465
+ _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]
466
+ def lars(g, cov, coef, path, alphas, rec, nsamples, alphamin, method, maxiter, eps, p):
467
+ g = np.ascontiguousarray(g, dtype=np.float64)
468
+ cov = np.ascontiguousarray(cov, dtype=np.float64)
469
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
470
+ path = np.ascontiguousarray(path, dtype=np.float64)
471
+ alphas = np.ascontiguousarray(alphas, dtype=np.float64)
472
+ 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)
473
+
474
+ _lib.scm2cpp_rfe_chol.restype = ctypes.c_int
475
+ _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]
476
+ def rfe_chol(g, idx, l, alpha, k, p):
477
+ g = np.ascontiguousarray(g, dtype=np.float64)
478
+ idx = np.ascontiguousarray(idx, dtype=np.int32)
479
+ l = np.ascontiguousarray(l, dtype=np.float64)
480
+ 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)
481
+
482
+ _lib.scm2cpp_rfe_solve.restype = ctypes.c_int
483
+ _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]
484
+ def rfe_solve(c, idx, w, l, k, p):
485
+ c = np.ascontiguousarray(c, dtype=np.float64)
486
+ idx = np.ascontiguousarray(idx, dtype=np.int32)
487
+ w = np.ascontiguousarray(w, dtype=np.float64)
488
+ l = np.ascontiguousarray(l, dtype=np.float64)
489
+ 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)
490
+
491
+ _lib.scm2cpp_rfe.restype = ctypes.c_int
492
+ _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]
493
+ def rfe(x, y, coef, support, ranking, alpha, nsel, step, n, p):
494
+ x = np.ascontiguousarray(x, dtype=np.float64)
495
+ y = np.ascontiguousarray(y, dtype=np.float64)
496
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
497
+ support = np.ascontiguousarray(support, dtype=np.int32)
498
+ ranking = np.ascontiguousarray(ranking, dtype=np.int32)
499
+ 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)
500
+
501
+ _lib.scm2cpp_gram_xx.restype = ctypes.c_int
502
+ _lib.scm2cpp_gram_xx.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
503
+ def gram_xx(x, g, n, p):
504
+ x = np.ascontiguousarray(x, dtype=np.float64)
505
+ g = np.ascontiguousarray(g, dtype=np.float64)
506
+ 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)
507
+
508
+ _lib.scm2cpp_gram_xy.restype = ctypes.c_int
509
+ _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]
510
+ def gram_xy(x, y, c, n, p, q):
511
+ x = np.ascontiguousarray(x, dtype=np.float64)
512
+ y = np.ascontiguousarray(y, dtype=np.float64)
513
+ c = np.ascontiguousarray(c, dtype=np.float64)
514
+ 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)
515
+
516
+ _lib.scm2cpp_spd_solve.restype = ctypes.c_int
517
+ _lib.scm2cpp_spd_solve.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
518
+ def spd_solve(a, b, m, q):
519
+ a = np.ascontiguousarray(a, dtype=np.float64)
520
+ b = np.ascontiguousarray(b, dtype=np.float64)
521
+ 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)
522
+
523
+ _lib.scm2cpp_gram_ridge_solve.restype = ctypes.c_int
524
+ _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]
525
+ def gram_ridge_solve(g, c, alpha, m, q):
526
+ g = np.ascontiguousarray(g, dtype=np.float64)
527
+ c = np.ascontiguousarray(c, dtype=np.float64)
528
+ 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)
529
+
530
+ _lib.scm2cpp_ridge_gcv_primal.restype = ctypes.c_int
531
+ _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]
532
+ def ridge_gcv_primal(x, xm, yc, g, v, lam, z, r, n, p, t):
533
+ x = np.ascontiguousarray(x, dtype=np.float64)
534
+ xm = np.ascontiguousarray(xm, dtype=np.float64)
535
+ yc = np.ascontiguousarray(yc, dtype=np.float64)
536
+ g = np.ascontiguousarray(g, dtype=np.float64)
537
+ v = np.ascontiguousarray(v, dtype=np.float64)
538
+ lam = np.ascontiguousarray(lam, dtype=np.float64)
539
+ z = np.ascontiguousarray(z, dtype=np.float64)
540
+ r = np.ascontiguousarray(r, dtype=np.float64)
541
+ 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)
542
+
543
+ _lib.scm2cpp_ridge_gcv_dual.restype = ctypes.c_int
544
+ _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]
545
+ def ridge_gcv_dual(k, q, mu, yc, z, r, n, t):
546
+ k = np.ascontiguousarray(k, dtype=np.float64)
547
+ q = np.ascontiguousarray(q, dtype=np.float64)
548
+ mu = np.ascontiguousarray(mu, dtype=np.float64)
549
+ yc = np.ascontiguousarray(yc, dtype=np.float64)
550
+ z = np.ascontiguousarray(z, dtype=np.float64)
551
+ r = np.ascontiguousarray(r, dtype=np.float64)
552
+ 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)
553
+
554
+ _lib.scm2cpp_ridge_gcv_scan.restype = ctypes.c_int
555
+ _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]
556
+ def ridge_gcv_scan(z, lam, r, yc, alphas, h0, mse, loo, store, n, m, t, na):
557
+ z = np.ascontiguousarray(z, dtype=np.float64)
558
+ lam = np.ascontiguousarray(lam, dtype=np.float64)
559
+ r = np.ascontiguousarray(r, dtype=np.float64)
560
+ yc = np.ascontiguousarray(yc, dtype=np.float64)
561
+ alphas = np.ascontiguousarray(alphas, dtype=np.float64)
562
+ mse = np.ascontiguousarray(mse, dtype=np.float64)
563
+ loo = np.ascontiguousarray(loo, dtype=np.float64)
564
+ 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)
565
+
566
+ _lib.scm2cpp_kpca_row_norms.restype = ctypes.c_int
567
+ _lib.scm2cpp_kpca_row_norms.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
568
+ def kpca_row_norms(x, s, n, p):
569
+ x = np.ascontiguousarray(x, dtype=np.float64)
570
+ s = np.ascontiguousarray(s, dtype=np.float64)
571
+ 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)
572
+
573
+ _lib.scm2cpp_kpca_apply.restype = ctypes.c_int
574
+ _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]
575
+ def kpca_apply(g, sa, sb, kind, gamma, degree, coef0, na, nb):
576
+ g = np.ascontiguousarray(g, dtype=np.float64)
577
+ sa = np.ascontiguousarray(sa, dtype=np.float64)
578
+ sb = np.ascontiguousarray(sb, dtype=np.float64)
579
+ 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)
580
+
581
+ _lib.scm2cpp_kpca_kernel.restype = ctypes.c_int
582
+ _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]
583
+ def kpca_kernel(x, y, k, kind, gamma, degree, coef0, na, nb, p):
584
+ x = np.ascontiguousarray(x, dtype=np.float64)
585
+ y = np.ascontiguousarray(y, dtype=np.float64)
586
+ k = np.ascontiguousarray(k, dtype=np.float64)
587
+ 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)
588
+
589
+ _lib.scm2cpp_kpca_kernel_self.restype = ctypes.c_int
590
+ _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]
591
+ def kpca_kernel_self(x, k, kind, gamma, degree, coef0, n, p):
592
+ x = np.ascontiguousarray(x, dtype=np.float64)
593
+ k = np.ascontiguousarray(k, dtype=np.float64)
594
+ 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)
595
+
596
+ _lib.scm2cpp_kpca_centre.restype = ctypes.c_int
597
+ _lib.scm2cpp_kpca_centre.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int]
598
+ def kpca_centre(k, m, n):
599
+ k = np.ascontiguousarray(k, dtype=np.float64)
600
+ m = np.ascontiguousarray(m, dtype=np.float64)
601
+ return _lib.scm2cpp_kpca_centre(k.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n)
602
+
603
+ _lib.scm2cpp_kpca_centre_new.restype = ctypes.c_int
604
+ _lib.scm2cpp_kpca_centre_new.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
605
+ def kpca_centre_new(k, m, nb, n):
606
+ k = np.ascontiguousarray(k, dtype=np.float64)
607
+ m = np.ascontiguousarray(m, dtype=np.float64)
608
+ 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)
609
+
610
+ _lib.scm2cpp_kpca_flip.restype = ctypes.c_int
611
+ _lib.scm2cpp_kpca_flip.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
612
+ def kpca_flip(vecs, vals, n, c):
613
+ vecs = np.ascontiguousarray(vecs, dtype=np.float64)
614
+ vals = np.ascontiguousarray(vals, dtype=np.float64)
615
+ 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)
616
+
617
+ _lib.scm2cpp_kpca_top_dense.restype = ctypes.c_int
618
+ _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]
619
+ def kpca_top_dense(k, vecs, vals, n, c):
620
+ k = np.ascontiguousarray(k, dtype=np.float64)
621
+ vecs = np.ascontiguousarray(vecs, dtype=np.float64)
622
+ vals = np.ascontiguousarray(vals, dtype=np.float64)
623
+ 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)
624
+
625
+ _lib.scm2cpp_kpca_orth.restype = ctypes.c_int
626
+ _lib.scm2cpp_kpca_orth.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
627
+ def kpca_orth(y, g, n, b):
628
+ y = np.ascontiguousarray(y, dtype=np.float64)
629
+ g = np.ascontiguousarray(g, dtype=np.float64)
630
+ 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)
631
+
632
+ _lib.scm2cpp_kpca_top_subspace.restype = ctypes.c_int
633
+ _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]
634
+ def kpca_top_subspace(k, q, vecs, vals, n, b, c, tol, maxit):
635
+ k = np.ascontiguousarray(k, dtype=np.float64)
636
+ q = np.ascontiguousarray(q, dtype=np.float64)
637
+ vecs = np.ascontiguousarray(vecs, dtype=np.float64)
638
+ vals = np.ascontiguousarray(vals, dtype=np.float64)
639
+ 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)
640
+
641
+ _lib.scm2cpp_kpca_linear.restype = ctypes.c_int
642
+ _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]
643
+ def kpca_linear(x, xm, g, vecs, vals, n, p, c):
644
+ x = np.ascontiguousarray(x, dtype=np.float64)
645
+ xm = np.ascontiguousarray(xm, dtype=np.float64)
646
+ g = np.ascontiguousarray(g, dtype=np.float64)
647
+ vecs = np.ascontiguousarray(vecs, dtype=np.float64)
648
+ vals = np.ascontiguousarray(vals, dtype=np.float64)
649
+ 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)
650
+
651
+ _lib.scm2cpp_lda_moments.restype = ctypes.c_int
652
+ _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]
653
+ def lda_moments(x, lab, g, means, counts, n, p, k):
654
+ x = np.ascontiguousarray(x, dtype=np.float64)
655
+ lab = np.ascontiguousarray(lab, dtype=np.int32)
656
+ g = np.ascontiguousarray(g, dtype=np.float64)
657
+ means = np.ascontiguousarray(means, dtype=np.float64)
658
+ counts = np.ascontiguousarray(counts, dtype=np.float64)
659
+ 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)
660
+
661
+ _lib.scm2cpp_lda_within.restype = ctypes.c_int
662
+ _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]
663
+ def lda_within(g, means, counts, n, p, k):
664
+ g = np.ascontiguousarray(g, dtype=np.float64)
665
+ means = np.ascontiguousarray(means, dtype=np.float64)
666
+ counts = np.ascontiguousarray(counts, dtype=np.float64)
667
+ 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)
668
+
669
+ _lib.scm2cpp_lda_svd_first.restype = ctypes.c_int
670
+ _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]
671
+ def lda_svd_first(sw, std, v, s, p):
672
+ sw = np.ascontiguousarray(sw, dtype=np.float64)
673
+ std = np.ascontiguousarray(std, dtype=np.float64)
674
+ v = np.ascontiguousarray(v, dtype=np.float64)
675
+ s = np.ascontiguousarray(s, dtype=np.float64)
676
+ 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)
677
+
678
+ _lib.scm2cpp_lda_eigen.restype = ctypes.c_int
679
+ _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]
680
+ def lda_eigen(sb, sw, v, ev, p):
681
+ sb = np.ascontiguousarray(sb, dtype=np.float64)
682
+ sw = np.ascontiguousarray(sw, dtype=np.float64)
683
+ v = np.ascontiguousarray(v, dtype=np.float64)
684
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
685
+ 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)
686
+
687
+ _lib.scm2cpp_tsvd_flip.restype = ctypes.c_int
688
+ _lib.scm2cpp_tsvd_flip.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
689
+ def tsvd_flip(v, z, n, p, k):
690
+ v = np.ascontiguousarray(v, dtype=np.float64)
691
+ z = np.ascontiguousarray(z, dtype=np.float64)
692
+ 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)
693
+
694
+ _lib.scm2cpp_tsvd_tall.restype = ctypes.c_int
695
+ _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]
696
+ def tsvd_tall(x, v, s, z, n, p, k):
697
+ x = np.ascontiguousarray(x, dtype=np.float64)
698
+ v = np.ascontiguousarray(v, dtype=np.float64)
699
+ s = np.ascontiguousarray(s, dtype=np.float64)
700
+ z = np.ascontiguousarray(z, dtype=np.float64)
701
+ 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)
702
+
703
+ _lib.scm2cpp_tsvd_wide.restype = ctypes.c_int
704
+ _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]
705
+ def tsvd_wide(x, v, s, z, n, p, k):
706
+ x = np.ascontiguousarray(x, dtype=np.float64)
707
+ v = np.ascontiguousarray(v, dtype=np.float64)
708
+ s = np.ascontiguousarray(s, dtype=np.float64)
709
+ z = np.ascontiguousarray(z, dtype=np.float64)
710
+ 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)
711
+