scm2cpp-lasso 0.12.0__tar.gz → 0.13.0__tar.gz

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 (66) hide show
  1. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/PKG-INFO +16 -2
  2. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/README.md +14 -0
  3. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/pyproject.toml +3 -3
  4. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/setup.py +22 -0
  5. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/__init__.py +20 -7
  6. scm2cpp_lasso-0.13.0/src/scm2cpp_lasso/_generated/_loader_gpu_cuda.py +294 -0
  7. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/_loader_gramops_blas.py +3 -6
  8. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/_loader_gramops_loops.py +3 -6
  9. scm2cpp_lasso-0.13.0/src/scm2cpp_lasso/_generated/gpu_cuda/gpu.cpp +35 -0
  10. scm2cpp_lasso-0.13.0/src/scm2cpp_lasso/_generated/gpu_cuda/gpu.hpp +3715 -0
  11. scm2cpp_lasso-0.13.0/src/scm2cpp_lasso/_generated/gpu_cuda/gpu_capi.cpp +289 -0
  12. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/gramops_blas/gramops.hpp +36 -22
  13. {scm2cpp_lasso-0.12.0/src/scm2cpp_lasso/_generated/gramops_loops → scm2cpp_lasso-0.13.0/src/scm2cpp_lasso/_generated/gramops_blas}/gramops_capi.cpp +2 -2
  14. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/gramops_loops/gramops.hpp +170 -146
  15. {scm2cpp_lasso-0.12.0/src/scm2cpp_lasso/_generated/gramops_blas → scm2cpp_lasso-0.13.0/src/scm2cpp_lasso/_generated/gramops_loops}/gramops_capi.cpp +2 -2
  16. scm2cpp_lasso-0.13.0/src/scm2cpp_lasso/_generated/scm2cpp-cuda.hpp +285 -0
  17. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/scm2cpp.hpp +18 -7
  18. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_libfind.py +12 -0
  19. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso.egg-info/PKG-INFO +16 -2
  20. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso.egg-info/SOURCES.txt +5 -0
  21. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/setup.cfg +0 -0
  22. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/__init__.py +0 -0
  23. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/_loader.py +0 -0
  24. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/_loader_accel_cublas.py +0 -0
  25. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/_loader_classifiers.py +0 -0
  26. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/_loader_derived_blas.py +0 -0
  27. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/_loader_derived_cublas.py +0 -0
  28. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/_loader_derived_loops.py +0 -0
  29. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/_loader_nmf_blas.py +0 -0
  30. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/_loader_nmf_cublas.py +0 -0
  31. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/_loader_nmf_loops.py +0 -0
  32. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/accel_cublas/accel.cpp +0 -0
  33. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/accel_cublas/accel.hpp +0 -0
  34. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/accel_cublas/accel_capi.cpp +0 -0
  35. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/classifiers.cpp +0 -0
  36. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/classifiers.hpp +0 -0
  37. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/classifiers_capi.cpp +0 -0
  38. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/derived_blas/lasso_design.cpp +0 -0
  39. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/derived_blas/lasso_design.hpp +0 -0
  40. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/derived_blas/lasso_design_capi.cpp +0 -0
  41. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/derived_cublas/lasso_design.cpp +0 -0
  42. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/derived_cublas/lasso_design.hpp +0 -0
  43. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/derived_cublas/lasso_design_capi.cpp +0 -0
  44. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/derived_loops/lasso_design.cpp +0 -0
  45. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/derived_loops/lasso_design.hpp +0 -0
  46. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/derived_loops/lasso_design_capi.cpp +0 -0
  47. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/gramops_blas/gramops.cpp +0 -0
  48. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/gramops_loops/gramops.cpp +0 -0
  49. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/lasso_cov.cpp +0 -0
  50. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/lasso_cov.hpp +0 -0
  51. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/lasso_cov_capi.cpp +0 -0
  52. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/nmf_blas/nmf_cd.cpp +0 -0
  53. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/nmf_blas/nmf_cd.hpp +0 -0
  54. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/nmf_blas/nmf_cd_capi.cpp +0 -0
  55. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/nmf_cublas/nmf_cd.cpp +0 -0
  56. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/nmf_cublas/nmf_cd.hpp +0 -0
  57. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/nmf_cublas/nmf_cd_capi.cpp +0 -0
  58. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/nmf_loops/nmf_cd.cpp +0 -0
  59. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/nmf_loops/nmf_cd.hpp +0 -0
  60. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/nmf_loops/nmf_cd_capi.cpp +0 -0
  61. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/scm2cpp-blas.hpp +0 -0
  62. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/_generated/scm2cpp-cublas.hpp +0 -0
  63. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso/batch_capi.cu +0 -0
  64. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso.egg-info/dependency_links.txt +0 -0
  65. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso.egg-info/requires.txt +0 -0
  66. {scm2cpp_lasso-0.12.0 → scm2cpp_lasso-0.13.0}/src/scm2cpp_lasso.egg-info/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scm2cpp-lasso
