squarenet 0.2.2__tar.gz → 0.2.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: squarenet
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Sparse local operations for point clouds in any dimension.
5
5
  Author-email: ArmanddeCacqueray <armanddecacqueray@sfr.fr>
6
6
  Project-URL: Homepage, https://github.com/ArmanddeCacqueray/SquareNet
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "squarenet"
7
- version = "0.2.2"
7
+ version = "0.2.4"
8
8
  description = "Sparse local operations for point clouds in any dimension."
9
9
  authors = [{ name = "ArmanddeCacqueray", email = "armanddecacqueray@sfr.fr" }]
10
10
  readme = "README.md"
@@ -2,7 +2,7 @@ import numpy as np
2
2
  from .core import sort_increasing, carthesian_heuristics
3
3
  from .boards import checkerboard, checkerboard2D, checkerboard3D
4
4
  from .views import localview, lazylocalview
5
- from .utils import initpoint, dualgrid
5
+ from .utils import initpoint, dualgrid, dualgridflat
6
6
  from warnings import warn
7
7
 
8
8
  class SquareNet:
@@ -37,6 +37,7 @@ class SquareNet:
37
37
  self.N, dtype = np.int32
38
38
  ).reshape(IJ_) #grid to sort heuritics
39
39
  self.invert_grid = dualgrid(self.grid) #for invertibility
40
+ self.invgridflat = dualgridflat(self.grid) #flat version
40
41
  self.packed = False #Flag for faster computations if possible
41
42
 
42
43
  def fit(self, points):
@@ -84,6 +85,7 @@ class SquareNet:
84
85
  # Save results
85
86
  self.grid = grid
86
87
  self.invert_grid = dualgrid(grid)
88
+ self.invgridflat = dualgridflat(grid)
87
89
  self.learning_curve = learning_curve
88
90
 
89
91
  def map(self, features):
@@ -102,7 +104,7 @@ class SquareNet:
102
104
  if not self.packed:
103
105
  return features.reshape(
104
106
  -1, *features.shape[self.D:]
105
- )[self.invert_grid.flatten()]
107
+ )[self.invgridflat]
106
108
 
107
109
  C = features.shape[self.D:]
108
110
  return features.reshape(-1, *C)
@@ -16,6 +16,16 @@ def dualgrid(grid):
16
16
  dual_grid = np.ascontiguousarray(dual_grid)
17
17
  return dual_grid
18
18
 
19
+ def dualgridflat(grid):
20
+ gr= grid.flatten()
21
+ N = len(grid)
22
+ dgf = np.zeros(N, dtype = np.int32)
23
+ identity = np.arange(N, dtype = np.int32)
24
+ dgf[gr] = identity
25
+ dgf = np.ascontiguousarray(dgf)
26
+ return dgf
27
+
28
+
19
29
  def ball(n, d):
20
30
  points = np.random.randn(n, d)
21
31
  radius = np.random.uniform(0, 1, size=n)**(1/d)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: squarenet
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Sparse local operations for point clouds in any dimension.
5
5
  Author-email: ArmanddeCacqueray <armanddecacqueray@sfr.fr>
6
6
  Project-URL: Homepage, https://github.com/ArmanddeCacqueray/SquareNet
File without changes
File without changes
File without changes