You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4b44e56
Browse filesBrowse the repository at this point in the historyBrowse files
Complete the drop-in API for neighbor-aware losses; numpy fast paths in the PyO3 layer (#7)
* feat: complete the drop-in surface for adaptive's neighbor-aware losses
LearnerND with a neighbor-aware loss (triangle_loss / curvature_loss,
nth_neighbors >= 1) calls five Triangulation methods that were missing,
plus two behaviors only that path exercises. Add them:
- get_vertex, get_neighbors_from_vertices,
get_simplices_attached_to_points, get_opposing_vertices,
get_face_sharing_neighbors - same semantics and exception types as
the reference; get_opposing_vertices and
get_simplices_attached_to_points are answered natively from the
facet/vertex indexes instead of the reference's set scans
- get_vertices passes None entries through as None (adaptive feeds the
result of get_opposing_vertices, which contains None on the hull,
straight back in)
- SimplicesProxy supports the binary set operators in both operand
orders (adaptive computes `... - tri.simplices`), delegating to a
snapshot set
Pinned by cross-validation tests against the reference on random 2D/3D
triangulations, exception-type parity for unknown simplices, and an
end-to-end LearnerND run with curvature_loss_function() driving 100
points through the previously uncovered code path.
* perf: numpy fast paths in the PyO3 layer
- parse_point / parse_points bulk-copy f64 numpy arrays instead of
iterating them as Python objects (other dtypes and nested sequences
keep the generic path)
- VerticesProxy.__array__ builds a PyArray2 directly instead of
round-tripping through a list of Python tuples and numpy.array;
dtype is honored via astype, and copy needs no handling because the
snapshot is always freshly allocated
Output types are unchanged everywhere (tuples/lists/sets), so the
drop-in contract is untouched; all 112 tests pass. A/B microbenchmark
vs main (best of 5): np.asarray(tri.vertices) snapshots 50x faster
(0.189s -> 0.004s per 2000 calls on a 500-vertex mesh), constructor
from a numpy array ~14% faster, add_point unchanged.
* style: avoid camelcase-as-lowercase import alias in LearnerND test (ruff N813)
0 commit comments