3
- Version: 0.12.0
4
- Summary: scikit-learn estimators (lasso, elastic net, ridge, ARD, SVM, SVR, logistic regression, GLMs, Huber, Theil-Sen, F-score selection, RFE, NMF, Gaussian mixture, FastICA, PCA, graphical lasso, RANSAC, SGD, OMP, LARS) translated from Scheme to C++ by scm2cpp; GPU batch solver included
3
+ Version: 0.13.0
4
+ Summary: scikit-learn estimators (lasso, elastic net, ridge, ARD, SVM, SVR, logistic regression, GLMs, Huber, Theil-Sen, F-score selection, RFE, NMF, Gaussian mixture, FastICA, PCA, graphical lasso, RANSAC, SGD, OMP, LARS) translated from Scheme to C++ by scm2cpp; GPU batch solver and CUDA kernels included
5
5
  Author: Hirotaka Niitsuma
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/niitsuma/scm2cpp
@@ -733,6 +733,20 @@ estimators (`GramLassoLarsIC`, `GramLarsCV`, `GramLassoLarsCV`,
733
733
  `GramLars`, `GramLassoLars`, `CovPCA`) form a large X'X on the device
734
734
  when one answers. `SCM2CPP_NO_DEVICE=1` keeps everything on the CPU.
735
735
 
