Skip to content

Commit

Permalink
MAINT: Return more info in W1 computations
Browse files Browse the repository at this point in the history
  • Loading branch information
jwboth committed Jan 12, 2025
1 parent 98b8797 commit c257c92
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/darsia/measure/wasserstein.py
Original file line number Diff line number Diff line change
Expand Up @@ -2072,8 +2072,14 @@ def _solve(self, flat_mass_diff: np.ndarray) -> tuple[float, np.ndarray, dict]:
total_timings = self._analyze_timings(convergence_history["timing"])
peak_memory_consumption = tracemalloc.get_traced_memory()[1] / 10**9

# Compute l1 norm of the flux
unweighted_transport_density = self.transport_density(flux, weighted=False)
flux_l1_norm = self.mass_matrix_cells.dot(unweighted_transport_density).sum()

# Define performance metric
info = {
"distance": new_distance, # includes weight
"flux_l1_norm": flux_l1_norm, # without weight
"converged": iter < num_iter - 1,
"number_iterations": iter,
"convergence_history": convergence_history,
Expand Down

0 comments on commit c257c92

Please sign in to comment.