multipers.torch package

Submodules

multipers.torch.diff_grids module

multipers.torch.diff_grids._exact_grid(filtration_values, r=None)
multipers.torch.diff_grids._quantile_grid(filtration_values, r)
Parameters:

r (int)

multipers.torch.diff_grids._regular_closest(f, r, unique=True)
Parameters:
  • r (int)

  • unique (bool)

multipers.torch.diff_grids._regular_closest_grid(filtration_values, r)
Parameters:

r (int)

multipers.torch.diff_grids._regular_left(f, r, unique=True)
Parameters:
  • r (int)

  • unique (bool)

multipers.torch.diff_grids._regular_left_grid(filtration_values, r)
Parameters:

r (int)

multipers.torch.diff_grids._unique_any(x, assume_sorted=False, remove_inf=True)
Parameters:

remove_inf (bool)

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)

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.

Parameters:

strategy (Literal['exact', 'regular_closest', 'regular_left', 'quantile'])

multipers.torch.diff_grids.todense(grid)
Parameters:

grid (list[Tensor])

multipers.torch.rips_density module

multipers.torch.rips_density.function_rips_signed_measure(x, theta=None, function='gaussian', threshold=None, grid_strategy='exact', complex='rips', resolution=100, safe_conversion=False, num_collapses=None, expand_collapse=False, dtype=torch.float32, plot=False, *, log_density=True, vineyard=False, pers_backend=None, **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.

Parameters:
  • theta (float | None)

  • function (Literal['dtm', 'gaussian', 'exponential'] | ~typing.Callable)

  • threshold (float | None)

  • grid_strategy (Literal['regular_closest', 'exact', 'quantile', 'regular_left'])

  • complex (Literal['rips', 'delaunay', 'weak_delaunay'])

  • resolution (int)

  • safe_conversion (bool)

  • num_collapses (int | None)

  • expand_collapse (bool)

  • log_density (bool)

  • vineyard (bool)

multipers.torch.rips_density.function_rips_signed_measure_old(x, theta=None, function='dtm', threshold=inf, grid_strategy='regular_closest', resolution=100, return_original=False, return_st=False, safe_conversion=False, num_collapses=-1, expand_collapse=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.

Parameters:
  • theta (float | None)

  • function (Literal['dtm', 'gaussian', 'exponential'] | ~typing.Callable)

  • threshold (float)

  • grid_strategy (Literal['regular', 'regular_closest', 'regular_left', 'partition', 'quantile', 'precomputed'])

  • resolution (int)

  • return_original (bool)

  • return_st (bool)

  • safe_conversion (bool)

  • num_collapses (int)

  • expand_collapse (bool)

Module contents