736
+ ## The GPU build
737
+
738
+ Where the CUDA toolkit is at install time, `ParallelFastICA`,
739
+ `EMGaussianMixture`, `LBFGSLogisticRegression`,
740
+ `LBFGSLogisticRegressionCV`, `LBFGSHuberRegressor` and the `LBFGS*`
741
+ GLMs also get the same Scheme translated with `--cuda`
742
+ (`libscm2cpp_gpu.so`). Its loops are CUDA kernels and its products
743
+ cuBLAS, on arrays that stay on the device. The classes take it when a
744
+ device answers and the data has a million entries or more, and give
745
+ the CPU build's iterations and results to the last digits. Measured
746
+ against scikit-learn: 10-22x for the L-BFGS fits, 6.7x FastICA, 3x the
747
+ mixture and LogisticRegressionCV (the repository README's table).
748
+ `SCM2CPP_NO_DEVICE=1` keeps everything on the CPU.
749
+
736
750
  ## Logistic regression with L1
737
751
 
738
752
  `CovLogistic` solves L1-penalized logistic regression by
@@ -715,6 +715,20 @@ estimators (`GramLassoLarsIC`, `GramLarsCV`, `GramLassoLarsCV`,
715
715
  `GramLars`, `GramLassoLars`, `CovPCA`) form a large X'X on the device
716
716
  when one answers. `SCM2CPP_NO_DEVICE=1` keeps everything on the CPU.
717
717
 
718
+ ## The GPU build
719
+
720
+ Where the CUDA toolkit is at install time, `ParallelFastICA`,
721
+ `EMGaussianMixture`, `LBFGSLogisticRegression`,
722
+ `LBFGSLogisticRegressionCV`, `LBFGSHuberRegressor` and the `LBFGS*`
723
+ GLMs also get the same Scheme translated with `--cuda`
724
+ (`libscm2cpp_gpu.so`). Its loops are CUDA kernels and its products
725
+ cuBLAS, on arrays that stay on the device. The classes take it when a
726
+ device answers and the data has a million entries or more, and give
727
+ the CPU build's iterations and results to the last digits. Measured
728
+ against scikit-learn: 10-22x for the L-BFGS fits, 6.7x FastICA, 3x the
729
+ mixture and LogisticRegressionCV (the repository README's table).
730
+ `SCM2CPP_NO_DEVICE=1` keeps everything on the CPU.
731
+
718
732
  ## Logistic regression with L1
719
733
 
720
734
  `CovLogistic` solves L1-penalized logistic regression by
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "scm2cpp-lasso"
7
- version = "0.12.0"
8
- description = "scikit-learn estimators (lasso, elastic net, ridge, ARD, SVM, SVR, logistic regression, GLMs, Huber, Theil-Sen, F-score selection, RFE, NMF, Gaussian mixture, FastICA, PCA, graphical lasso, RANSAC, SGD, OMP, LARS) translated from Scheme to C++ by scm2cpp; GPU batch solver included"
7
+ version = "0.13.0"
8
+ description = "scikit-learn estimators (lasso, elastic net, ridge, ARD, SVM, SVR, logistic regression, GLMs, Huber, Theil-Sen, F-score selection, RFE, NMF, Gaussian mixture, FastICA, PCA, graphical lasso, RANSAC, SGD, OMP, LARS) translated from Scheme to C++ by scm2cpp; GPU batch solver and CUDA kernels included"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
11
11
  license = {text = "MIT"}
@@ -31,4 +31,4 @@ package-dir = {"" = "src"}
31
31
  where = ["src"]
32
32
 
33
33
  [tool.setuptools.package-data]
34
- scm2cpp_lasso = ["_generated/*.hpp", "_generated/*.cpp", "_generated/derived_*/*.hpp", "_generated/derived_*/*.cpp", "_generated/nmf_*/*.hpp", "_generated/nmf_*/*.cpp", "_generated/gramops_*/*.hpp", "_generated/gramops_*/*.cpp", "_generated/accel_*/*.hpp", "_generated/accel_*/*.cpp", "*.cu"]
34
+ scm2cpp_lasso = ["_generated/*.hpp", "_generated/*.cpp", "_generated/derived_*/*.hpp", "_generated/derived_*/*.cpp", "_generated/nmf_*/*.hpp", "_generated/nmf_*/*.cpp", "_generated/gramops_*/*.hpp", "_generated/gramops_*/*.cpp", "_generated/accel_*/*.hpp", "_generated/accel_*/*.cpp", "_generated/gpu_*/*.hpp", "_generated/gpu_*/*.cpp", "*.cu"]
@@ -120,6 +120,28 @@ class BuildWithCuda(build_ext):
120
120
  except (subprocess.CalledProcessError, OSError) as exc:
121
121
  print(f"scm2cpp_lasso: no CUDA batch path ({exc}); "
122
122
  "the CPU solver is unaffected", file=sys.stderr)
123
+ # the --cuda translation (kernels + device-resident cuBLAS):
124
+ # FastICA, the mixture, the L-BFGS fits
125
+ gpu = GEN / "gpu_cuda" / "gpu_capi.cpp"
126
+ if gpu.exists():
127
+ out2 = Path(self.build_lib) / "scm2cpp_lasso" / "libscm2cpp_gpu.so"
128
+ # the installed device's architecture when one answers
129
+ arch = []
130
+ try:
131
+ if subprocess.run(["nvidia-smi"], capture_output=True).returncode == 0:
132
+ arch = ["-arch=native"]
133
+ except OSError:
134
+ pass
135
+ cmd2 = [nvcc, "-O3", "-std=c++17", "-shared", "-x", "cu", *arch,
136
+ "-Xcompiler", "-fPIC", "-I", str(GEN / "gpu_cuda"), "-I", str(GEN),
137
+ str(gpu), "-o", str(out2), "-lcublas",
138
+ "-Wno-deprecated-gpu-targets", "-diag-suppress", "174,177,550"]
139
+ try:
140
+ subprocess.run(cmd2, check=True)
141
+ print("scm2cpp_lasso: built the --cuda estimators")
142
+ except (subprocess.CalledProcessError, OSError) as exc:
143
+ print(f"scm2cpp_lasso: no --cuda estimators ({exc}); "
144
+ "the CPU paths are unaffected", file=sys.stderr)
123
145
 
124
146
 
125
147
  # The cuBLAS variant of the derived kernel: host C++ against the CUDA
@@ -51,7 +51,7 @@ __all__ = ["CovLasso", "CovRidge", "CovBayesianRidge", "CovLogistic", "CovGroupL
51
51
  "SelectPercentile", "GramRFE",
52
52
  "CovMultiTaskLasso", "CovMultiTaskLassoCV", "DerivedLasso",
53
53
  "cuda_available", "derived_backend", "kernel"]
54
- __version__ = "0.12.0"
54
+ __version__ = "0.13.0"
55
55
 
56
56
  _BATCH = load_batch_lib()
57
57
  _DP = ctypes.POINTER(ctypes.c_double)
@@ -1350,7 +1350,7 @@ class LBFGSLogisticRegression:
1350
1350
  k = nc if multi else 1
1351
1351
  coef = np.zeros(k * (p + 1))
1352
1352
  out = np.zeros(2)
1353
- it = _gramops_kernels().logistic_lbfgs(
1353
+ it = _gpu_or_cpu(n * p, getattr(self, "backend", None)).logistic_lbfgs(
1354
1354
  X, yi.astype(np.float64), coef, out, float(self.C), int(self.max_iter),
1355
1355
  float(self.tol), multi, 1 if self.fit_intercept else 0, n, p, k)
1356
1356
  self.coef_ = coef[:k * p].reshape(k, p).copy()
@@ -1418,7 +1418,7 @@ class _LBFGSGLM:
1418
1418
  coef = np.zeros(p + 1)
1419
1419
  out = np.zeros(2)
1420
1420
  fam, power = self._family_power()
1421
- it = _gramops_kernels().glm(X, y, coef, out, fam, float(power), float(self.alpha),
1421
+ it = _gpu_or_cpu(n * p, getattr(self, "backend", None)).glm(X, y, coef, out, fam, float(power), float(self.alpha),
1422
1422
  int(self.max_iter), float(self.tol),
1423
1423
  1 if self.fit_intercept else 0, n, p)
1424
1424
  self.coef_, self.intercept_ = coef[:p].copy(), float(coef[p])
@@ -1499,7 +1499,7 @@ class LBFGSLogisticRegressionCV:
1499
1499
 
1500
1500
  def _path(self, X, yi, Cs, coef, multi, k):
1501
1501
  n, p = X.shape
1502
- lib = _gramops_kernels()
1502
+ lib = _gpu_or_cpu(n * p, getattr(self, "backend", None))
1503
1503
  coefs, iters = [], []
1504
1504
  out = np.zeros(2)
1505
1505
  for C in Cs:
@@ -1582,7 +1582,7 @@ class LBFGSHuberRegressor:
1582
1582
  coef = np.zeros(p + 2)
1583
1583
  coef[-1] = 1.0
1584
1584
  out = np.zeros(2)
1585
- it = _gramops_kernels().huber(
1585
+ it = _gpu_or_cpu(n * p, getattr(self, "backend", None)).huber(
1586
1586
  X, y, coef, out, float(self.epsilon), float(self.alpha), int(self.max_iter),
1587
1587
  float(self.tol), 1 if self.fit_intercept else 0, n, p)
1588
1588
  self.coef_ = coef[:p].copy()
@@ -1643,7 +1643,7 @@ class EMGaussianMixture:
1643
1643
  self.precisions_cholesky_ = np.zeros((k, p, p))
1644
1644
  labels = np.zeros(n)
1645
1645
  out = np.zeros(2)
1646
- it = _gramops_kernels().gmm(X, resp, self.weights_, self.means_,
1646
+ it = _gpu_or_cpu(n * p, getattr(self, "backend", None)).gmm(X, resp, self.weights_, self.means_,
1647
1647
  self.precisions_cholesky_, labels, out,
1648
1648
  int(self.max_iter), float(self.tol),
1649
1649
  float(self.reg_covar), n, p, k)
@@ -1744,7 +1744,7 @@ class ParallelFastICA:
1744
1744
  w0 = np.ascontiguousarray(w0)
1745
1745
  self.components_ = np.zeros((k, p)); self.whitening_ = np.zeros((k, p))
1746
1746
  self._unmixing = np.zeros((k, k)); self.mean_ = np.zeros(p)
1747
- self.n_iter_ = _gramops_kernels().fastica(
1747
+ self.n_iter_ = _gpu_or_cpu(n * p, getattr(self, "backend", None)).fastica(
1748
1748
  X, w0, self.components_, self.whitening_, self._unmixing, self.mean_,
1749
1749
  int(self.max_iter), float(self.tol), n, p, k)
1750
1750
  self.mixing_ = np.linalg.pinv(self.components_)
@@ -1803,6 +1803,19 @@ class CovARDRegression:
1803
1803
  return np.ascontiguousarray(X, dtype=np.float64) @ self.coef_ + self.intercept_
1804
1804
 
1805
1805
 
1806
+ def _gpu_or_cpu(size, backend=None):
1807
+ """The --cuda translation (kernels and device-resident cuBLAS) when it
1808
+ was built, a device answers, the backend allows it and the problem has
1809
+ at least a million entries; the CPU library otherwise."""
1810
+ import os
1811
+ from ._libfind import gpu_built
1812
+ if (backend in (None, "cuda") and size >= 1e6 and not os.environ.get("SCM2CPP_NO_DEVICE")
1813
+ and gpu_built() and cuda_available()):
1814
+ import importlib
1815
+ return importlib.import_module(f"{__name__}._generated._loader_gpu_cuda")
1816
+ return _gramops_kernels()
1817
+
1818
+
1806
1819
  def _accel(work):
1807
1820
  """The --cublas build of the selection and Gram products, when it was
1808
1821
  built, a device answers, and WORK (flops) is large enough to pay for
@@ -0,0 +1,294 @@
1
+ # ctypes loader for libgpu.so, generated alongside it.
2
+ # Arrays are numpy arrays of the declared dtype; they are made
3
+ # contiguous on the way in and mutated in place where the translated
4
+ # function mutates them.
5
+ import ctypes
6
+ import numpy as np
7
+ from pathlib import Path
8
+
9
+ from .._libfind import load_gpu_lib as _load_gpu_lib
10
+
11
+ _lib = _load_gpu_lib()
12
+
13
+ _lib.scm2cpp_eig_hypot.restype = ctypes.c_double
14
+ _lib.scm2cpp_eig_hypot.argtypes = [ctypes.c_double, ctypes.c_double]
15
+ def eig_hypot(a, b):
16
+ return _lib.scm2cpp_eig_hypot(a, b)
17
+
18
+ _lib.scm2cpp_sym_eigen.restype = ctypes.c_int
19
+ _lib.scm2cpp_sym_eigen.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
20
+ def sym_eigen(a, v, ev, e, m):
21
+ a = np.ascontiguousarray(a, dtype=np.float64)
22
+ v = np.ascontiguousarray(v, dtype=np.float64)
23
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
24
+ e = np.ascontiguousarray(e, dtype=np.float64)
25
+ return _lib.scm2cpp_sym_eigen(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.size, v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.size, ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.size, e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.size, m)
26
+
27
+ _lib.scm2cpp_eig_abs.restype = ctypes.c_double
28
+ _lib.scm2cpp_eig_abs.argtypes = [ctypes.c_double]
29
+ def eig_abs(a):
30
+ return _lib.scm2cpp_eig_abs(a)
31
+
32
+ _lib.scm2cpp_eig_order.restype = ctypes.c_int
33
+ _lib.scm2cpp_eig_order.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_int), ctypes.c_int, ctypes.c_int]
34
+ def eig_order(ev, ord, m):
35
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
36
+ ord = np.ascontiguousarray(ord, dtype=np.int32)
37
+ return _lib.scm2cpp_eig_order(ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.size, ord.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), ord.size, m)
38
+
39
+ _lib.scm2cpp_ica_tanh.restype = ctypes.c_double
40
+ _lib.scm2cpp_ica_tanh.argtypes = [ctypes.c_double]
41
+ def ica_tanh(x):
42
+ return _lib.scm2cpp_ica_tanh(x)
43
+
44
+ _lib.scm2cpp_ica_sym.restype = ctypes.c_int
45
+ _lib.scm2cpp_ica_sym.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
46
+ def ica_sym(w, a, v, ev, e, t, m):
47
+ w = np.ascontiguousarray(w, dtype=np.float64)
48
+ a = np.ascontiguousarray(a, dtype=np.float64)
49
+ v = np.ascontiguousarray(v, dtype=np.float64)
50
+ ev = np.ascontiguousarray(ev, dtype=np.float64)
51
+ e = np.ascontiguousarray(e, dtype=np.float64)
52
+ t = np.ascontiguousarray(t, dtype=np.float64)
53
+ return _lib.scm2cpp_ica_sym(w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), w.size, a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.size, v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.size, ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.size, e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.size, t.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), t.size, m)
54
+
55
+ _lib.scm2cpp_fastica.restype = ctypes.c_int
56
+ _lib.scm2cpp_fastica.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
57
+ def fastica(x, winit, comps, white, unmix, mean, maxiter, tol, n, p, nc):
58
+ x = np.ascontiguousarray(x, dtype=np.float64)
59
+ winit = np.ascontiguousarray(winit, dtype=np.float64)
60
+ comps = np.ascontiguousarray(comps, dtype=np.float64)
61
+ white = np.ascontiguousarray(white, dtype=np.float64)
62
+ unmix = np.ascontiguousarray(unmix, dtype=np.float64)
63
+ mean = np.ascontiguousarray(mean, dtype=np.float64)
64
+ return _lib.scm2cpp_fastica(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, winit.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), winit.size, comps.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), comps.size, white.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), white.size, unmix.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), unmix.size, mean.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), mean.size, maxiter, tol, n, p, nc)
65
+
66
+ _lib.scm2cpp_gmm_mstep.restype = ctypes.c_int
67
+ _lib.scm2cpp_gmm_mstep.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
68
+ def gmm_mstep(x, resp, weights, means, prec, dw, cov, l, u, reg, norm, n, p, kc):
69
+ x = np.ascontiguousarray(x, dtype=np.float64)
70
+ resp = np.ascontiguousarray(resp, dtype=np.float64)
71
+ weights = np.ascontiguousarray(weights, dtype=np.float64)
72
+ means = np.ascontiguousarray(means, dtype=np.float64)
73
+ prec = np.ascontiguousarray(prec, dtype=np.float64)
74
+ dw = np.ascontiguousarray(dw, dtype=np.float64)
75
+ cov = np.ascontiguousarray(cov, dtype=np.float64)
76
+ l = np.ascontiguousarray(l, dtype=np.float64)
77
+ u = np.ascontiguousarray(u, dtype=np.float64)
78
+ return _lib.scm2cpp_gmm_mstep(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, resp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), resp.size, weights.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), weights.size, means.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), means.size, prec.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), prec.size, dw.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), dw.size, cov.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), cov.size, l.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), l.size, u.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), u.size, reg, norm, n, p, kc)
79
+
80
+ _lib.scm2cpp_gmm_estep.restype = ctypes.c_double
81
+ _lib.scm2cpp_gmm_estep.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
82
+ def gmm_estep(x, resp, weights, means, prec, wlp, y, u, mu, n, p, kc):
83
+ x = np.ascontiguousarray(x, dtype=np.float64)
84
+ resp = np.ascontiguousarray(resp, dtype=np.float64)
85
+ weights = np.ascontiguousarray(weights, dtype=np.float64)
86
+ means = np.ascontiguousarray(means, dtype=np.float64)
87
+ prec = np.ascontiguousarray(prec, dtype=np.float64)
88
+ wlp = np.ascontiguousarray(wlp, dtype=np.float64)
89
+ y = np.ascontiguousarray(y, dtype=np.float64)
90
+ u = np.ascontiguousarray(u, dtype=np.float64)
91
+ mu = np.ascontiguousarray(mu, dtype=np.float64)
92
+ return _lib.scm2cpp_gmm_estep(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, resp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), resp.size, weights.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), weights.size, means.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), means.size, prec.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), prec.size, wlp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), wlp.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, u.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), u.size, mu.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), mu.size, n, p, kc)
93
+
94
+ _lib.scm2cpp_gmm_abs.restype = ctypes.c_double
95
+ _lib.scm2cpp_gmm_abs.argtypes = [ctypes.c_double]
96
+ def gmm_abs(a):
97
+ return _lib.scm2cpp_gmm_abs(a)
98
+
99
+ _lib.scm2cpp_gmm.restype = ctypes.c_int
100
+ _lib.scm2cpp_gmm.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
101
+ def gmm(x, resp, weights, means, prec, labels, out, maxiter, tol, reg, n, p, kc):
102
+ x = np.ascontiguousarray(x, dtype=np.float64)
103
+ resp = np.ascontiguousarray(resp, dtype=np.float64)
104
+ weights = np.ascontiguousarray(weights, dtype=np.float64)
105
+ means = np.ascontiguousarray(means, dtype=np.float64)
106
+ prec = np.ascontiguousarray(prec, dtype=np.float64)
107
+ labels = np.ascontiguousarray(labels, dtype=np.float64)
108
+ out = np.ascontiguousarray(out, dtype=np.float64)
109
+ return _lib.scm2cpp_gmm(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, resp.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), resp.size, weights.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), weights.size, means.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), means.size, prec.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), prec.size, labels.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), labels.size, out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.size, maxiter, tol, reg, n, p, kc)
110
+
111
+ _lib.scm2cpp_logistic_fg.restype = ctypes.c_double
112
+ _lib.scm2cpp_logistic_fg.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
113
+ def logistic_fg(coef, g, x, y, z, l2, multi, fitint, n, p, k):
114
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
115
+ g = np.ascontiguousarray(g, dtype=np.float64)
116
+ x = np.ascontiguousarray(x, dtype=np.float64)
117
+ y = np.ascontiguousarray(y, dtype=np.float64)
118
+ z = np.ascontiguousarray(z, dtype=np.float64)
119
+ return _lib.scm2cpp_logistic_fg(coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.size, g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.size, x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.size, l2, multi, fitint, n, p, k)
120
+
121
+ _lib.scm2cpp_logistic_lbfgs.restype = ctypes.c_int
122
+ _lib.scm2cpp_logistic_lbfgs.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
123
+ def logistic_lbfgs(x, y, coef, out, c, maxiter, tol, multi, fitint, n, p, k):
124
+ x = np.ascontiguousarray(x, dtype=np.float64)
125
+ y = np.ascontiguousarray(y, dtype=np.float64)
126
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
127
+ out = np.ascontiguousarray(out, dtype=np.float64)
128
+ return _lib.scm2cpp_logistic_lbfgs(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.size, out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.size, c, maxiter, tol, multi, fitint, n, p, k)
129
+
130
+ _lib.scm2cpp_huber_fg.restype = ctypes.c_double
131
+ _lib.scm2cpp_huber_fg.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
132
+ def huber_fg(coef, g, x, y, z, epsilon, alpha, fitint, n, p):
133
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
134
+ g = np.ascontiguousarray(g, dtype=np.float64)
135
+ x = np.ascontiguousarray(x, dtype=np.float64)
136
+ y = np.ascontiguousarray(y, dtype=np.float64)
137
+ z = np.ascontiguousarray(z, dtype=np.float64)
138
+ return _lib.scm2cpp_huber_fg(coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.size, g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.size, x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.size, epsilon, alpha, fitint, n, p)
139
+
140
+ _lib.scm2cpp_huber.restype = ctypes.c_int
141
+ _lib.scm2cpp_huber.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
142
+ def huber(x, y, coef, out, epsilon, alpha, maxiter, tol, fitint, n, p):
143
+ x = np.ascontiguousarray(x, dtype=np.float64)
144
+ y = np.ascontiguousarray(y, dtype=np.float64)
145
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
146
+ out = np.ascontiguousarray(out, dtype=np.float64)
147
+ return _lib.scm2cpp_huber(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.size, out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.size, epsilon, alpha, maxiter, tol, fitint, n, p)
148
+
149
+ _lib.scm2cpp_glm_fg.restype = ctypes.c_double
150
+ _lib.scm2cpp_glm_fg.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
151
+ def glm_fg(coef, g, x, y, z, family, power, l2, fitint, n, p):
152
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
153
+ g = np.ascontiguousarray(g, dtype=np.float64)
154
+ x = np.ascontiguousarray(x, dtype=np.float64)
155
+ y = np.ascontiguousarray(y, dtype=np.float64)
156
+ z = np.ascontiguousarray(z, dtype=np.float64)
157
+ return _lib.scm2cpp_glm_fg(coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.size, g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.size, x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, z.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), z.size, family, power, l2, fitint, n, p)
158
+
159
+ _lib.scm2cpp_glm.restype = ctypes.c_int
160
+ _lib.scm2cpp_glm.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
161
+ def glm(x, y, coef, out, family, power, alpha, maxiter, tol, fitint, n, p):
162
+ x = np.ascontiguousarray(x, dtype=np.float64)
163
+ y = np.ascontiguousarray(y, dtype=np.float64)
164
+ coef = np.ascontiguousarray(coef, dtype=np.float64)
165
+ out = np.ascontiguousarray(out, dtype=np.float64)
166
+ return _lib.scm2cpp_glm(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.size, out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.size, family, power, alpha, maxiter, tol, fitint, n, p)
167
+
168
+ _lib.scm2cpp_lb_abs.restype = ctypes.c_double
169
+ _lib.scm2cpp_lb_abs.argtypes = [ctypes.c_double]
170
+ def lb_abs(a):
171
+ return _lib.scm2cpp_lb_abs(a)
172
+
173
+ _lib.scm2cpp_lb_max.restype = ctypes.c_double
174
+ _lib.scm2cpp_lb_max.argtypes = [ctypes.c_double, ctypes.c_double]
175
+ def lb_max(a, b):
176
+ return _lib.scm2cpp_lb_max(a, b)
177
+
178
+ _lib.scm2cpp_lb_min.restype = ctypes.c_double
179
+ _lib.scm2cpp_lb_min.argtypes = [ctypes.c_double, ctypes.c_double]
180
+ def lb_min(a, b):
181
+ return _lib.scm2cpp_lb_min(a, b)
182
+
183
+ _lib.scm2cpp_lb_dcstep.restype = ctypes.c_int
184
+ _lib.scm2cpp_lb_dcstep.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double]
185
+ def lb_dcstep(cs, fp, dp, stpmin, stpmax):
186
+ cs = np.ascontiguousarray(cs, dtype=np.float64)
187
+ assert cs.size == 8, "cs: expected 8 elements"
188
+ return _lib.scm2cpp_lb_dcstep(cs.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), fp, dp, stpmin, stpmax)
189
+
190
+ _lib.scm2cpp_lb_search_start.restype = ctypes.c_int
191
+ _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]
192
+ def lb_search_start(ls, f, g, stp, stpmin, stpmax, ftol):
193
+ ls = np.ascontiguousarray(ls, dtype=np.float64)
194
+ assert ls.size == 16, "ls: expected 16 elements"
195
+ return _lib.scm2cpp_lb_search_start(ls.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), f, g, stp, stpmin, stpmax, ftol)
196
+
197
+ _lib.scm2cpp_lb_search_step.restype = ctypes.c_int
198
+ _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]
199
+ def lb_search_step(ls, cs, f, g, ftol, gtol, xtol, stpmin, stpmax):
200
+ ls = np.ascontiguousarray(ls, dtype=np.float64)
201
+ assert ls.size == 16, "ls: expected 16 elements"
202
+ cs = np.ascontiguousarray(cs, dtype=np.float64)
203
+ assert cs.size == 8, "cs: expected 8 elements"
204
+ 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)
205
+
206
+ _lib.scm2cpp_lb_dot.restype = ctypes.c_double
207
+ _lib.scm2cpp_lb_dot.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
208
+ def lb_dot(a, b, nv):
209
+ a = np.ascontiguousarray(a, dtype=np.float64)
210
+ b = np.ascontiguousarray(b, dtype=np.float64)
211
+ return _lib.scm2cpp_lb_dot(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.size, b.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), b.size, nv)
212
+
213
+ _lib.scm2cpp_lb_dot_row.restype = ctypes.c_double
214
+ _lib.scm2cpp_lb_dot_row.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int]
215
+ def lb_dot_row(mem, slot, v, nv):
216
+ mem = np.ascontiguousarray(mem, dtype=np.float64)
217
+ v = np.ascontiguousarray(v, dtype=np.float64)
218
+ return _lib.scm2cpp_lb_dot_row(mem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), mem.size, slot, v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.size, nv)
219
+
220
+ _lib.scm2cpp_lb_dot_rows.restype = ctypes.c_double
221
+ _lib.scm2cpp_lb_dot_rows.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int]
222
+ def lb_dot_rows(a, ra, b, rb, nv):
223
+ a = np.ascontiguousarray(a, dtype=np.float64)
224
+ b = np.ascontiguousarray(b, dtype=np.float64)
225
+ return _lib.scm2cpp_lb_dot_rows(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.size, ra, b.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), b.size, rb, nv)
226
+
227
+ _lib.scm2cpp_lb_projgr.restype = ctypes.c_double
228
+ _lib.scm2cpp_lb_projgr.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int]
229
+ def lb_projgr(g, w, ib, lbv, nv):
230
+ g = np.ascontiguousarray(g, dtype=np.float64)
231
+ w = np.ascontiguousarray(w, dtype=np.float64)
232
+ return _lib.scm2cpp_lb_projgr(g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.size, w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), w.size, ib, lbv, nv)
233
+
234
+ _lib.scm2cpp_lb_hv.restype = ctypes.c_int
235
+ _lib.scm2cpp_lb_hv.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
236
+ def lb_hv(q, smem, ymem, rho, al, theta, col, head, m, nv):
237
+ q = np.ascontiguousarray(q, dtype=np.float64)
238
+ smem = np.ascontiguousarray(smem, dtype=np.float64)
239
+ ymem = np.ascontiguousarray(ymem, dtype=np.float64)
240
+ rho = np.ascontiguousarray(rho, dtype=np.float64)
241
+ al = np.ascontiguousarray(al, dtype=np.float64)
242
+ return _lib.scm2cpp_lb_hv(q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), q.size, smem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), smem.size, ymem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ymem.size, rho.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rho.size, al.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), al.size, theta, col, head, m, nv)
243
+
244
+ _lib.scm2cpp_lb_vbv.restype = ctypes.c_double
245
+ _lib.scm2cpp_lb_vbv.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
246
+ def lb_vbv(v, smem, ymem, rho, bm, sb, theta, col, head, m, nv):
247
+ v = np.ascontiguousarray(v, dtype=np.float64)
248
+ smem = np.ascontiguousarray(smem, dtype=np.float64)
249
+ ymem = np.ascontiguousarray(ymem, dtype=np.float64)
250
+ rho = np.ascontiguousarray(rho, dtype=np.float64)
251
+ bm = np.ascontiguousarray(bm, dtype=np.float64)
252
+ sb = np.ascontiguousarray(sb, dtype=np.float64)
253
+ return _lib.scm2cpp_lb_vbv(v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.size, smem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), smem.size, ymem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ymem.size, rho.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rho.size, bm.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), bm.size, sb.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sb.size, theta, col, head, m, nv)
254
+
255
+ _lib.scm2cpp_lb_direction.restype = ctypes.c_int
256
+ _lib.scm2cpp_lb_direction.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int]
257
+ def lb_direction(w, g, d, q, e, smem, ymem, rho, al, bm, sb, theta, col, head, m, ib, lbv, nv):
258
+ w = np.ascontiguousarray(w, dtype=np.float64)
259
+ g = np.ascontiguousarray(g, dtype=np.float64)
260
+ d = np.ascontiguousarray(d, dtype=np.float64)
261
+ q = np.ascontiguousarray(q, dtype=np.float64)
262
+ e = np.ascontiguousarray(e, dtype=np.float64)
263
+ smem = np.ascontiguousarray(smem, dtype=np.float64)
264
+ ymem = np.ascontiguousarray(ymem, dtype=np.float64)
265
+ rho = np.ascontiguousarray(rho, dtype=np.float64)
266
+ al = np.ascontiguousarray(al, dtype=np.float64)
267
+ bm = np.ascontiguousarray(bm, dtype=np.float64)
268
+ sb = np.ascontiguousarray(sb, dtype=np.float64)
269
+ return _lib.scm2cpp_lb_direction(w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), w.size, g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.size, d.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), d.size, q.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), q.size, e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.size, smem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), smem.size, ymem.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ymem.size, rho.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), rho.size, al.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), al.size, bm.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), bm.size, sb.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sb.size, theta, col, head, m, ib, lbv, nv)
270
+
271
+ _lib.scm2cpp_lbfgs.restype = ctypes.c_int
272
+ _lib.scm2cpp_lbfgs.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
273
+ def lbfgs(kind, w, x, y, aux, work, out, m, maxiter, pgtol, ftol, maxls, ib, lbv, nv, n, p, k):
274
+ w = np.ascontiguousarray(w, dtype=np.float64)
275
+ x = np.ascontiguousarray(x, dtype=np.float64)
276
+ y = np.ascontiguousarray(y, dtype=np.float64)
277
+ aux = np.ascontiguousarray(aux, dtype=np.float64)
278
+ assert aux.size == 4, "aux: expected 4 elements"
279
+ work = np.ascontiguousarray(work, dtype=np.float64)
280
+ out = np.ascontiguousarray(out, dtype=np.float64)
281
+ return _lib.scm2cpp_lbfgs(kind, w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), w.size, x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, aux.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), work.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), work.size, out.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), out.size, m, maxiter, pgtol, ftol, maxls, ib, lbv, nv, n, p, k)
282
+
283
+ _lib.scm2cpp_lbfgs_fg.restype = ctypes.c_double
284
+ _lib.scm2cpp_lbfgs_fg.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
285
+ def lbfgs_fg(kind, w, g, x, y, aux, work, n, p, k):
286
+ w = np.ascontiguousarray(w, dtype=np.float64)
287
+ g = np.ascontiguousarray(g, dtype=np.float64)
288
+ x = np.ascontiguousarray(x, dtype=np.float64)
289
+ y = np.ascontiguousarray(y, dtype=np.float64)
290
+ aux = np.ascontiguousarray(aux, dtype=np.float64)
291
+ assert aux.size == 4, "aux: expected 4 elements"
292
+ work = np.ascontiguousarray(work, dtype=np.float64)
293
+ return _lib.scm2cpp_lbfgs_fg(kind, w.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), w.size, g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.size, x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), x.size, y.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), y.size, aux.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), work.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), work.size, n, p, k)
294
+
@@ -377,10 +377,8 @@ def ard_pinvh(a, s, v, ev, e, k):
377
377
  return _lib.scm2cpp_ard_pinvh(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), s.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), k)
378
378
 
379
379
  _lib.scm2cpp_ard_sigma_coef.restype = ctypes.c_int
380
- _lib.scm2cpp_ard_sigma_coef.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), 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.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
381
- def ard_sigma_coef(x, g, xy, idx, lam, coef, sigma, a, v, ev, e, xk, gk, alpha, hoist, n, p, k):
382
- x = np.ascontiguousarray(x, dtype=np.float64)
383
- g = np.ascontiguousarray(g, dtype=np.float64)
380
+ _lib.scm2cpp_ard_sigma_coef.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int]
381
+ def ard_sigma_coef(xy, idx, lam, coef, sigma, a, v, ev, e, gk, alpha, k):
384
382
  xy = np.ascontiguousarray(xy, dtype=np.float64)
385
383
  idx = np.ascontiguousarray(idx, dtype=np.int32)
386
384
  lam = np.ascontiguousarray(lam, dtype=np.float64)
@@ -390,9 +388,8 @@ def ard_sigma_coef(x, g, xy, idx, lam, coef, sigma, a, v, ev, e, xk, gk, alpha,
390
388
  v = np.ascontiguousarray(v, dtype=np.float64)
391
389
  ev = np.ascontiguousarray(ev, dtype=np.float64)
392
390
  e = np.ascontiguousarray(e, dtype=np.float64)
393
- xk = np.ascontiguousarray(xk, dtype=np.float64)
394
391
  gk = np.ascontiguousarray(gk, dtype=np.float64)
395
- return _lib.scm2cpp_ard_sigma_coef(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 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)), xk.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), gk.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alpha, hoist, n, p, k)
392
+ return _lib.scm2cpp_ard_sigma_coef(xy.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), idx.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), lam.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sigma.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), gk.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alpha, k)
396
393
 
397
394
  _lib.scm2cpp_ard.restype = ctypes.c_int
398
395
  _lib.scm2cpp_ard.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]
@@ -377,10 +377,8 @@ def ard_pinvh(a, s, v, ev, e, k):
377
377
  return _lib.scm2cpp_ard_pinvh(a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), s.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), k)
378
378
 
379
379
  _lib.scm2cpp_ard_sigma_coef.restype = ctypes.c_int
380
- _lib.scm2cpp_ard_sigma_coef.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), 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.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_int]
381
- def ard_sigma_coef(x, g, xy, idx, lam, coef, sigma, a, v, ev, e, xk, gk, alpha, hoist, n, p, k):
382
- x = np.ascontiguousarray(x, dtype=np.float64)
383
- g = np.ascontiguousarray(g, dtype=np.float64)
380
+ _lib.scm2cpp_ard_sigma_coef.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_double, ctypes.c_int]
381
+ def ard_sigma_coef(xy, idx, lam, coef, sigma, a, v, ev, e, gk, alpha, k):
384
382
  xy = np.ascontiguousarray(xy, dtype=np.float64)
385
383
  idx = np.ascontiguousarray(idx, dtype=np.int32)
386
384
  lam = np.ascontiguousarray(lam, dtype=np.float64)
@@ -390,9 +388,8 @@ def ard_sigma_coef(x, g, xy, idx, lam, coef, sigma, a, v, ev, e, xk, gk, alpha,
390
388
  v = np.ascontiguousarray(v, dtype=np.float64)
391
389
  ev = np.ascontiguousarray(ev, dtype=np.float64)
392
390
  e = np.ascontiguousarray(e, dtype=np.float64)
393
- xk = np.ascontiguousarray(xk, dtype=np.float64)
394
391
  gk = np.ascontiguousarray(gk, dtype=np.float64)
395
- return _lib.scm2cpp_ard_sigma_coef(x.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), g.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), 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)), xk.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), gk.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alpha, hoist, n, p, k)
392
+ return _lib.scm2cpp_ard_sigma_coef(xy.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), idx.ctypes.data_as(ctypes.POINTER(ctypes.c_int)), lam.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), coef.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), sigma.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), a.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), v.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), ev.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), e.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), gk.ctypes.data_as(ctypes.POINTER(ctypes.c_double)), alpha, k)
396
393
 
397
394
  _lib.scm2cpp_ard.restype = ctypes.c_int
398
395
  _lib.scm2cpp_ard.argtypes = [ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.POINTER(ctypes.c_double), ctypes.c_int, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_int]