Skip to content

vectorize 2-D vfuncs in diffgeo and solver#109

Merged
m-reuter merged 3 commits intomainfrom
vectorize
Mar 3, 2026
Merged

vectorize 2-D vfuncs in diffgeo and solver#109
m-reuter merged 3 commits intomainfrom
vectorize

Conversation

@m-reuter
Copy link
Member

@m-reuter m-reuter commented Mar 3, 2026

Vectorize multi-function diffgeo operations and 2D Poisson solve

lapy/diffgeo.py

  • Vectorized tria_compute_geodesic_f / compute_geodesic_f: gradient and divergence steps now operate on all input functions simultaneously; Poisson solve reduced to a single batched call
  • Vectorized tria_compute_rotated_f / compute_rotated_f: added tn[:, np.newaxis, :] broadcasting in the np.cross rotation step; same batched Poisson solve

lapy/Solver.py

  • Extended Solver.poisson() to accept a 2D right-hand side (n, k) in addition to 1D; 1D input is detected and output is squeezed back to 1D for full backward compatibility
  • dvec and nvec sparse constraint vectors are tiled across all k columns via np.repeat
  • Dirichlet/Neumann padding generalised to handle both 1D and 2D solution arrays

Tests

  • Added vectorization tests into lapy/utils/tests/test_diffgeo.py (tria and tet gradient, divergence, geodesic_f, rotated_f multi-vs-single comparisons)
  • Added Solver.poisson 2D rhs tests into lapy/utils/tests/test_solver.py
  • Fixed test_smooth_laplace spurious DeprecationWarning by wrapping the deprecated smooth_vfunc call with pytest.warns(DeprecationWarning)

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 92.36111% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.88%. Comparing base (83344c5) to head (8ecdfc4).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
lapy/diffgeo.py 95.20% 5 Missing and 1 partial ⚠️
lapy/solver.py 68.75% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #109      +/-   ##
==========================================
+ Coverage   44.41%   47.88%   +3.47%     
==========================================
  Files          15       15              
  Lines        2758     2842      +84     
  Branches      348      359      +11     
==========================================
+ Hits         1225     1361     +136     
+ Misses       1411     1358      -53     
- Partials      122      123       +1     
Flag Coverage Δ
unittests 47.88% <92.36%> (+3.47%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@m-reuter m-reuter merged commit 33aa430 into main Mar 3, 2026
28 checks passed
@m-reuter m-reuter deleted the vectorize branch March 3, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant