type

transport.samples.kernels.cg_dense.CachedDenseHVP

class CachedDenseHVP:

Cached HVP context that materializes transport plan once.

This class provides significant speedup when computing multiple HVPs with the same potentials (e.g., during outer Newton CG iterations). The transport plan P is materialized once during __init__, and reused for all subsequent hvp() calls. Performance improvement: ~19x speedup for 19 CG iterations (avoids re-materializing O(n²) transport plan each iteration).

Members

method

  • __init__Initialize cached HVP context.
  • hvpCompute HVP using cached transport plan.

constant

Source: torchmatch/transport/samples/kernels/cg_dense.py:387