tuned pipeline to 60 fps

This commit is contained in:
ykcheungab
2026-06-14 20:58:46 +08:00
parent 30bebcd439
commit fbee1c37ed
12 changed files with 339 additions and 37 deletions
+15
View File
@@ -19,3 +19,18 @@ class MaskedSparseSolver:
sol_active = domain.factor(rhs) # (N,) reduced-system potential
return domain.scatter(sol_active, f)
def solve_pair(self, f0, f1, domain: MaskedDomain):
"""Solve two masked Poisson RHS with one reused sparse factorization call."""
rhs_pair = domain.prepare_rhs_pair(f0, f1)
if rhs_pair.shape[0] == 0:
empty = numpy.zeros_like(f0, dtype=numpy.float32)
return empty, empty.copy()
try:
sol_pair = domain.factor(rhs_pair) # (N, 2) reduced-system potentials
except Exception:
sol_pair = numpy.column_stack(
[domain.factor(rhs_pair[:, 0]), domain.factor(rhs_pair[:, 1])]
)
return domain.scatter_pair(sol_pair, f0)