tuned pipeline to 60 fps
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user