multipers.torch package

Submodules

multipers.torch.diff_grids module

multipers.torch.diff_grids.evaluate_in_grid(pts, grid)

Evaluates points (assumed to be coordinates) in this grid. Input —–

  • pts: (num_points, num_parameters) array

  • grid: Iterable of 1-d array, for each parameter

Returns

  • array of shape like points of dtype like grid.

multipers.torch.diff_grids.evaluate_mod_in_grid(mod, grid, box=None)

Given an MMA module, pushes it into the specified grid. Useful for e.g., make it differentiable.

Input

  • mod: PyModule

  • grid: Iterable of 1d array, for num_parameters

Ouput

torch-compatible module in the format: (num_degrees) x (num_interval of degree) x ((num_birth, num_parameter), (num_death, num_parameters))

multipers.torch.diff_grids.evaluate_mod_in_grid__old(mod, grid, box=None)

Given an MMA module, pushes it into the specified grid. Useful for e.g., make it differentiable.

Input

  • mod: PyModule

  • grid: Iterable of 1d array, for num_parameters

Ouput

torch-compatible module in the format: (num_degrees) x (num_interval of degree) x ((num_birth, num_parameter), (num_death, num_parameters))

multipers.torch.diff_grids.get_grid(strategy: Literal['exact', 'regular_closest', 'regular_left', 'quantile'])

Given a strategy, returns a function of signature (num_pts, num_parameter), int –> Iterable[1d array] that generates a torch-differentiable grid from a set of points, and a resolution.

multipers.torch.diff_grids.todense(grid: list[Tensor])

multipers.torch.rips_density module

multipers.torch.rips_density.function_rips_signed_measure(x, theta: float | None = None, function: Literal['dtm', 'gaussian', 'exponential'] | Callable = 'gaussian', threshold: float | None = None, grid_strategy: Literal['regular_closest', 'exact', 'quantile', 'regular_left'] = 'exact', complex: Literal['rips', 'delaunay'] = 'rips', resolution: int = 100, safe_conversion: bool = False, num_collapses: int | None = None, expand_collapse: bool = False, dtype=torch.float32, plot=False, *, log_density: bool = True, vineyard: bool = False, **sm_kwargs)

Computes a torch-differentiable function-rips signed measure.

Input

  • x (num_pts, dim) : The point cloud

  • theta: For density-like functions : the bandwidth

  • threshold : rips threshold

  • function : Either “dtm”, “gaussian”, or “exponenetial” or Callable. Function to compute the second parameter.

  • grid_strategy: grid coarsenning strategy.

  • resolution : when coarsenning, the target resolution,

  • return_original : Also returns the non-differentiable signed measure.

  • safe_conversion : Activate this if you encounter crashes.

  • **kwargs : for the signed measure computation.

multipers.torch.rips_density.function_rips_signed_measure_old(x, theta: float | None = None, function: Literal['dtm', 'gaussian', 'exponential'] | Callable = 'dtm', threshold: float = inf, grid_strategy: Literal['regular', 'regular_closest', 'regular_left', 'partition', 'quantile', 'precomputed'] = 'regular_closest', resolution: int = 100, return_original: bool = False, return_st: bool = False, safe_conversion: bool = False, num_collapses: int = -1, expand_collapse: bool = False, dtype=torch.float32, **sm_kwargs)

Computes a torch-differentiable function-rips signed measure.

Input

  • x (num_pts, dim) : The point cloud

  • theta: For density-like functions : the bandwidth

  • threshold : rips threshold

  • function : Either “dtm”, “gaussian”, or “exponenetial” or Callable. Function to compute the second parameter.

  • grid_strategy: grid coarsenning strategy.

  • resolution : when coarsenning, the target resolution,

  • return_original : Also returns the non-differentiable signed measure.

  • safe_conversion : Activate this if you encounter crashes.

  • **kwargs : for the signed measure computation.

Module contents