scm2cpp-learn 0.22.0__py3-none-macosx_15_0_arm64.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 (71) hide show
  1. scm2cpp_learn/.dylibs/libgcc_s.1.1.dylib +0 -0
  2. scm2cpp_learn/.dylibs/libgfortran.5.dylib +0 -0
  3. scm2cpp_learn/.dylibs/libomp.dylib +0 -0
  4. scm2cpp_learn/.dylibs/libopenblasp-r0.3.34.dylib +0 -0
  5. scm2cpp_learn/.dylibs/libquadmath.0.dylib +0 -0
  6. scm2cpp_learn/__init__.py +4794 -0
  7. scm2cpp_learn/_classifiers.cpython-312-darwin.so +0 -0
  8. scm2cpp_learn/_compat.py +354 -0
  9. scm2cpp_learn/_generated/__init__.py +0 -0
  10. scm2cpp_learn/_generated/_loader.py +41 -0
  11. scm2cpp_learn/_generated/_loader_accel_cublas.py +185 -0
  12. scm2cpp_learn/_generated/_loader_classifiers.py +308 -0
  13. scm2cpp_learn/_generated/_loader_derived_blas.py +29 -0
  14. scm2cpp_learn/_generated/_loader_derived_cublas.py +29 -0
  15. scm2cpp_learn/_generated/_loader_derived_loops.py +29 -0
  16. scm2cpp_learn/_generated/_loader_gpu_cuda.py +313 -0
  17. scm2cpp_learn/_generated/_loader_gramops_blas.py +836 -0
  18. scm2cpp_learn/_generated/_loader_gramops_loops.py +855 -0
  19. scm2cpp_learn/_generated/_loader_nmf_blas.py +29 -0
  20. scm2cpp_learn/_generated/_loader_nmf_cublas.py +29 -0
  21. scm2cpp_learn/_generated/_loader_nmf_loops.py +29 -0
  22. scm2cpp_learn/_generated/accel_cublas/accel.cpp +26 -0
  23. scm2cpp_learn/_generated/accel_cublas/accel.hpp +1250 -0
  24. scm2cpp_learn/_generated/accel_cublas/accel_capi.cpp +82 -0
  25. scm2cpp_learn/_generated/classifiers.cpp +37 -0
  26. scm2cpp_learn/_generated/classifiers.hpp +3745 -0
  27. scm2cpp_learn/_generated/classifiers_capi.cpp +115 -0
  28. scm2cpp_learn/_generated/derived_blas/lasso_design.cpp +5 -0
  29. scm2cpp_learn/_generated/derived_blas/lasso_design.hpp +156 -0
  30. scm2cpp_learn/_generated/derived_blas/lasso_design_capi.cpp +19 -0
  31. scm2cpp_learn/_generated/derived_cublas/lasso_design.cpp +5 -0
  32. scm2cpp_learn/_generated/derived_cublas/lasso_design.hpp +158 -0
  33. scm2cpp_learn/_generated/derived_cublas/lasso_design_capi.cpp +19 -0
  34. scm2cpp_learn/_generated/derived_loops/lasso_design.cpp +5 -0
  35. scm2cpp_learn/_generated/derived_loops/lasso_design.hpp +179 -0
  36. scm2cpp_learn/_generated/derived_loops/lasso_design_capi.cpp +19 -0
  37. scm2cpp_learn/_generated/gpu_cuda/gpu.cpp +37 -0
  38. scm2cpp_learn/_generated/gpu_cuda/gpu.hpp +3846 -0
  39. scm2cpp_learn/_generated/gpu_cuda/gpu_capi.cpp +308 -0
  40. scm2cpp_learn/_generated/gramops_blas/gramops.cpp +99 -0
  41. scm2cpp_learn/_generated/gramops_blas/gramops.hpp +6655 -0
  42. scm2cpp_learn/_generated/gramops_blas/gramops_capi.cpp +295 -0
  43. scm2cpp_learn/_generated/gramops_loops/gramops.cpp +99 -0
  44. scm2cpp_learn/_generated/gramops_loops/gramops.hpp +7711 -0
  45. scm2cpp_learn/_generated/gramops_loops/gramops_capi.cpp +301 -0
  46. scm2cpp_learn/_generated/lasso_cov.cpp +7 -0
  47. scm2cpp_learn/_generated/lasso_cov.hpp +152 -0
  48. scm2cpp_learn/_generated/lasso_cov_capi.cpp +25 -0
  49. scm2cpp_learn/_generated/nmf_blas/nmf_cd.cpp +5 -0
  50. scm2cpp_learn/_generated/nmf_blas/nmf_cd.hpp +132 -0
  51. scm2cpp_learn/_generated/nmf_blas/nmf_cd_capi.cpp +19 -0
  52. scm2cpp_learn/_generated/nmf_cublas/nmf_cd.cpp +5 -0
  53. scm2cpp_learn/_generated/nmf_cublas/nmf_cd.hpp +136 -0
  54. scm2cpp_learn/_generated/nmf_cublas/nmf_cd_capi.cpp +19 -0
  55. scm2cpp_learn/_generated/nmf_loops/nmf_cd.cpp +5 -0
  56. scm2cpp_learn/_generated/nmf_loops/nmf_cd.hpp +167 -0
  57. scm2cpp_learn/_generated/nmf_loops/nmf_cd_capi.cpp +19 -0
  58. scm2cpp_learn/_generated/scm2cpp-blas.hpp +176 -0
  59. scm2cpp_learn/_generated/scm2cpp-cublas.hpp +155 -0
  60. scm2cpp_learn/_generated/scm2cpp-cuda.hpp +285 -0
  61. scm2cpp_learn/_generated/scm2cpp.hpp +1641 -0
  62. scm2cpp_learn/_gramops_blas.cpython-312-darwin.so +0 -0
  63. scm2cpp_learn/_lasso_cov.cpython-312-darwin.so +0 -0
  64. scm2cpp_learn/_lasso_derived_blas.cpython-312-darwin.so +0 -0
  65. scm2cpp_learn/_libfind.py +153 -0
  66. scm2cpp_learn/_nmf_blas.cpython-312-darwin.so +0 -0
  67. scm2cpp_learn/batch_capi.cu +431 -0
  68. scm2cpp_learn-0.22.0.dist-info/METADATA +1350 -0
  69. scm2cpp_learn-0.22.0.dist-info/RECORD +71 -0
  70. scm2cpp_learn-0.22.0.dist-info/WHEEL +6 -0
  71. scm2cpp_learn-0.22.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,855 @@
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_int64
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_int64]
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_int64
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_int64]
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_int64
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_int64]
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_int64
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_int64, ctypes.c_double, ctypes.c_int64]
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_int64
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_int64, ctypes.c_double, ctypes.c_double, ctypes.c_int64]
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_int64
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_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
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_int64, ctypes.c_double, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
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_int64, ctypes.c_double, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64, ctypes.c_double, ctypes.c_double, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
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_int64, ctypes.c_double, ctypes.c_double, ctypes.c_int64, ctypes.c_double, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
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_int64
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_int64
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_int64]
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_int64, ctypes.POINTER(ctypes.c_double), ctypes.c_int64]
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_int64, ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
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_int64, ctypes.c_double, ctypes.c_int64]
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_int64
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_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
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_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_double, ctypes.c_int64]
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_int64
238
+ _lib.scm2cpp_lbfgs.argtypes = [ctypes.c_int64, 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_int64, ctypes.c_int64, ctypes.c_double, ctypes.c_double, ctypes.c_int64, ctypes.c_int64, ctypes.c_double, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64, 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_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
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_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
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_int64, ctypes.c_double, ctypes.c_double, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
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_int64]
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_int64
326
+ _lib.scm2cpp_eig_order.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.c_int64]
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_int64
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_int64, ctypes.c_int64]
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_int64
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_int64]
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_int64
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_int64]
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_int64
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_int64, ctypes.c_double, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
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_int64, ctypes.c_int64]
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_int64
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_int64]
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_int64
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_int64]
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_int64
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_int64, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
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_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
434
+ _lib.scm2cpp_f_classif.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64]
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_int64
453
+ _lib.scm2cpp_cholesky_delete.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
459
+ _lib.scm2cpp_swap_rc.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
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_int64, ctypes.c_double, ctypes.c_double, ctypes.c_int64, ctypes.c_int64, ctypes.c_double, ctypes.c_int64]
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_int64
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_int64, ctypes.c_int64]
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_int64
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_int64, ctypes.c_int64]
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_int64
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_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
502
+ _lib.scm2cpp_gram_xx.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
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_int64
509
+ _lib.scm2cpp_gram_xy.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
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_int64
517
+ _lib.scm2cpp_spd_solve.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
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_abs.restype = ctypes.c_double
524
+ _lib.scm2cpp_gram_abs.argtypes = [ctypes.c_double]
525
+ def gram_abs(x):
526
+ return _lib.scm2cpp_gram_abs(x)
527
+
528
+ _lib.scm2cpp_spd_solve_rcond.restype = ctypes.c_double
529
+ _lib.scm2cpp_spd_solve_rcond.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
530
+ def spd_solve_rcond(a, b, m, q):
531
+ a = np.ascontiguousarray(a, dtype=np.float64)
532
+ b = np.ascontiguousarray(b, dtype=np.float64)
533
+ return _lib.scm2cpp_spd_solve_rcond(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), b.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m, q)
534
+
535
+ _lib.scm2cpp_gram_ridge_solve.restype = ctypes.c_int64
536
+ _lib.scm2cpp_gram_ridge_solve.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int64, ctypes.c_int64]
537
+ def gram_ridge_solve(g, c, alpha, m, q):
538
+ g = np.ascontiguousarray(g, dtype=np.float64)
539
+ c = np.ascontiguousarray(c, dtype=np.float64)
540
+ 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)
541
+
542
+ _lib.scm2cpp_ridge_gcv_primal.restype = ctypes.c_int64
543
+ _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_int64, ctypes.c_int64, ctypes.c_int64]
544
+ def ridge_gcv_primal(x, xm, yc, g, v, lam, z, r, n, p, t):
545
+ x = np.ascontiguousarray(x, dtype=np.float64)
546
+ xm = np.ascontiguousarray(xm, dtype=np.float64)
547
+ yc = np.ascontiguousarray(yc, dtype=np.float64)
548
+ g = np.ascontiguousarray(g, dtype=np.float64)
549
+ v = np.ascontiguousarray(v, dtype=np.float64)
550
+ lam = np.ascontiguousarray(lam, dtype=np.float64)
551
+ z = np.ascontiguousarray(z, dtype=np.float64)
552
+ r = np.ascontiguousarray(r, dtype=np.float64)
553
+ 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)
554
+
555
+ _lib.scm2cpp_ridge_gcv_dual.restype = ctypes.c_int64
556
+ _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.c_int64, ctypes.c_int64, ctypes.c_int64]
557
+ def ridge_gcv_dual(k, q, mu, yc, r, n, t, icpt):
558
+ k = np.ascontiguousarray(k, dtype=np.float64)
559
+ q = np.ascontiguousarray(q, dtype=np.float64)
560
+ mu = np.ascontiguousarray(mu, dtype=np.float64)
561
+ yc = np.ascontiguousarray(yc, dtype=np.float64)
562
+ r = np.ascontiguousarray(r, dtype=np.float64)
563
+ 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)), r.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, t, icpt)
564
+
565
+ _lib.scm2cpp_ridge_gcv_scan_dual.restype = ctypes.c_int64
566
+ _lib.scm2cpp_ridge_gcv_scan_dual.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
567
+ def ridge_gcv_scan_dual(q, mu, r, alphas, drop, mse, loo, store, n, t, na):
568
+ q = np.ascontiguousarray(q, dtype=np.float64)
569
+ mu = np.ascontiguousarray(mu, dtype=np.float64)
570
+ r = np.ascontiguousarray(r, dtype=np.float64)
571
+ alphas = np.ascontiguousarray(alphas, dtype=np.float64)
572
+ mse = np.ascontiguousarray(mse, dtype=np.float64)
573
+ loo = np.ascontiguousarray(loo, dtype=np.float64)
574
+ return _lib.scm2cpp_ridge_gcv_scan_dual(q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), mu.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), r.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alphas.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), drop, mse.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), loo.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), store, n, t, na)
575
+
576
+ _lib.scm2cpp_ridge_gcv_scan.restype = ctypes.c_int64
577
+ _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_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
578
+ def ridge_gcv_scan(z, lam, r, yc, alphas, h0, mse, loo, store, n, m, t, na):
579
+ z = np.ascontiguousarray(z, dtype=np.float64)
580
+ lam = np.ascontiguousarray(lam, dtype=np.float64)
581
+ r = np.ascontiguousarray(r, dtype=np.float64)
582
+ yc = np.ascontiguousarray(yc, dtype=np.float64)
583
+ alphas = np.ascontiguousarray(alphas, dtype=np.float64)
584
+ mse = np.ascontiguousarray(mse, dtype=np.float64)
585
+ loo = np.ascontiguousarray(loo, dtype=np.float64)
586
+ 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)
587
+
588
+ _lib.scm2cpp_kpca_row_norms.restype = ctypes.c_int64
589
+ _lib.scm2cpp_kpca_row_norms.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
590
+ def kpca_row_norms(x, s, n, p):
591
+ x = np.ascontiguousarray(x, dtype=np.float64)
592
+ s = np.ascontiguousarray(s, dtype=np.float64)
593
+ 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)
594
+
595
+ _lib.scm2cpp_kpca_apply.restype = ctypes.c_int64
596
+ _lib.scm2cpp_kpca_apply.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_int64, ctypes.c_int64]
597
+ def kpca_apply(g, sa, sb, kind, gamma, degree, coef0, na, nb):
598
+ g = np.ascontiguousarray(g, dtype=np.float64)
599
+ sa = np.ascontiguousarray(sa, dtype=np.float64)
600
+ sb = np.ascontiguousarray(sb, dtype=np.float64)
601
+ 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)
602
+
603
+ _lib.scm2cpp_kpca_kernel.restype = ctypes.c_int64
604
+ _lib.scm2cpp_kpca_kernel.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
605
+ def kpca_kernel(x, y, k, kind, gamma, degree, coef0, na, nb, p):
606
+ x = np.ascontiguousarray(x, dtype=np.float64)
607
+ y = np.ascontiguousarray(y, dtype=np.float64)
608
+ k = np.ascontiguousarray(k, dtype=np.float64)
609
+ 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)
610
+
611
+ _lib.scm2cpp_kpca_kernel_self.restype = ctypes.c_int64
612
+ _lib.scm2cpp_kpca_kernel_self.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_int64, ctypes.c_int64]
613
+ def kpca_kernel_self(x, k, kind, gamma, degree, coef0, n, p):
614
+ x = np.ascontiguousarray(x, dtype=np.float64)
615
+ k = np.ascontiguousarray(k, dtype=np.float64)
616
+ 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)
617
+
618
+ _lib.scm2cpp_kpca_centre.restype = ctypes.c_int64
619
+ _lib.scm2cpp_kpca_centre.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64]
620
+ def kpca_centre(k, m, n):
621
+ k = np.ascontiguousarray(k, dtype=np.float64)
622
+ m = np.ascontiguousarray(m, dtype=np.float64)
623
+ return _lib.scm2cpp_kpca_centre(k.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n)
624
+
625
+ _lib.scm2cpp_kpca_centre_new.restype = ctypes.c_int64
626
+ _lib.scm2cpp_kpca_centre_new.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
627
+ def kpca_centre_new(k, m, nb, n):
628
+ k = np.ascontiguousarray(k, dtype=np.float64)
629
+ m = np.ascontiguousarray(m, dtype=np.float64)
630
+ 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)
631
+
632
+ _lib.scm2cpp_kpca_flip.restype = ctypes.c_int64
633
+ _lib.scm2cpp_kpca_flip.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
634
+ def kpca_flip(vecs, vals, n, c):
635
+ vecs = np.ascontiguousarray(vecs, dtype=np.float64)
636
+ vals = np.ascontiguousarray(vals, dtype=np.float64)
637
+ 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)
638
+
639
+ _lib.scm2cpp_kpca_top_dense.restype = ctypes.c_int64
640
+ _lib.scm2cpp_kpca_top_dense.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
641
+ def kpca_top_dense(k, vecs, vals, n, c):
642
+ k = np.ascontiguousarray(k, dtype=np.float64)
643
+ vecs = np.ascontiguousarray(vecs, dtype=np.float64)
644
+ vals = np.ascontiguousarray(vals, dtype=np.float64)
645
+ 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)
646
+
647
+ _lib.scm2cpp_kpca_orth.restype = ctypes.c_int64
648
+ _lib.scm2cpp_kpca_orth.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
649
+ def kpca_orth(y, g, n, b):
650
+ y = np.ascontiguousarray(y, dtype=np.float64)
651
+ g = np.ascontiguousarray(g, dtype=np.float64)
652
+ 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)
653
+
654
+ _lib.scm2cpp_kpca_top_subspace.restype = ctypes.c_int64
655
+ _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_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_double, ctypes.c_int64]
656
+ def kpca_top_subspace(k, q, vecs, vals, n, b, c, tol, maxit):
657
+ k = np.ascontiguousarray(k, dtype=np.float64)
658
+ q = np.ascontiguousarray(q, dtype=np.float64)
659
+ vecs = np.ascontiguousarray(vecs, dtype=np.float64)
660
+ vals = np.ascontiguousarray(vals, dtype=np.float64)
661
+ 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)
662
+
663
+ _lib.scm2cpp_kpca_linear.restype = ctypes.c_int64
664
+ _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_int64, ctypes.c_int64, ctypes.c_int64]
665
+ def kpca_linear(x, xm, g, vecs, vals, n, p, c):
666
+ x = np.ascontiguousarray(x, dtype=np.float64)
667
+ xm = np.ascontiguousarray(xm, dtype=np.float64)
668
+ g = np.ascontiguousarray(g, dtype=np.float64)
669
+ vecs = np.ascontiguousarray(vecs, dtype=np.float64)
670
+ vals = np.ascontiguousarray(vals, dtype=np.float64)
671
+ 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)
672
+
673
+ _lib.scm2cpp_lda_moments.restype = ctypes.c_int64
674
+ _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_int64, ctypes.c_int64, ctypes.c_int64]
675
+ def lda_moments(x, lab, g, means, counts, n, p, k):
676
+ x = np.ascontiguousarray(x, dtype=np.float64)
677
+ lab = np.ascontiguousarray(lab, dtype=np.int32)
678
+ g = np.ascontiguousarray(g, dtype=np.float64)
679
+ means = np.ascontiguousarray(means, dtype=np.float64)
680
+ counts = np.ascontiguousarray(counts, dtype=np.float64)
681
+ 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)
682
+
683
+ _lib.scm2cpp_lda_within.restype = ctypes.c_int64
684
+ _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_int64, ctypes.c_int64]
685
+ def lda_within(g, means, counts, n, p, k):
686
+ g = np.ascontiguousarray(g, dtype=np.float64)
687
+ means = np.ascontiguousarray(means, dtype=np.float64)
688
+ counts = np.ascontiguousarray(counts, dtype=np.float64)
689
+ 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)
690
+
691
+ _lib.scm2cpp_lda_svd_first.restype = ctypes.c_int64
692
+ _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_int64]
693
+ def lda_svd_first(sw, std, v, s, p):
694
+ sw = np.ascontiguousarray(sw, dtype=np.float64)
695
+ std = np.ascontiguousarray(std, dtype=np.float64)
696
+ v = np.ascontiguousarray(v, dtype=np.float64)
697
+ s = np.ascontiguousarray(s, dtype=np.float64)
698
+ 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)
699
+
700
+ _lib.scm2cpp_lda_eigen.restype = ctypes.c_int64
701
+ _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_int64]
702
+ def lda_eigen(sb, sw, v, ev, p):
703
+ sb = np.ascontiguousarray(sb, dtype=np.float64)
704
+ sw = np.ascontiguousarray(sw, dtype=np.float64)
705
+ v = np.ascontiguousarray(v, dtype=np.float64)
706
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
707
+ 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)
708
+
709
+ _lib.scm2cpp_tsvd_flip.restype = ctypes.c_int64
710
+ _lib.scm2cpp_tsvd_flip.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
711
+ def tsvd_flip(v, z, n, p, k):
712
+ v = np.ascontiguousarray(v, dtype=np.float64)
713
+ z = np.ascontiguousarray(z, dtype=np.float64)
714
+ 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)
715
+
716
+ _lib.scm2cpp_tsvd_tall.restype = ctypes.c_int64
717
+ _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_int64, ctypes.c_int64, ctypes.c_int64]
718
+ def tsvd_tall(x, v, s, z, n, p, k):
719
+ x = np.ascontiguousarray(x, dtype=np.float64)
720
+ v = np.ascontiguousarray(v, dtype=np.float64)
721
+ s = np.ascontiguousarray(s, dtype=np.float64)
722
+ z = np.ascontiguousarray(z, dtype=np.float64)
723
+ 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)
724
+
725
+ _lib.scm2cpp_tsvd_wide.restype = ctypes.c_int64
726
+ _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_int64, ctypes.c_int64, ctypes.c_int64]
727
+ def tsvd_wide(x, v, s, z, n, p, k):
728
+ x = np.ascontiguousarray(x, dtype=np.float64)
729
+ v = np.ascontiguousarray(v, dtype=np.float64)
730
+ s = np.ascontiguousarray(s, dtype=np.float64)
731
+ z = np.ascontiguousarray(z, dtype=np.float64)
732
+ 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)
733
+
734
+ _lib.scm2cpp_tsvd_gram.restype = ctypes.c_int64
735
+ _lib.scm2cpp_tsvd_gram.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
736
+ def tsvd_gram(g, v, s, m, k):
737
+ g = np.ascontiguousarray(g, dtype=np.float64)
738
+ v = np.ascontiguousarray(v, dtype=np.float64)
739
+ s = np.ascontiguousarray(s, dtype=np.float64)
740
+ return _lib.scm2cpp_tsvd_gram(g.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)), m, k)
741
+
742
+ _lib.scm2cpp_svd_jacobi.restype = ctypes.c_int64
743
+ _lib.scm2cpp_svd_jacobi.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
744
+ def svd_jacobi(w, q, r, c):
745
+ w = np.ascontiguousarray(w, dtype=np.float64)
746
+ q = np.ascontiguousarray(q, dtype=np.float64)
747
+ return _lib.scm2cpp_svd_jacobi(w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), r, c)
748
+
749
+ _lib.scm2cpp_svd_collect.restype = ctypes.c_int64
750
+ _lib.scm2cpp_svd_collect.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.c_int64, ctypes.c_int64]
751
+ def svd_collect(w, q, s, l, rr, ord, r, c):
752
+ w = np.ascontiguousarray(w, dtype=np.float64)
753
+ q = np.ascontiguousarray(q, dtype=np.float64)
754
+ s = np.ascontiguousarray(s, dtype=np.float64)
755
+ l = np.ascontiguousarray(l, dtype=np.float64)
756
+ rr = np.ascontiguousarray(rr, dtype=np.float64)
757
+ ord = np.ascontiguousarray(ord, dtype=np.int32)
758
+ return _lib.scm2cpp_svd_collect(w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), s.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), l.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rr.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ord.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), r, c)
759
+
760
+ _lib.scm2cpp_sym_svd.restype = ctypes.c_int64
761
+ _lib.scm2cpp_sym_svd.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
762
+ def sym_svd(a, u, s, vt, m, n):
763
+ a = np.ascontiguousarray(a, dtype=np.float64)
764
+ u = np.ascontiguousarray(u, dtype=np.float64)
765
+ s = np.ascontiguousarray(s, dtype=np.float64)
766
+ vt = np.ascontiguousarray(vt, dtype=np.float64)
767
+ return _lib.scm2cpp_sym_svd(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), u.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), s.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), vt.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m, n)
768
+
769
+ _lib.scm2cpp_pls_pinv.restype = ctypes.c_int64
770
+ _lib.scm2cpp_pls_pinv.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64]
771
+ def pls_pinv(a, pv, m):
772
+ a = np.ascontiguousarray(a, dtype=np.float64)
773
+ pv = np.ascontiguousarray(pv, dtype=np.float64)
774
+ return _lib.scm2cpp_pls_pinv(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), pv.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m)
775
+
776
+ _lib.scm2cpp_pls_mv.restype = ctypes.c_int64
777
+ _lib.scm2cpp_pls_mv.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
778
+ def pls_mv(a, x, y, m, n):
779
+ a = np.ascontiguousarray(a, dtype=np.float64)
780
+ x = np.ascontiguousarray(x, dtype=np.float64)
781
+ y = np.ascontiguousarray(y, dtype=np.float64)
782
+ return _lib.scm2cpp_pls_mv(a.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)), m, n)
783
+
784
+ _lib.scm2cpp_pls_mtv.restype = ctypes.c_int64
785
+ _lib.scm2cpp_pls_mtv.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
786
+ def pls_mtv(a, x, y, m, n):
787
+ a = np.ascontiguousarray(a, dtype=np.float64)
788
+ x = np.ascontiguousarray(x, dtype=np.float64)
789
+ y = np.ascontiguousarray(y, dtype=np.float64)
790
+ return _lib.scm2cpp_pls_mtv(a.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)), m, n)
791
+
792
+ _lib.scm2cpp_pls_dot.restype = ctypes.c_double
793
+ _lib.scm2cpp_pls_dot.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64]
794
+ def pls_dot(x, y, m):
795
+ x = np.ascontiguousarray(x, dtype=np.float64)
796
+ y = np.ascontiguousarray(y, dtype=np.float64)
797
+ return _lib.scm2cpp_pls_dot(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), m)
798
+
799
+ _lib.scm2cpp_pls_fit.restype = ctypes.c_int64
800
+ _lib.scm2cpp_pls_fit.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_int), ctypes.c_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_double]
801
+ def pls_fit(cxx, cxy, cyy, xw, yw, xl, yl, niter, p, q, k, mode, canon, algo, maxit, tol):
802
+ cxx = np.ascontiguousarray(cxx, dtype=np.float64)
803
+ cxy = np.ascontiguousarray(cxy, dtype=np.float64)
804
+ cyy = np.ascontiguousarray(cyy, dtype=np.float64)
805
+ xw = np.ascontiguousarray(xw, dtype=np.float64)
806
+ yw = np.ascontiguousarray(yw, dtype=np.float64)
807
+ xl = np.ascontiguousarray(xl, dtype=np.float64)
808
+ yl = np.ascontiguousarray(yl, dtype=np.float64)
809
+ niter = np.ascontiguousarray(niter, dtype=np.int32)
810
+ return _lib.scm2cpp_pls_fit(cxx.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), cxy.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), cyy.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), xw.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), yw.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), xl.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), yl.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), niter.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), p, q, k, mode, canon, algo, maxit, tol)
811
+
812
+ _lib.scm2cpp_fa_fit.restype = ctypes.c_int64
813
+ _lib.scm2cpp_fa_fit.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_int64, ctypes.c_int64, ctypes.c_int64, ctypes.c_double]
814
+ def fa_fit(c, var, psi, w, ll, n, p, k, maxit, tol):
815
+ c = np.ascontiguousarray(c, dtype=np.float64)
816
+ var = np.ascontiguousarray(var, dtype=np.float64)
817
+ psi = np.ascontiguousarray(psi, dtype=np.float64)
818
+ w = np.ascontiguousarray(w, dtype=np.float64)
819
+ ll = np.ascontiguousarray(ll, dtype=np.float64)
820
+ return _lib.scm2cpp_fa_fit(c.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), var.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), psi.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ll.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, p, k, maxit, tol)
821
+
822
+ _lib.scm2cpp_linreg_solve.restype = ctypes.c_int64
823
+ _lib.scm2cpp_linreg_solve.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64, ctypes.c_double, ctypes.c_double]
824
+ def linreg_solve(g, b, coef, p, t, ratio, tol):
825
+ g = np.ascontiguousarray(g, dtype=np.float64)
826
+ b = np.ascontiguousarray(b, dtype=np.float64)
827
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
828
+ return _lib.scm2cpp_linreg_solve(g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), b.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), p, t, ratio, tol)
829
+
830
+ _lib.scm2cpp_linreg_singular.restype = ctypes.c_int64
831
+ _lib.scm2cpp_linreg_singular.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_double]
832
+ def linreg_singular(g, s, p, tol):
833
+ g = np.ascontiguousarray(g, dtype=np.float64)
834
+ s = np.ascontiguousarray(s, dtype=np.float64)
835
+ return _lib.scm2cpp_linreg_singular(g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), s.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), p, tol)
836
+
837
+ _lib.scm2cpp_csr_gram.restype = ctypes.c_int64
838
+ _lib.scm2cpp_csr_gram.argtypes = [ctypes.POINTER(ctypes.c_int64), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64, ctypes.c_int64]
839
+ def csr_gram(rp, ci, v, g, p, r0, r1):
840
+ rp = np.ascontiguousarray(rp, dtype=np.int64)
841
+ ci = np.ascontiguousarray(ci, dtype=np.int32)
842
+ v = np.ascontiguousarray(v, dtype=np.float64)
843
+ g = np.ascontiguousarray(g, dtype=np.float64)
844
+ return _lib.scm2cpp_csr_gram(rp.ctypes.data_as(ctypes.POINTER(ctypes.c_int64)), ci.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), p, r0, r1)
845
+
846
+ _lib.scm2cpp_csr_mm.restype = ctypes.c_int64
847
+ _lib.scm2cpp_csr_mm.argtypes = [ctypes.POINTER(ctypes.c_int64), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int64, ctypes.c_int64]
848
+ def csr_mm(rp, ci, v, b, c, n, k):
849
+ rp = np.ascontiguousarray(rp, dtype=np.int64)
850
+ ci = np.ascontiguousarray(ci, dtype=np.int32)
851
+ v = np.ascontiguousarray(v, dtype=np.float64)
852
+ b = np.ascontiguousarray(b, dtype=np.float64)
853
+ c = np.ascontiguousarray(c, dtype=np.float64)
854
+ return _lib.scm2cpp_csr_mm(rp.ctypes.data_as(ctypes.POINTER(ctypes.c_int64)), ci.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), b.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), c.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), n, k)
855
+