multipers package

Subpackages

Submodules

multipers._signed_measure_meta module

multipers._signed_measure_meta._signed_measure_from_scc(minimal_presentation)
Return type:

list[tuple[ndarray, ndarray]]

multipers._signed_measure_meta._signed_measure_from_slicer(slicer, shift=0)
Parameters:
Return type:

list[tuple[ndarray, ndarray]]

multipers._signed_measure_meta.signed_measure(filtered_complex, degree=None, degrees=[], mass_default=None, grid_strategy='exact', invariant=None, plot=False, verbose=False, n_jobs=-1, expand_collapse=False, backend=None, thread_id='', grid=None, coordinate_measure=False, num_collapses=0, clean=None, vineyard=False, grid_conversion=None, **infer_grid_kwargs)

Computes the signed measures given by the decomposition of the hilbert function or the euler characteristic, or the rank invariant.

Input

  • filtered_complex: given by a simplextree or a slicer.

  • degree:int|None / degrees:list[int] the degrees to compute. None represents the euler characteristic.

  • mass_default: Either None, or ‘auto’ or ‘inf’, or array-like of floats. Where to put the default mass to get a zero-mass measure. This corresponds to zero-out the filtered complex outside of ${ xin mathbb R^n mid xle mass_default}$

  • invariant: The invariant to use, either “hilbert”, “rank”, or “euler”.

  • plot:bool, plots the computed measures if true.

  • n_jobs:int, number of jobs. Defaults to #cpu.

  • verbose:bool, prints c++ logs.

  • expand_collapse: when the input is a simplextree, only expands the complex when computing 1-dimensional slices. Meant to reduce memory footprint at some computational expense.

  • backend:str reduces first the filtered complex using an external library backend,

    see backend in multipers.io.reduce_complex().

  • grid: If given, the computations will be done on the restriction of the filtered complex to this grid.

    It can also be used for auto-differentiation, i.e., if the grid is a list of pytorch tensors, then the output measure will be pytorch-differentiable.

  • grid_strategy: If not squeezed yet, and no grid is given, the strategy to coarsen the grid; see strategy in multipers.grids.compute_grid().

  • coordinate_measure: bool, if True, compute the signed measure as a coordinates given in grid.

  • num_collapses: int, if filtered_complex is a simplextree, does some collapses if possible.

  • clean: if True, reduces the measure. It is not necessary in general.

Output

[signed_measure_of_degree for degree in degrees] with signed_measure_of_degree of the form (dirac location, dirac weights).

Notes on computational backends

There are several backends for each of these computations. The backend for computations used can be displayed with verbose=True, use it! Also note that if backend is given, then the input will be converted to a slicer.

  • Euler: is always computed by summing the weights of the simplices

  • Hilbert: is computed by computing persistence on slices, and a Möbius inversion, unless the detected input is a minimal presentation (i.e., filtered_complex.is_minpres), which in that case, doesn’t need any computation. - If the input is a simplextree, this is done via a the standard Gudhi implementation,

    with parallel (TBB) computations of slices.

    • If the input is a slicer then - If the input is vineyard-capable, then slices are computed via vineyards updates.

      It is slower in general, but faster if single threaded. In particular, it is usually faster to use this backend if you want to compute the signed measure of multiple datasets in a parallel context.

      • Otherwise, slices are computed in parallel. It is usually faster to use this backend if not in a parallel context.

  • Rank: Same as Hilbert.

Parameters:
Return type:

list[tuple[ndarray, ndarray]]

multipers._slicer_meta module

multipers._slicer_meta.Slicer(st=None, vineyard=None, reduce=False, reduce_backend=None, dtype=None, is_kcritical=None, column_type=None, backend=None, max_dim=None, return_type_only=False)

Given a simplextree or blocks (a.k.a scc for python), returns a structure that can compute persistence on line (or more) slices, eventually vineyard update, etc.

This can be used to compute interval-decomposable module approximations or signed measures, using, e.g.

  • multipers.module_approximation(this, *args)

  • multipers.signed_measure(this, *args)

Noteit is recommended and sometime required to apply

a minimal presentation before computing these functions !

mp.slicer.minimal_presentation(slicer, *args, **kwargs)

Input

  • st : SimplexTreeMulti or scc-like blocks or path to scc file

  • backend: slicer backend, e.g, “matrix”, “clement”, “graph”

  • vineyard: vineyard capable (may slow down computations if true)

Output

The corresponding slicer.

Parameters:
  • vineyard (bool | None)

  • reduce (bool)

  • reduce_backend (str | None)

  • dtype (int32 | float64 | None)

  • is_kcritical (bool | None)

  • column_type (Literal['INTRUSIVE_SET'] | None)

  • backend (Literal['Matrix', 'GudhiCohomology'] | None)

  • max_dim (int | None)

  • return_type_only (bool)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

multipers._slicer_meta._blocks2boundary_dimension_grades(blocks, filtration_type=<class 'numpy.float64'>, num_parameters=-1, inplace=False, is_kcritical=False)

Turns blocks, aka scc, into the input of non-simplicial slicers.

Parameters:
  • num_parameters (int)

  • inplace (bool)

  • is_kcritical (bool)

multipers._slicer_meta._slicer_from_blocks(blocks, pers_backend, vineyard, is_kcritical, dtype, col)
Parameters:
  • pers_backend (Literal['Matrix', 'GudhiCohomology'])

  • vineyard (bool)

  • is_kcritical (bool)

  • dtype (type)

  • col (Literal['INTRUSIVE_SET'])

multipers._slicer_meta._slicer_from_simplextree(st, backend, vineyard)

multipers.distances module

multipers.distances.estimate_error(st, module, degree, nlines=100, verbose=False)

Given an MMA SimplexTree and PyModule, estimates the bottleneck distance using barcodes given by gudhi.

Parameters

  • st:SimplexTree

    The simplextree representing the n-filtered complex. Used to define the gudhi simplextrees on different lines.

  • module:PyModule

    The module on which to estimate approximation error, w.r.t. the original simplextree st.

  • degree:int

    The homology degree to consider

Returns

  • float:The estimation of the matching distance, i.e., the maximum of the sampled bottleneck distances.

Parameters:
multipers.distances.estimate_matching(b1, b2)
Parameters:
multipers.distances.sm2diff(sm1, sm2)
multipers.distances.sm_distance(sm1, sm2, reg=0, reg_m=0, numItermax=10000, p=1)

Computes the wasserstein distances between two signed measures, of the form

  • (pts,weights)

with
  • pts : (num_pts, dim) float array

  • weights : (num_pts,) int array

Regularisation:
  • sinkhorn if reg != 0

  • sinkhorn unbalanced if reg_m != 0

Parameters:
  • sm1 (tuple)

  • sm2 (tuple)

  • reg (float)

  • reg_m (float)

  • numItermax (int)

  • p (float)

multipers.euler_characteristic module

multipers.function_rips module

File: multipers/function_rips.pyx (starting at line 1)

multipers.function_rips.function_rips_signed_measure(st_multi, homological_degrees: vector[indices_type], mobius_inversion: bool = True, zero_pad: bool = False, n_jobs: int = 0, reconvert: bool = True)

File: multipers/function_rips.pyx (starting at line 78)

multipers.function_rips.function_rips_surface(st_multi, homological_degrees: vector[indices_type], mobius_inversion: bool = True, zero_pad: bool = False, n_jobs: int = 0)

File: multipers/function_rips.pyx (starting at line 59)

multipers.function_rips.get_degree_rips(st, degrees: vector[int], grid_strategy='exact', resolution=0)

File: multipers/function_rips.pyx (starting at line 37)

multipers.grids module

File: multipers/grids.pyx (starting at line 2)

multipers.grids._compute_grid_numpy(signatures, args, kwargs, defaults, _fused_sigindex={})

File: multipers/grids.pyx (starting at line 103)

Computes a grid from filtration values, using some strategy.

Input

  • filtrations_values: Iterable[filtration of parameter for parameter] where filtration_of_parameter is a array[float, ndim=1]

  • resolution:Optional[int|tuple[int]]

  • strategy: either exact, regular, regular_closest, regular_left, partition, quantile, or precomputed.

  • unique: if true, doesn’t repeat values in the output grid.

  • drop_quantiles : drop some filtration values according to these quantiles

Output

Iterable[array[float, ndim=1]] : the 1d-grid for each parameter.

multipers.grids._todo_partition(signatures, args, kwargs, defaults, _fused_sigindex={})

File: multipers/grids.pyx (starting at line 211)

multipers.grids._todo_regular_closest(signatures, args, kwargs, defaults, _fused_sigindex={})

File: multipers/grids.pyx (starting at line 190)

multipers.grids._todo_regular_left(signatures, args, kwargs, defaults, _fused_sigindex={})

File: multipers/grids.pyx (starting at line 197)

multipers.grids._torch_regular_closest(f, r: int, unique: bool = True)

File: multipers/grids.pyx (starting at line 204)

multipers.grids.coarsen_points(signatures, args, kwargs, defaults, _fused_sigindex={})

File: multipers/grids.pyx (starting at line 246)

multipers.grids.compute_bounding_box(stuff)

File: multipers/grids.pyx (starting at line 220)

Returns a array of shape (2, num_parameters) such that for any filtration value $y$ of something in stuff, then if (x,z) is the output of this function, we have $xle y le z$.

multipers.grids.compute_grid(signatures, args, kwargs, defaults, _fused_sigindex={})

File: multipers/grids.pyx (starting at line 27)

Computes a grid from filtration values, using some strategy.

Input

  • filtrations_values: Iterable[filtration of parameter for parameter]

    where filtration_of_parameter is a array[float, ndim=1]

  • resolution:Optional[int|tuple[int]]

  • strategy: either exact, regular, regular_closest, regular_left, partition, quantile, or precomputed.

  • unique: if true, doesn’t repeat values in the output grid.

  • drop_quantiles : drop some filtration values according to these quantiles

Output

Iterable[array[float, ndim=1]] : the 1d-grid for each parameter.

multipers.grids.evaluate_in_grid(pts, grid, mass_default=None)

File: multipers/grids.pyx (starting at line 254)

Input

  • pts: of the form array[int, ndim=2]

  • grid of the form Iterable[array[float, ndim=1]]

multipers.grids.push_to_grid(signatures, args, kwargs, defaults, _fused_sigindex={})

File: multipers/grids.pyx (starting at line 229)

Given points and a grid (list of one parameter grids), pushes the points onto the grid.

multipers.grids.sm_in_grid(pts, weights, grid, num_parameters: int = -1, mass_default=None)

File: multipers/grids.pyx (starting at line 281) Given a measure whose points are coordinates,

pushes this measure in this grid. Input —–

  • pts: of the form array[int, ndim=2]

  • weights: array[int, ndim=1]

  • grid of the form Iterable[array[float, ndim=1]]

  • num_parameters: number of parameters

multipers.grids.sms_in_grid(sms, grid, num_parameters: int = -1, mass_default=None)

File: multipers/grids.pyx (starting at line 318) Given a measure whose points are coordinates,

pushes this measure in this grid. Input —–

  • sms: of the form (signed_measure_like for num_measures) where signed_measure_like = tuple(array[int, ndim=2], array[int])

  • grid of the form Iterable[array[float, ndim=1]]

multipers.grids.todense(grid)

File: multipers/grids.pyx (starting at line 179)

multipers.io module

File: multipers/io.pyx (starting at line 1)

multipers.io._check_available(soft: str)

File: multipers/io.pyx (starting at line 232)

Parameters:

soft (str)

multipers.io._init_external_softwares(requires=[])

File: multipers/io.pyx (starting at line 212)

multipers.io._path_init(soft: str | os.PathLike)

File: multipers/io.pyx (starting at line 70)

Parameters:

soft (str | PathLike)

multipers.io._put_temp_files_to_ram()

File: multipers/io.pyx (starting at line 205)

multipers.io.clear_io(*args)

File: multipers/io.pyx (starting at line 517) Removes temporary files

multipers.io.function_delaunay_presentation(point_cloud: np.ndarray, function_values: np.ndarray, id: str | None = None, clear: bool = True, verbose: bool = False, degree: int = -1, multi_chunk: bool = False)

File: multipers/io.pyx (starting at line 423)

Computes a function delaunay presentation, and returns it as blocks.

points : (num_pts, n) float array grades : (num_pts,) float array degree (opt) : if given, computes a minimal presentation of this homological degree first clear:bool, removes temporary files if true degree: computes minimal presentation of this degree if given verbose : bool

Parameters:
  • point_cloud (ndarray)

  • function_values (ndarray)

  • id (str | None)

  • clear (bool)

  • verbose (bool)

multipers.io.function_delaunay_presentation_to_slicer(slicer, point_cloud: np.ndarray, function_values: np.ndarray, id: str | None = None, clear: bool = True, verbose: bool = False, degree: int = -1, multi_chunk: bool = False)

File: multipers/io.pyx (starting at line 470)

Computes a function delaunay presentation, and returns it as a slicer.

slicer: empty slicer to fill points : (num_pts, n) float array grades : (num_pts,) float array degree (opt) : if given, computes a minimal presentation of this homological degree first clear:bool, removes temporary files if true degree: computes minimal presentation of this degree if given verbose : bool

Parameters:
  • point_cloud (ndarray)

  • function_values (ndarray)

  • id (str | None)

  • clear (bool)

  • verbose (bool)

multipers.io.reduce_complex(complex, full_resolution: bool = True, dimension: int | np.int64 = 1, clear: bool = True, id: str | None = None, verbose: bool = False, backend: available_reduce_softs = 'mpfree')

File: multipers/io.pyx (starting at line 365)

Computes a minimal presentation of the file in path, using backend.

simplextree full_resolution: bool dimension: int, presentation dimension to consider clear: bool, removes temporary files if True id: str, temporary files are of this id, allowing for multiprocessing verbose: bool

Parameters:
  • full_resolution (bool)

  • dimension (int | int64)

  • clear (bool)

  • id (str | None)

  • verbose (bool)

  • backend (Literal['mpfree', 'multi_chunk', '2pac'])

multipers.io.scc2disk(stuff, path: str | os.PathLike, num_parameters: int = -1, reverse_block: bool = False, rivet_compatible: bool = False, ignore_last_generators: bool = False, strip_comments: bool = False)

File: multipers/io.pyx (starting at line 596)

Writes a scc python format / blocks into a file.

Parameters:

path (str | PathLike)

multipers.io.scc2disk_old(stuff, path: str | os.PathLike, num_parameters=-1, reverse_block=False, rivet_compatible=False, ignore_last_generators=False, strip_comments=False)

File: multipers/io.pyx (starting at line 653)

Writes a scc python format / blocks into a file.

Parameters:

path (str | PathLike)

multipers.io.scc_parser(path: str | os.PathLike)

File: multipers/io.pyx (starting at line 111)

Parse an scc file into the scc python format, aka blocks.

Parameters:

path (str | PathLike)

multipers.io.scc_parser__old(path: str)

File: multipers/io.pyx (starting at line 139)

Parse an scc file into the scc python format, aka blocks.

Parameters:

path (str)

multipers.io.scc_reduce_from_str(path: str | os.PathLike, full_resolution: bool = True, dimension: int | np.int64 = 1, clear: bool = True, id: str | None = None, verbose: bool = False, backend: Literal['mpfree', 'multi_chunk', 'twopac'] = 'mpfree')

File: multipers/io.pyx (starting at line 237)

Computes a minimal presentation of the file in path, using mpfree.

path:PathLike full_resolution: bool dimension: int, presentation dimension to consider clear: bool, removes temporary files if True id: str, temporary files are of this id, allowing for multiprocessing verbose: bool backend: “mpfree”, “multi_chunk” or “2pac”

Parameters:
  • path (str | PathLike)

  • dimension (int | int64)

  • clear (bool)

  • id (str | None)

  • verbose (bool)

  • backend (Literal['mpfree', 'multi_chunk', 'twopac'])

multipers.io.scc_reduce_from_str_to_slicer(path: str | os.PathLike, slicer, full_resolution: bool = True, dimension: int | np.int64 = 1, clear: bool = True, id: str | None = None, verbose: bool = False, backend: Literal['mpfree', 'multi_chunk', 'twopac'] = 'mpfree', shift_dimension=0)

File: multipers/io.pyx (starting at line 302)

Computes a minimal presentation of the file in path, using mpfree.

path:PathLike slicer: empty slicer to fill full_resolution: bool dimension: int, presentation dimension to consider clear: bool, removes temporary files if True id: str, temporary files are of this id, allowing for multiprocessing verbose: bool backend: “mpfree”, “multi_chunk” or “2pac”

Parameters:
  • path (str | PathLike)

  • dimension (int | int64)

  • clear (bool)

  • id (str | None)

  • verbose (bool)

  • backend (Literal['mpfree', 'multi_chunk', 'twopac'])

multipers.mma_structures module

File: multipers/mma_structures.pyx (starting at line 6) ! @package mma @brief Files containing the C++ cythonized functions. @author David Loiseaux @copyright Copyright (c) 2022 Inria.

class multipers.mma_structures.PyBox_f32

Bases: object

contains(self, x)

File: multipers/mma_structures.pyx (starting at line 846)

dtype
get(self)

File: multipers/mma_structures.pyx (starting at line 852)

num_parameters
to_multipers(self)

File: multipers/mma_structures.pyx (starting at line 854)

class multipers.mma_structures.PyBox_f64

Bases: object

contains(self, x)

File: multipers/mma_structures.pyx (starting at line 1748)

dtype
get(self)

File: multipers/mma_structures.pyx (starting at line 1754)

num_parameters
to_multipers(self)

File: multipers/mma_structures.pyx (starting at line 1756)

class multipers.mma_structures.PyBox_i32

Bases: object

contains(self, x)

File: multipers/mma_structures.pyx (starting at line 122)

dtype
get(self)

File: multipers/mma_structures.pyx (starting at line 128)

num_parameters
to_multipers(self)

File: multipers/mma_structures.pyx (starting at line 130)

class multipers.mma_structures.PyBox_i64

Bases: object

contains(self, x)

File: multipers/mma_structures.pyx (starting at line 484)

dtype
get(self)

File: multipers/mma_structures.pyx (starting at line 490)

num_parameters
to_multipers(self)

File: multipers/mma_structures.pyx (starting at line 492)

class multipers.mma_structures.PyModule_f32

Bases: object

File: multipers/mma_structures.pyx (starting at line 863)

Stores a representation of a n-persistence module.

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/mma_structures.pyx (starting at line 1126)

_compute_pixels(self, coordinates: np.ndarray, degrees=None, box=None, delta: float = .1, p: float = 1., normalize: bool = False, n_jobs: int = 0)

File: multipers/mma_structures.pyx (starting at line 1079)

Computes the image of the module at the given coordinates

Parameters:

coordinates (ndarray)

_set_from_ptr(self, module_ptr: int)

File: multipers/mma_structures.pyx (starting at line 885)

Copy module from a memory pointer. Unsafe.

barcode(self, basepoint, degree: int = -1, *, threshold: bool = False)

File: multipers/mma_structures.pyx (starting at line 1094) Computes the barcode of module along a lines.

basepointvector

basepoint of the lines on which to compute the barcodes, i.e. a point on the line

degree = -1integer

Homology degree on which to compute the bars. If negative, every dimension is computed

box (default) :

box on which to compute the barcodes if basepoints is not specified. Default is a linspace of lines crossing that box.

threshold = False

Thre

If the barcodes are not thresholded, essential barcodes will not be plot-able.

PyMultiDiagrams

Structure that holds the barcodes. Barcodes can be retrieved with a .get_points() or a .to_multipers() or a .plot().

barcode2(self, basepoint, direction=None, degree: int = -1, *, threshold: bool = False, keep_inf: bool = True, full: bool = False)

File: multipers/mma_structures.pyx (starting at line 1132)

Compute the 1d-barcode a diagonal line based on basepoint, with some direction.

Parameters

  • basepoint: 1d array

  • directiont: 1d array or None, if None: diagonal

  • degree: int the degree to compute (-1 means all)

  • threshold: bool if True, threshold the barcode to the modules box

  • keep_inf: bool if False, removes trivial bars

    Note that this removes the order w.r.t. the summands in that case

  • full:bool if True, returns the coordinates of the barcode instead of the coordinate in the line.

The output is of the form

tuple[np.ndarray of shape (num_bars,2)] or tuple[array of shape (num_bar, 2, num_parameters)]

barcodes(self, degree: int, basepoints=None, num=100, box=None, threshold=False)

File: multipers/mma_structures.pyx (starting at line 1163) Computes barcodes of module along a set of lines.

basepoints = Nonelist of vectors

basepoints of the lines on which to compute the barcodes.

degree = -1integer

Homology degree on which to compute the bars. If negative, every dimension is computed

box (default) :

box on which to compute the barcodes if basepoints is not specified. Default is a linspace of lines crossing that box.

num:int=100

if basepoints is not specified, defines the number of lines to consider.

threshold = Falsethreshold t

Resolution of the image(s).

If the barcodes are not thresholded, essential barcodes will not be plot-able.

PyMultiDiagrams

Structure that holds the barcodes. Barcodes can be retrieved with a .get_points() or a .to_multipers() or a .plot().

barcodes2(self, degree: int = -1, basepoints=None, num: int = 100, box=None, threshold: bool = False)

File: multipers/mma_structures.pyx (starting at line 1206) Computes barcodes of module along a set of lines.

basepoints = Nonelist of vectors

basepoints of the lines on which to compute the barcodes.

degree = -1integer

Homology degree on which to compute the bars. If negative, every dimension is computed

box (default) :

box on which to compute the barcodes if basepoints is not specified. Default is a linspace of lines crossing that box.

num:int=100

if basepoints is not specified, defines the number of lines to consider.

threshold = Falsethreshold t

Resolution of the image(s).

If the barcodes are not thresholded, essential barcodes will not be plot-able.

tuple of 1d barcodes, based on basepoint, with direction (1,1)

degree_splits(self)

File: multipers/mma_structures.pyx (starting at line 1077)

distance_to(self, pts, signed: bool = False, n_jobs: int = 0) np.ndarray

File: multipers/mma_structures.pyx (starting at line 1503)

Distance from a point to each summand’s support. Signed distance is the distance to the boundary, with negative values inside the summands.

pts of shape (num_pts, num_parameters)

output shape : (num_pts,num_summands)

Return type:

ndarray

distances_idx_to(self, pts, full: bool = False, n_jobs: int = 1)

File: multipers/mma_structures.pyx (starting at line 1493)

dtype
dump(self, path: str | None = None)

File: multipers/mma_structures.pyx (starting at line 949)

Dumps the module into a pickle-able format.

Parameters

path:str=None (optional) saves the pickled module in specified path

Returns

list of list, encoding the module, which can be retrieved with the function from_dump.

Parameters:

path (str | None)

euler_char(self, points: list | np.ndarray) np.ndarray

File: multipers/mma_structures.pyx (starting at line 1445) Computes the Euler Characteristic of the filtered complex at given (multiparameter) time

points: list[float] | list[list[float]] | np.ndarray

List of filtration values on which to compute the euler characteristic. WARNING FIXME : the points have to have the same dimension as the simplextree.

The list of euler characteristic values

Parameters:

points (list | ndarray)

Return type:

ndarray

get_bottom(self) np.ndarray

File: multipers/mma_structures.pyx (starting at line 923)

Bottom of the box of the module

Return type:

ndarray

get_bounds(self)

File: multipers/mma_structures.pyx (starting at line 984)

Computes bounds from the summands’ bounds. Useful to change this’ box.

get_box(self) np.ndarray

File: multipers/mma_structures.pyx (starting at line 933)

Returns the current bounding box of the module.

Return type:

ndarray

get_filtration_values(self, unique: bool = True)

File: multipers/mma_structures.pyx (starting at line 1008)

Retrieves all filtration values of the summands of the module.

Output format

list of filtration values for parameter.

get_interleavings(self, box=None)

File: multipers/mma_structures.pyx (starting at line 1526)

get_module_of_degree(self, degree: int) PyModule_f32

File: multipers/mma_structures.pyx (starting at line 895)

Returns a copy of a module of fixed degree.

Return type:

PyModule_f32

get_module_of_degrees(self, degrees: Iterable[int]) PyModule_f32

File: multipers/mma_structures.pyx (starting at line 907)

Returns a copy of the summands of degrees in degrees

Parameters:

degrees (Iterable[int])

Return type:

PyModule_f32

get_top(self) np.ndarray

File: multipers/mma_structures.pyx (starting at line 928)

Top of the box of the module

Return type:

ndarray

landscape(self, degree: int, k: int = 0, box: Sequence | np.ndarray | None = None, resolution: Sequence = [100, 100], plot: bool = False)

File: multipers/mma_structures.pyx (starting at line 1247) Computes the multiparameter landscape from a PyModule. Python interface only bifiltrations.

degreeinteger

The homology degree of the landscape.

k = 0int

the k-th landscape

resolution = [50,50]pair of integers

Resolution of the image.

box = Nonein the format [[a,b], [c,d]]

If nontrivial, compute the landscape of this box. Default is the PyModule box.

plot = TrueBoolean

If true, plots the images;

The landscape of the module.

Parameters:
  • degree (int)

  • k (int)

  • box (Sequence | ndarray | None)

  • resolution (Sequence)

landscapes(self, degree: int, ks: list | np.ndarray = [0], box=None, resolution: list | np.ndarray = [100, 100], plot: bool = False)

File: multipers/mma_structures.pyx (starting at line 1281) Computes the multiparameter landscape from a PyModule. Python interface only bifiltrations.

  • degreeinteger

    The homology degree of the landscape.

  • ks = 0list of int

    the k-th landscape

  • resolution = [50,50]pair of integers

    Resolution of the image.

  • box = Nonein the format [[a,b], [c,d]]

    If nontrivial, compute the landscape of this box. Default is the PyModule box.

  • plot = Truebool

    If true, plots the images;

The landscapes of the module with parameters ks.

Parameters:
  • degree (int)

  • ks (list | ndarray)

  • resolution (list | ndarray)

max_degree

max_degree: int

Returns the maximum degree of the module.

merge(self, other: PyModule_f32, dim: int = -1)

File: multipers/mma_structures.pyx (starting at line 875)

Merges two modules into one

num_parameters

num_parameters: int

plot(self, degree: int = -1, **kwargs) None

File: multipers/mma_structures.pyx (starting at line 1032) Shows the module on a plot. Each color corresponds to an apprimation summand of the module, and its shape corresponds to its support.

Only works with 2-parameter modules.

degree = -1integer

If positive returns only the image of dimension dimension.

box=Noneof the form [[b_x,b_y], [d_x,d_y]] where b,d are the bottom and top corner of the rectangle.

If non-None, will plot the module on this specific rectangle.

min_persistence =0float

Only plots the summand with a persistence above this threshold.

separated=Falsebool

If true, plot each summand in a different plot.

alpha=1float

Transparancy parameter

save = Falsestring

if nontrivial, will save the figure at this path

The figure of the plot.

Return type:

None

representation(self, degrees=None, bandwidth: float = 0.1, resolution: Sequence[int] | int = 50, kernel: Literal['gaussian', 'linear', 'linear2', 'exponential'] | Callable = 'gaussian', signed: bool = False, normalize: bool = False, plot: bool = False, save: bool = False, dpi: int = 200, p: float = 2., box=None, flatten: bool = False, n_jobs: int = 0, grid=None) np.ndarray

File: multipers/mma_structures.pyx (starting at line 1316) Computes a representation of the module, using

[A Framework for Fast and Stable Representations of Multiparameter Persistent Homology Decompositions, Neurips2023]

  • degrees = Noneinteger list

    If given returns only the image(s) of homology degrees degrees.

  • bandwidth = 0.1float

    Image parameter.

  • resolution = [100,100]pair of integers

    Resolution of the image(s).

  • normalize = TrueBoolean

    Ensures that the image belongs to [0,1].

  • plot = FalseBoolean

    If true, plots the images;

  • flatten=False :

    If True, reshapes the output to a flattened shape.

  • kernel: Either linear, gaussian, or callable The kernel to apply to the matrix $(d(x,I), x in mathrm{pixels}, Iin mathrm{summands})$. signature should be : (distance matrix, summand_weights, bandwidth, p) -> representation

The list of images, or the image of fixed dimension.

Parameters:
  • resolution (Sequence[int] | int)

  • kernel (Literal['gaussian', 'linear', 'linear2', 'exponential'] | ~collections.abc.Callable)

Return type:

ndarray

rescale(self, rescale_factors, degree: int = -1)

File: multipers/mma_structures.pyx (starting at line 993)

Rescales the fitlration values of the summands by this rescaling vector.

set_box(self, pybox: PyBox_f32)

File: multipers/mma_structures.pyx (starting at line 890)

to_flat_idx(self, grid)

File: multipers/mma_structures.pyx (starting at line 1486)

to_idx(self, grid)

File: multipers/mma_structures.pyx (starting at line 1480)

translate(self, translation, degree: int = -1)

File: multipers/mma_structures.pyx (starting at line 1000)

Translates the module in the filtration space by this vector.

class multipers.mma_structures.PyModule_f64

Bases: object

File: multipers/mma_structures.pyx (starting at line 1765)

Stores a representation of a n-persistence module.

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/mma_structures.pyx (starting at line 2028)

_compute_pixels(self, coordinates: np.ndarray, degrees=None, box=None, delta: float = .1, p: float = 1., normalize: bool = False, n_jobs: int = 0)

File: multipers/mma_structures.pyx (starting at line 1981)

Computes the image of the module at the given coordinates

Parameters:

coordinates (ndarray)

_set_from_ptr(self, module_ptr: int)

File: multipers/mma_structures.pyx (starting at line 1787)

Copy module from a memory pointer. Unsafe.

barcode(self, basepoint, degree: int = -1, *, threshold: bool = False)

File: multipers/mma_structures.pyx (starting at line 1996) Computes the barcode of module along a lines.

basepointvector

basepoint of the lines on which to compute the barcodes, i.e. a point on the line

degree = -1integer

Homology degree on which to compute the bars. If negative, every dimension is computed

box (default) :

box on which to compute the barcodes if basepoints is not specified. Default is a linspace of lines crossing that box.

threshold = False

Thre

If the barcodes are not thresholded, essential barcodes will not be plot-able.

PyMultiDiagrams

Structure that holds the barcodes. Barcodes can be retrieved with a .get_points() or a .to_multipers() or a .plot().

barcode2(self, basepoint, direction=None, degree: int = -1, *, threshold: bool = False, keep_inf: bool = True, full: bool = False)

File: multipers/mma_structures.pyx (starting at line 2034)

Compute the 1d-barcode a diagonal line based on basepoint, with some direction.

Parameters

  • basepoint: 1d array

  • directiont: 1d array or None, if None: diagonal

  • degree: int the degree to compute (-1 means all)

  • threshold: bool if True, threshold the barcode to the modules box

  • keep_inf: bool if False, removes trivial bars

    Note that this removes the order w.r.t. the summands in that case

  • full:bool if True, returns the coordinates of the barcode instead of the coordinate in the line.

The output is of the form

tuple[np.ndarray of shape (num_bars,2)] or tuple[array of shape (num_bar, 2, num_parameters)]

barcodes(self, degree: int, basepoints=None, num=100, box=None, threshold=False)

File: multipers/mma_structures.pyx (starting at line 2065) Computes barcodes of module along a set of lines.

basepoints = Nonelist of vectors

basepoints of the lines on which to compute the barcodes.

degree = -1integer

Homology degree on which to compute the bars. If negative, every dimension is computed

box (default) :

box on which to compute the barcodes if basepoints is not specified. Default is a linspace of lines crossing that box.

num:int=100

if basepoints is not specified, defines the number of lines to consider.

threshold = Falsethreshold t

Resolution of the image(s).

If the barcodes are not thresholded, essential barcodes will not be plot-able.

PyMultiDiagrams

Structure that holds the barcodes. Barcodes can be retrieved with a .get_points() or a .to_multipers() or a .plot().

barcodes2(self, degree: int = -1, basepoints=None, num: int = 100, box=None, threshold: bool = False)

File: multipers/mma_structures.pyx (starting at line 2108) Computes barcodes of module along a set of lines.

basepoints = Nonelist of vectors

basepoints of the lines on which to compute the barcodes.

degree = -1integer

Homology degree on which to compute the bars. If negative, every dimension is computed

box (default) :

box on which to compute the barcodes if basepoints is not specified. Default is a linspace of lines crossing that box.

num:int=100

if basepoints is not specified, defines the number of lines to consider.

threshold = Falsethreshold t

Resolution of the image(s).

If the barcodes are not thresholded, essential barcodes will not be plot-able.

tuple of 1d barcodes, based on basepoint, with direction (1,1)

degree_splits(self)

File: multipers/mma_structures.pyx (starting at line 1979)

distance_to(self, pts, signed: bool = False, n_jobs: int = 0) np.ndarray

File: multipers/mma_structures.pyx (starting at line 2405)

Distance from a point to each summand’s support. Signed distance is the distance to the boundary, with negative values inside the summands.

pts of shape (num_pts, num_parameters)

output shape : (num_pts,num_summands)

Return type:

ndarray

distances_idx_to(self, pts, full: bool = False, n_jobs: int = 1)

File: multipers/mma_structures.pyx (starting at line 2395)

dtype
dump(self, path: str | None = None)

File: multipers/mma_structures.pyx (starting at line 1851)

Dumps the module into a pickle-able format.

Parameters

path:str=None (optional) saves the pickled module in specified path

Returns

list of list, encoding the module, which can be retrieved with the function from_dump.

Parameters:

path (str | None)

euler_char(self, points: list | np.ndarray) np.ndarray

File: multipers/mma_structures.pyx (starting at line 2347) Computes the Euler Characteristic of the filtered complex at given (multiparameter) time

points: list[float] | list[list[float]] | np.ndarray

List of filtration values on which to compute the euler characteristic. WARNING FIXME : the points have to have the same dimension as the simplextree.

The list of euler characteristic values

Parameters:

points (list | ndarray)

Return type:

ndarray

get_bottom(self) np.ndarray

File: multipers/mma_structures.pyx (starting at line 1825)

Bottom of the box of the module

Return type:

ndarray

get_bounds(self)

File: multipers/mma_structures.pyx (starting at line 1886)

Computes bounds from the summands’ bounds. Useful to change this’ box.

get_box(self) np.ndarray

File: multipers/mma_structures.pyx (starting at line 1835)

Returns the current bounding box of the module.

Return type:

ndarray

get_filtration_values(self, unique: bool = True)

File: multipers/mma_structures.pyx (starting at line 1910)

Retrieves all filtration values of the summands of the module.

Output format

list of filtration values for parameter.

get_interleavings(self, box=None)

File: multipers/mma_structures.pyx (starting at line 2428)

get_module_of_degree(self, degree: int) PyModule_f64

File: multipers/mma_structures.pyx (starting at line 1797)

Returns a copy of a module of fixed degree.

Return type:

PyModule_f64

get_module_of_degrees(self, degrees: Iterable[int]) PyModule_f64

File: multipers/mma_structures.pyx (starting at line 1809)

Returns a copy of the summands of degrees in degrees

Parameters:

degrees (Iterable[int])

Return type:

PyModule_f64

get_top(self) np.ndarray

File: multipers/mma_structures.pyx (starting at line 1830)

Top of the box of the module

Return type:

ndarray

landscape(self, degree: int, k: int = 0, box: Sequence | np.ndarray | None = None, resolution: Sequence = [100, 100], plot: bool = False)

File: multipers/mma_structures.pyx (starting at line 2149) Computes the multiparameter landscape from a PyModule. Python interface only bifiltrations.

degreeinteger

The homology degree of the landscape.

k = 0int

the k-th landscape

resolution = [50,50]pair of integers

Resolution of the image.

box = Nonein the format [[a,b], [c,d]]

If nontrivial, compute the landscape of this box. Default is the PyModule box.

plot = TrueBoolean

If true, plots the images;

The landscape of the module.

Parameters:
  • degree (int)

  • k (int)

  • box (Sequence | ndarray | None)

  • resolution (Sequence)

landscapes(self, degree: int, ks: list | np.ndarray = [0], box=None, resolution: list | np.ndarray = [100, 100], plot: bool = False)

File: multipers/mma_structures.pyx (starting at line 2183) Computes the multiparameter landscape from a PyModule. Python interface only bifiltrations.

  • degreeinteger

    The homology degree of the landscape.

  • ks = 0list of int

    the k-th landscape

  • resolution = [50,50]pair of integers

    Resolution of the image.

  • box = Nonein the format [[a,b], [c,d]]

    If nontrivial, compute the landscape of this box. Default is the PyModule box.

  • plot = Truebool

    If true, plots the images;

The landscapes of the module with parameters ks.

Parameters:
  • degree (int)

  • ks (list | ndarray)

  • resolution (list | ndarray)

max_degree

max_degree: int

Returns the maximum degree of the module.

merge(self, other: PyModule_f64, dim: int = -1)

File: multipers/mma_structures.pyx (starting at line 1777)

Merges two modules into one

num_parameters

num_parameters: int

plot(self, degree: int = -1, **kwargs) None

File: multipers/mma_structures.pyx (starting at line 1934) Shows the module on a plot. Each color corresponds to an apprimation summand of the module, and its shape corresponds to its support.

Only works with 2-parameter modules.

degree = -1integer

If positive returns only the image of dimension dimension.

box=Noneof the form [[b_x,b_y], [d_x,d_y]] where b,d are the bottom and top corner of the rectangle.

If non-None, will plot the module on this specific rectangle.

min_persistence =0float

Only plots the summand with a persistence above this threshold.

separated=Falsebool

If true, plot each summand in a different plot.

alpha=1float

Transparancy parameter

save = Falsestring

if nontrivial, will save the figure at this path

The figure of the plot.

Return type:

None

representation(self, degrees=None, bandwidth: float = 0.1, resolution: Sequence[int] | int = 50, kernel: Literal['gaussian', 'linear', 'linear2', 'exponential'] | Callable = 'gaussian', signed: bool = False, normalize: bool = False, plot: bool = False, save: bool = False, dpi: int = 200, p: float = 2., box=None, flatten: bool = False, n_jobs: int = 0, grid=None) np.ndarray

File: multipers/mma_structures.pyx (starting at line 2218) Computes a representation of the module, using

[A Framework for Fast and Stable Representations of Multiparameter Persistent Homology Decompositions, Neurips2023]

  • degrees = Noneinteger list

    If given returns only the image(s) of homology degrees degrees.

  • bandwidth = 0.1float

    Image parameter.

  • resolution = [100,100]pair of integers

    Resolution of the image(s).

  • normalize = TrueBoolean

    Ensures that the image belongs to [0,1].

  • plot = FalseBoolean

    If true, plots the images;

  • flatten=False :

    If True, reshapes the output to a flattened shape.

  • kernel: Either linear, gaussian, or callable The kernel to apply to the matrix $(d(x,I), x in mathrm{pixels}, Iin mathrm{summands})$. signature should be : (distance matrix, summand_weights, bandwidth, p) -> representation

The list of images, or the image of fixed dimension.

Parameters:
  • resolution (Sequence[int] | int)

  • kernel (Literal['gaussian', 'linear', 'linear2', 'exponential'] | ~collections.abc.Callable)

Return type:

ndarray

rescale(self, rescale_factors, degree: int = -1)

File: multipers/mma_structures.pyx (starting at line 1895)

Rescales the fitlration values of the summands by this rescaling vector.

set_box(self, pybox: PyBox_f64)

File: multipers/mma_structures.pyx (starting at line 1792)

to_flat_idx(self, grid)

File: multipers/mma_structures.pyx (starting at line 2388)

to_idx(self, grid)

File: multipers/mma_structures.pyx (starting at line 2382)

translate(self, translation, degree: int = -1)

File: multipers/mma_structures.pyx (starting at line 1902)

Translates the module in the filtration space by this vector.

class multipers.mma_structures.PyModule_i32

Bases: object

File: multipers/mma_structures.pyx (starting at line 139)

Stores a representation of a n-persistence module.

_set_from_ptr(self, module_ptr: int)

File: multipers/mma_structures.pyx (starting at line 161)

Copy module from a memory pointer. Unsafe.

degree_splits(self)

File: multipers/mma_structures.pyx (starting at line 353)

dtype
dump(self, path: str | None = None)

File: multipers/mma_structures.pyx (starting at line 225)

Dumps the module into a pickle-able format.

Parameters

path:str=None (optional) saves the pickled module in specified path

Returns

list of list, encoding the module, which can be retrieved with the function from_dump.

Parameters:

path (str | None)

get_bottom(self) np.ndarray

File: multipers/mma_structures.pyx (starting at line 199)

Bottom of the box of the module

Return type:

ndarray

get_bounds(self)

File: multipers/mma_structures.pyx (starting at line 260)

Computes bounds from the summands’ bounds. Useful to change this’ box.

get_box(self) np.ndarray

File: multipers/mma_structures.pyx (starting at line 209)

Returns the current bounding box of the module.

Return type:

ndarray

get_filtration_values(self, unique: bool = True)

File: multipers/mma_structures.pyx (starting at line 284)

Retrieves all filtration values of the summands of the module.

Output format

list of filtration values for parameter.

get_module_of_degree(self, degree: int) PyModule_i32

File: multipers/mma_structures.pyx (starting at line 171)

Returns a copy of a module of fixed degree.

Return type:

PyModule_i32

get_module_of_degrees(self, degrees: Iterable[int]) PyModule_i32

File: multipers/mma_structures.pyx (starting at line 183)

Returns a copy of the summands of degrees in degrees

Parameters:

degrees (Iterable[int])

Return type:

PyModule_i32

get_top(self) np.ndarray

File: multipers/mma_structures.pyx (starting at line 204)

Top of the box of the module

Return type:

ndarray

max_degree

max_degree: int

Returns the maximum degree of the module.

merge(self, other: PyModule_i32, dim: int = -1)

File: multipers/mma_structures.pyx (starting at line 151)

Merges two modules into one

num_parameters

num_parameters: int

plot(self, degree: int = -1, **kwargs) None

File: multipers/mma_structures.pyx (starting at line 308) Shows the module on a plot. Each color corresponds to an apprimation summand of the module, and its shape corresponds to its support.

Only works with 2-parameter modules.

degree = -1integer

If positive returns only the image of dimension dimension.

box=Noneof the form [[b_x,b_y], [d_x,d_y]] where b,d are the bottom and top corner of the rectangle.

If non-None, will plot the module on this specific rectangle.

min_persistence =0float

Only plots the summand with a persistence above this threshold.

separated=Falsebool

If true, plot each summand in a different plot.

alpha=1float

Transparancy parameter

save = Falsestring

if nontrivial, will save the figure at this path

The figure of the plot.

Return type:

None

rescale(self, rescale_factors, degree: int = -1)

File: multipers/mma_structures.pyx (starting at line 269)

Rescales the fitlration values of the summands by this rescaling vector.

set_box(self, pybox: PyBox_i32)

File: multipers/mma_structures.pyx (starting at line 166)

translate(self, translation, degree: int = -1)

File: multipers/mma_structures.pyx (starting at line 276)

Translates the module in the filtration space by this vector.

class multipers.mma_structures.PyModule_i64

Bases: object

File: multipers/mma_structures.pyx (starting at line 501)

Stores a representation of a n-persistence module.

_set_from_ptr(self, module_ptr: int)

File: multipers/mma_structures.pyx (starting at line 523)

Copy module from a memory pointer. Unsafe.

degree_splits(self)

File: multipers/mma_structures.pyx (starting at line 715)

dtype
dump(self, path: str | None = None)

File: multipers/mma_structures.pyx (starting at line 587)

Dumps the module into a pickle-able format.

Parameters

path:str=None (optional) saves the pickled module in specified path

Returns

list of list, encoding the module, which can be retrieved with the function from_dump.

Parameters:

path (str | None)

get_bottom(self) np.ndarray

File: multipers/mma_structures.pyx (starting at line 561)

Bottom of the box of the module

Return type:

ndarray

get_bounds(self)

File: multipers/mma_structures.pyx (starting at line 622)

Computes bounds from the summands’ bounds. Useful to change this’ box.

get_box(self) np.ndarray

File: multipers/mma_structures.pyx (starting at line 571)

Returns the current bounding box of the module.

Return type:

ndarray

get_filtration_values(self, unique: bool = True)

File: multipers/mma_structures.pyx (starting at line 646)

Retrieves all filtration values of the summands of the module.

Output format

list of filtration values for parameter.

get_module_of_degree(self, degree: int) PyModule_i64

File: multipers/mma_structures.pyx (starting at line 533)

Returns a copy of a module of fixed degree.

Return type:

PyModule_i64

get_module_of_degrees(self, degrees: Iterable[int]) PyModule_i64

File: multipers/mma_structures.pyx (starting at line 545)

Returns a copy of the summands of degrees in degrees

Parameters:

degrees (Iterable[int])

Return type:

PyModule_i64

get_top(self) np.ndarray

File: multipers/mma_structures.pyx (starting at line 566)

Top of the box of the module

Return type:

ndarray

max_degree

max_degree: int

Returns the maximum degree of the module.

merge(self, other: PyModule_i64, dim: int = -1)

File: multipers/mma_structures.pyx (starting at line 513)

Merges two modules into one

num_parameters

num_parameters: int

plot(self, degree: int = -1, **kwargs) None

File: multipers/mma_structures.pyx (starting at line 670) Shows the module on a plot. Each color corresponds to an apprimation summand of the module, and its shape corresponds to its support.

Only works with 2-parameter modules.

degree = -1integer

If positive returns only the image of dimension dimension.

box=Noneof the form [[b_x,b_y], [d_x,d_y]] where b,d are the bottom and top corner of the rectangle.

If non-None, will plot the module on this specific rectangle.

min_persistence =0float

Only plots the summand with a persistence above this threshold.

separated=Falsebool

If true, plot each summand in a different plot.

alpha=1float

Transparancy parameter

save = Falsestring

if nontrivial, will save the figure at this path

The figure of the plot.

Return type:

None

rescale(self, rescale_factors, degree: int = -1)

File: multipers/mma_structures.pyx (starting at line 631)

Rescales the fitlration values of the summands by this rescaling vector.

set_box(self, pybox: PyBox_i64)

File: multipers/mma_structures.pyx (starting at line 528)

translate(self, translation, degree: int = -1)

File: multipers/mma_structures.pyx (starting at line 638)

Translates the module in the filtration space by this vector.

class multipers.mma_structures.PyMultiDiagramPoint_f32

Bases: object

get_birth(self)

File: multipers/mma_structures.pyx (starting at line 1540)

get_death(self)

File: multipers/mma_structures.pyx (starting at line 1543)

get_degree(self)

File: multipers/mma_structures.pyx (starting at line 1538)

class multipers.mma_structures.PyMultiDiagramPoint_f64

Bases: object

get_birth(self)

File: multipers/mma_structures.pyx (starting at line 2442)

get_death(self)

File: multipers/mma_structures.pyx (starting at line 2445)

get_degree(self)

File: multipers/mma_structures.pyx (starting at line 2440)

class multipers.mma_structures.PyMultiDiagram_f32

Bases: object

File: multipers/mma_structures.pyx (starting at line 1548)

Stores the diagram of a PyModule on a line

get_points(self, degree: int = -1) np.ndarray

File: multipers/mma_structures.pyx (starting at line 1556)

Parameters:

degree (int)

Return type:

ndarray

to_multipers(self, dimension: int)

File: multipers/mma_structures.pyx (starting at line 1563)

Parameters:

dimension (int)

class multipers.mma_structures.PyMultiDiagram_f64

Bases: object

File: multipers/mma_structures.pyx (starting at line 2450)

Stores the diagram of a PyModule on a line

get_points(self, degree: int = -1) np.ndarray

File: multipers/mma_structures.pyx (starting at line 2458)

Parameters:

degree (int)

Return type:

ndarray

to_multipers(self, dimension: int)

File: multipers/mma_structures.pyx (starting at line 2465)

Parameters:

dimension (int)

class multipers.mma_structures.PyMultiDiagrams_f32

Bases: object

File: multipers/mma_structures.pyx (starting at line 1569)

Stores the barcodes of a PyModule on multiple lines

get_points(self, degree: int = -1)

File: multipers/mma_structures.pyx (starting at line 1587)

Parameters:

degree (int)

plot(self, degree: int = -1, min_persistence: float = 0)

File: multipers/mma_structures.pyx (starting at line 1591)

Plots the barcodes.

Parameters

  • degree:int=-1

    Only plots the bars of specified homology degree. Useful when the multidiagrams contains multiple dimenions

  • min_persistence:float=0

    Only plot bars of length greater than this value. Useful to reduce the time to plot.

Warning

If the barcodes are not thresholded, essential barcodes will not be displayed !

Parameters:
  • degree (int)

  • min_persistence (float)

to_multipers(self)

File: multipers/mma_structures.pyx (starting at line 1577)

class multipers.mma_structures.PyMultiDiagrams_f64

Bases: object

File: multipers/mma_structures.pyx (starting at line 2471)

Stores the barcodes of a PyModule on multiple lines

get_points(self, degree: int = -1)

File: multipers/mma_structures.pyx (starting at line 2489)

Parameters:

degree (int)

plot(self, degree: int = -1, min_persistence: float = 0)

File: multipers/mma_structures.pyx (starting at line 2493)

Plots the barcodes.

Parameters

  • degree:int=-1

    Only plots the bars of specified homology degree. Useful when the multidiagrams contains multiple dimenions

  • min_persistence:float=0

    Only plot bars of length greater than this value. Useful to reduce the time to plot.

Warning

If the barcodes are not thresholded, essential barcodes will not be displayed !

Parameters:
  • degree (int)

  • min_persistence (float)

to_multipers(self)

File: multipers/mma_structures.pyx (starting at line 2479)

class multipers.mma_structures.PySummand_f32

Bases: object

File: multipers/mma_structures.pyx (starting at line 776)

Stores a Summand of a PyModule

degree

degree: int

dtype
get_birth_list(self)

File: multipers/mma_structures.pyx (starting at line 782)

get_bounds(self)

File: multipers/mma_structures.pyx (starting at line 796)

get_death_list(self)

File: multipers/mma_structures.pyx (starting at line 786)

num_parameters(self)

File: multipers/mma_structures.pyx (starting at line 805)

class multipers.mma_structures.PySummand_f64

Bases: object

File: multipers/mma_structures.pyx (starting at line 1678)

Stores a Summand of a PyModule

degree

degree: int

dtype
get_birth_list(self)

File: multipers/mma_structures.pyx (starting at line 1684)

get_bounds(self)

File: multipers/mma_structures.pyx (starting at line 1698)

get_death_list(self)

File: multipers/mma_structures.pyx (starting at line 1688)

num_parameters(self)

File: multipers/mma_structures.pyx (starting at line 1707)

class multipers.mma_structures.PySummand_i32

Bases: object

File: multipers/mma_structures.pyx (starting at line 52)

Stores a Summand of a PyModule

degree

degree: int

dtype
get_birth_list(self)

File: multipers/mma_structures.pyx (starting at line 58)

get_bounds(self)

File: multipers/mma_structures.pyx (starting at line 72)

get_death_list(self)

File: multipers/mma_structures.pyx (starting at line 62)

num_parameters(self)

File: multipers/mma_structures.pyx (starting at line 81)

class multipers.mma_structures.PySummand_i64

Bases: object

File: multipers/mma_structures.pyx (starting at line 414)

Stores a Summand of a PyModule

degree

degree: int

dtype
get_birth_list(self)

File: multipers/mma_structures.pyx (starting at line 420)

get_bounds(self)

File: multipers/mma_structures.pyx (starting at line 434)

get_death_list(self)

File: multipers/mma_structures.pyx (starting at line 424)

num_parameters(self)

File: multipers/mma_structures.pyx (starting at line 443)

multipers.mma_structures.from_dump_f32(dump) PyModule_f32

File: multipers/mma_structures.pyx (starting at line 1655) Retrieves a PyModule from a previous dump.

dump: either the output of the dump function, or a file containing the output of a dump.

The dumped module to retrieve

PyModule

The retrieved module.

Return type:

PyModule_f32

multipers.mma_structures.from_dump_f64(dump) PyModule_f64

File: multipers/mma_structures.pyx (starting at line 2557) Retrieves a PyModule from a previous dump.

dump: either the output of the dump function, or a file containing the output of a dump.

The dumped module to retrieve

PyModule

The retrieved module.

Return type:

PyModule_f64

multipers.mma_structures.from_dump_i32(dump) PyModule_i32

File: multipers/mma_structures.pyx (starting at line 391) Retrieves a PyModule from a previous dump.

dump: either the output of the dump function, or a file containing the output of a dump.

The dumped module to retrieve

PyModule

The retrieved module.

Return type:

PyModule_i32

multipers.mma_structures.from_dump_i64(dump) PyModule_i64

File: multipers/mma_structures.pyx (starting at line 753) Retrieves a PyModule from a previous dump.

dump: either the output of the dump function, or a file containing the output of a dump.

The dumped module to retrieve

PyModule

The retrieved module.

Return type:

PyModule_i64

multipers.mma_structures.is_mma(stuff)

File: multipers/mma_structures.pyx (starting at line 2615)

multipers.multiparameter_edge_collapse module

multipers.multiparameter_edge_collapse._collapse_edge_list(edges, num=0, full=False, strong=False, progress=False)

Given an edge list defining a 1 critical 2 parameter 1 dimensional simplicial complex, simplificates this filtered simplicial complex, using filtration-domination’s edge collapser.

Parameters:
  • num (int)

  • full (bool)

  • strong (bool)

  • progress (bool)

multipers.multiparameter_module_approximation module

File: multipers/multiparameter_module_approximation.pyx (starting at line 1) ! @package mma @brief Files containing the C++ cythonized functions. @author David Loiseaux @copyright Copyright (c) 2022 Inria.

multipers.multiparameter_module_approximation.module_approximation(input: SimplexTreeMulti_type | Slicer_type | tuple, box: np.ndarray | None = None, max_error: float = -1, nlines: int = 500, slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', minpres: Literal['mpfree'] | None = None, degree: int | None = None, complete: bool = True, threshold: bool = False, verbose: bool = False, ignore_warning: bool = False, id='', direction: list = [], swap_box_coords: list = [], *, n_jobs: int = -1) PyModule_type

File: multipers/multiparameter_module_approximation.pyx (starting at line 90) Computes an interval module approximation of a multiparameter filtration.

input: SimplexTreeMulti or Slicer-like.

Holds the multifiltered complex.

max_error: positive float

Trade-off between approximation and computational complexity. Upper bound of the module approximation, in bottleneck distance, for interval-decomposable modules.

nlines: int = 200

Alternative to max_error; specifies the number of persistence computation used for the approximation.

box(Optional) pair of list of floats

Defines a rectangle on which to compute the approximation. Format : [x,y], This defines a rectangle on which we draw the lines, uniformly drawn (with a max_error step). The first line is x. Warning: For custom boxes, and directions, you must ensure that the first line captures a generic barcode.

direction: float[:] = []

If given, the line are drawn with this angle. Warning: You must ensure that the first line, defined by box, captures a generic barcode.

slicer_backend: Either “matrix”,”clement”, or “graph”.

If a simplextree is given, it is first converted to this structure, with different choices of backends.

minpres: (Optional) “mpfree” only for the moment.

If given, and the input is a simplextree, computes a minimal presentation before starting the computation. A degree has to be given.

degree: int Only required when minpres is given.

Homological degree of the minimal degree.

threshold: bool

When true, intersects the module support with the box, i.e. no more infinite summands.

verbose: bool

Prints C++ infos.

ignore_warningbool

Unless set to true, prevents computing on more than 10k lines. Useful to prevent a segmentation fault due to “infinite” recursion.

PyModule

An interval decomposable module approximation of the module defined by the homology of this multi-filtration.

Parameters:
Return type:

PyModule_f32 | PyModule_f64

multipers.multiparameter_module_approximation.module_approximation_from_slicer(slicer: Slicer_type, box: np.ndarray | None = None, max_error=-1, complete: bool = True, threshold: bool = False, verbose: bool = False, direction: list = []) PyModule_type

File: multipers/multiparameter_module_approximation.pyx (starting at line 54)

Parameters:
Return type:

PyModule_f32 | PyModule_f64

multipers.pickle module

multipers.pickle.get_sm_with_axis(sms, idx, axis, degree)
multipers.pickle.get_sm_without_axis(sms, idx, degree)
multipers.pickle.load(path)
Parameters:

path (str)

multipers.pickle.load_with_axis(sms)
multipers.pickle.load_without_axis(sms)
multipers.pickle.save(path, signed_measures)
Parameters:

path (str)

multipers.pickle.save_with_axis(path, signed_measures)
Parameters:

path (str)

multipers.pickle.save_without_axis(path, signed_measures)
Parameters:

path (str)

multipers.plots module

multipers.plots._d_inf(a, b)
multipers.plots._plot_rectangle(rectangle, weight, **plt_kwargs)
Parameters:

rectangle (ndarray)

multipers.plots._plot_signed_measure_2(pts, weights, temp_alpha=0.7, threshold=(inf, inf), **plt_kwargs)
multipers.plots._plot_signed_measure_4(pts, weights, x_smoothing=1, area_alpha=True, threshold=(inf, inf), alpha=None, **plt_kwargs)
Parameters:
  • x_smoothing (float)

  • area_alpha (bool)

multipers.plots._rectangle(x, y, color, alpha)

Defines a rectangle patch in the format {z | x  ≤ z ≤ y} with color and alpha

multipers.plots.plot2d_PyModule(corners, box, *, dimension=-1, separated=False, min_persistence=0, alpha=1, verbose=False, save=False, dpi=200, shapely=True, xlabel=None, ylabel=None, cmap=None)
multipers.plots.plot_signed_measure(signed_measure, threshold=None, ax=None, **plt_kwargs)
multipers.plots.plot_signed_measures(signed_measures, threshold=None, size=4)
multipers.plots.plot_surface(grid, hf, fig=None, ax=None, cmap=None, discrete_surface=False, has_negative_values=False, **plt_args)
Parameters:

cmap (str | None)

multipers.plots.plot_surfaces(HF, size=4, **plt_args)

multipers.point_measure module

File: multipers/point_measure.pyx (starting at line 1)

multipers.point_measure.barcode_from_rank_sm(sm: tuple[np.ndarray, np.ndarray], basepoint: np.ndarray, direction: np.ndarray | None = None, full: bool = False)

File: multipers/point_measure.pyx (starting at line 179)

Given a rank signed measure sm and a line with basepoint basepoint (1darray) and direction direction (1darray), projects the rank signed measure on the given line, and returns the associated estimated barcode. If full is True, the barcode is given as coordinates in R^{num_parameters} instead of coordinates w.r.t. the line.

Parameters:
  • sm (tuple[ndarray, ndarray])

  • basepoint (ndarray)

  • direction (ndarray | None)

multipers.point_measure.clean_signed_measure(signatures, args, kwargs, defaults, _fused_sigindex={})

File: multipers/point_measure.pyx (starting at line 113)

Sum the diracs at the same locations. i.e., returns the minimal sized measure to represent the input. Mostly useful for, e.g., euler_characteristic from simplical complexes.

multipers.point_measure.clean_sms(sms)

File: multipers/point_measure.pyx (starting at line 136)

Sum the diracs at the same locations. i.e., returns the minimal sized measure to represent the input. Mostly useful for, e.g., euler_characteristic from simplical complexes.

multipers.point_measure.estimate_rank_from_rank_sm(sm: tuple, a, b) int

File: multipers/point_measure.pyx (starting at line 249)

Given a rank signed measure (sm) and two points (a) and (b), estimates the rank between these two points.

Parameters:

sm (tuple)

Return type:

int

multipers.point_measure.integrate_measure(signatures, args, kwargs, defaults, _fused_sigindex={})

File: multipers/point_measure.pyx (starting at line 32)

Integrate a point measure on a grid. Measure is a sum of diracs, based on points pts and weights weights. For instance, if the signed measure comes from the hilbert signed measure, this integration will return the hilbert function on this grid.

  • pts : array of points (num_pts, D)

  • weights : array of weights (num_pts,)

  • filtration_grid (optional) : list of 1d arrays

  • resolution : int or list of int

  • return_grid : return the grid of the measure

  • **get_fitration_kwargsarguments to compute the grid,

    if the grid is not given.

multipers.point_measure.integrate_measure_python(pts, weights, filtrations)

File: multipers/point_measure.pyx (starting at line 83)

multipers.point_measure.sparsify(x)

File: multipers/point_measure.pyx (starting at line 94)

Given an arbitrary dimensional numpy array, returns (coordinates,data). – cost : scipy sparse + num_points*num_parameters^2 divisions

multipers.point_measure.zero_out_sm(pts, weights, mass_default)

File: multipers/point_measure.pyx (starting at line 144)

Zeros out the modules outside of

$ { xin mathbb R^n mid x le mathrm{mass_default}} $.

multipers.point_measure.zero_out_sms(sms, mass_default)

File: multipers/point_measure.pyx (starting at line 173)

Zeros out the modules outside of

$ { xin mathbb R^n mid x le mathrm{mass_default}} $.

multipers.simplex_tree_multi module

File: multipers/simplex_tree_multi.pyx (starting at line 5)

multipers.simplex_tree_multi.SimplexTreeMulti(input=None, num_parameters: int = 2, dtype: type = np.float64, kcritical: bool = False, **kwargs) SimplexTreeMulti_type

File: multipers/simplex_tree_multi.pyx (starting at line 4749) SimplexTreeMulti constructor.

param other:

If other is None (default value), an empty SimplexTreeMulti is created. If other is a SimplexTree, the SimplexTreeMulti is constructed from a deep copy of other. If other is a SimplexTreeMulti, the SimplexTreeMulti is constructed from a deep copy of other.

type other:

SimplexTree or SimplexTreeMulti (Optional)

param num_parameters:

The number of parameter of the multi-parameter filtration.

type num_parameters:

int

returns:

An empty or a copy simplex tree.

rtype:

SimplexTreeMulti

raises TypeError:

In case other is neither None, nor a SimplexTree, nor a SimplexTreeMulti.

Parameters:

dtype (type)

Return type:

SimplexTreeMulti_KFi32 | SimplexTreeMulti_Fi32 | SimplexTreeMulti_KFf64 | SimplexTreeMulti_Ff64

class multipers.simplex_tree_multi.SimplexTreeMulti_Ff64

Bases: object

File: multipers/simplex_tree_multi.pyx (starting at line 3403) The simplex tree is an efficient and flexible data structure for

representing general (filtered) simplicial complexes. The data structure is described in Jean-Daniel Boissonnat and Clément Maria. The Simplex Tree: An Efficient Data Structure for General Simplicial Complexes. Algorithmica, pages 1–22, 2014.

This class is a multi-filtered, with keys, and non contiguous vertices version of the simplex tree.

_get_filtration_values(self, degrees: vector[int], inf_to_nan: bool = False, return_raw: bool = False) Iterable[np.ndarray]

File: multipers/simplex_tree_multi.pyx (starting at line 4375)

Parameters:

inf_to_nan (bool)

Return type:

Iterable[ndarray]

_is_function_simplextree

_is_function_simplextree: bool File: multipers/simplex_tree_multi.pyx (starting at line 3416)

_to_scc(self, filtration_dtype=np.float64, flattened: bool = False)

File: multipers/simplex_tree_multi.pyx (starting at line 4222)

Turns a simplextree into a (simplicial) module presentation.

assign_all(self, filtration_values) SimplexTreeMulti_Ff64

File: multipers/simplex_tree_multi.pyx (starting at line 3761)

Updates the filtration values of all of the simplices, with filtration_values with order given by the simplextree iterator, e.g. self.get_simplices().

Return type:

SimplexTreeMulti_Ff64

assign_batch_filtration

File: multipers/simplex_tree_multi.pyx (starting at line 3790) Assign k-simplices given by a sparse array in a format similar

to torch.sparse. The n-th simplex has vertices vertex_array[0,n], …, vertex_array[k,n] and filtration value filtrations[n,num_parameters]. /!Only compatible with 1-critical filtrations. If a simplex is repeated, only one filtration value will be taken into account.

param vertex_array:

the k-simplices to assign.

type vertex_array:

numpy.array of shape (k+1,n)

param filtrations:

the filtration values.

type filtrations:

numpy.array of shape (n,num_parameters)

assign_filtration(self, simplex: list | np.ndarray, filtration: list | np.ndarray) SimplexTreeMulti_Ff64

File: multipers/simplex_tree_multi.pyx (starting at line 3512) This function assigns a new multi-critical filtration value to a

given N-simplex.

param simplex:

The N-simplex, represented by a list of vertex.

type simplex:

list of int

param filtration:

The new filtration(s) value(s), concatenated.

type filtration:

list[float] or np.ndarray[float, ndim=1]

Note

Beware that after this operation, the structure may not be a valid filtration anymore, a simplex could have a lower filtration value than one of its faces. Callers are responsible for fixing this (with more assign_filtration() or

make_filtration_non_decreasing() for instance) before calling

any function that relies on the filtration property, like persistence().

Parameters:
  • simplex (list | ndarray)

  • filtration (list | ndarray)

Return type:

SimplexTreeMulti_Ff64

collapse_edges(self, num: int = 1, max_dimension: int = 0, progress: bool = False, strong: bool = True, full: bool = False, ignore_warning: bool = False) SimplexTreeMulti_Ff64

File: multipers/simplex_tree_multi.pyx (starting at line 4116) Edge collapse for 1-critical 2-parameter clique complex (see https://arxiv.org/abs/2211.05574).

It uses the code from the github repository https://github.com/aj-alonso/filtration_domination .

max_dimension:int

Max simplicial dimension of the complex. Unless specified, keeps the same dimension.

num:int

The number of collapses to do.

strong:bool

Whether to use strong collapses or standard collapses (slower, but may remove more edges)

full:bool

Collapses the maximum number of edges if true, i.e., will do (at most) 100 strong collapses and (at most) 100 non-strong collapses afterward.

progress:bool

If true, shows the progress of the number of collapses.

  • This will destroy all of the k-simplices, with k>=2. Be sure to use this with a clique complex, if you want to preserve the homology >= dimension 1.

  • This is for 1 critical simplices, with 2 parameter persistence.

self:SimplexTreeMulti

A (smaller) simplex tree that has the same homology over this bifiltration.

Return type:

SimplexTreeMulti_Ff64

copy(self) SimplexTreeMulti_Ff64

File: multipers/simplex_tree_multi.pyx (starting at line 3486)

Returns:

A simplex tree that is a deep copy of itself.

Return type:

SimplexTreeMulti

Note:

The persistence information is not copied. If you need it in the clone, you have to call compute_persistence() on it even if you had already computed it in the original.

dimension

dimension: int This function returns the dimension of the simplicial complex.

returns:

the simplicial complex dimension.

rtype:

int

Note

This function is not constant time because it can recompute dimension if required (can be triggered by remove_maximal_simplex() or prune_above_filtration() methods).

dtype

dtype: type

euler_characteristic(self, dtype=np.float64)

File: multipers/simplex_tree_multi.pyx (starting at line 3826) This function returns a generator with simplices and their given

filtration values.

returns:

The simplices.

rtype:

generator with tuples(simplex, filtration)

expansion(self, max_dim: int) SimplexTreeMulti_Ff64

File: multipers/simplex_tree_multi.pyx (starting at line 4020) Expands the simplex tree containing only its one skeleton

until dimension max_dim.

The expanded simplicial complex until dimension \(d\) attached to a graph \(G\) is the maximal simplicial complex of dimension at most \(d\) admitting the graph \(G\) as \(1\)-skeleton. The filtration value assigned to a simplex is the maximal filtration value of one of its edges.

The simplex tree must contain no simplex of dimension bigger than 1 when calling the method.

param max_dim:

The maximal dimension.

type max_dim:

int

Return type:

SimplexTreeMulti_Ff64

fill_distance_matrix(self, distance_matrix, parameter: int, node_value: float = 0) SimplexTreeMulti_Ff64

File: multipers/simplex_tree_multi.pyx (starting at line 4501)

Fills a specific parameter with a rips filtration with the given matrix.

Warning. Undefined behaviour if node_value is not finite or not

smaller or equal to min(distance_matrix).

Parameters:
  • distance_matrix: a (N,N) matrix aligned with the vertices keys, i.e.,

    distance_matrix[i,j] is the distance between simplices [i] and [j].

  • node_value: a float giving the values to the nodes in this filtration.

Returns self. The updated simplextree.

Return type:

SimplexTreeMulti_Ff64

fill_lowerstar(self, F, parameter: int) SimplexTreeMulti_Ff64

File: multipers/simplex_tree_multi.pyx (starting at line 4477) Fills the `dimension`th filtration by the lower-star filtration defined by F.

F:1d array

The density over the vertices, that induces a lowerstar filtration.

parameter:int

Which filtration parameter to fill. /!python starts at 0.

self:SimplexTreeMulti

Return type:

SimplexTreeMulti_Ff64

filtration(self, simplex: list | np.ndarray) np.ndarray

File: multipers/simplex_tree_multi.pyx (starting at line 3502) This function returns the filtration value for a given N-simplex in

this simplicial complex, or +infinity if it is not in the complex. :param simplex: The N-simplex, represented by a list of vertex. :type simplex: list of int :returns: The simplicial complex multi-critical filtration value. :rtype: numpy array of shape (-1, num_parameters)

Parameters:

simplex (list | ndarray)

Return type:

ndarray

filtration_bounds(self, degrees: Iterable[int] | None = None, q: float | tuple = 0, split_dimension: bool = False) np.ndarray

File: multipers/simplex_tree_multi.pyx (starting at line 4460)

Returns the filtrations bounds of the finite filtration values.

Parameters:
  • degrees (Iterable[int] | None)

  • q (float | tuple)

  • split_dimension (bool)

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/simplex_tree_multi.pyx (starting at line 3415)

flagify(self, dim: int = 2)

File: multipers/simplex_tree_multi.pyx (starting at line 3592)

Turns this simplicial complex into a flag complex by resetting filtration values of simplices of dimension > dim by lower-star values.

get_boundaries(self, simplex) Iterable[tuple[np.ndarray, np.ndarray]]

File: multipers/simplex_tree_multi.pyx (starting at line 3948) This function returns a generator with the boundaries of a given N-simplex.

If you do not need the filtration values, the boundary can also be obtained as itertools.combinations(simplex,len(simplex)-1).

param simplex:

The N-simplex, represented by a list of vertex.

type simplex:

list of int.

returns:

The (simplices of the) boundary of a simplex

rtype:

generator with tuples(simplex, filtration)

Return type:

Iterable[tuple[ndarray, ndarray]]

get_edge_list(self)

File: multipers/simplex_tree_multi.pyx (starting at line 4107)

in the filtration-domination’s format

get_filtration_grid(self, resolution: Iterable[int] | None = None, degrees: Iterable[int] | None = None, drop_quantiles: float | tuple = 0, grid_strategy: _available_strategies = 'exact') Iterable[np.ndarray]

File: multipers/simplex_tree_multi.pyx (starting at line 4391)

Returns a grid over the n-filtration, from the simplextree. Usefull for grid_squeeze. TODO : multicritical

Parameters

resolution: list[int]

resolution of the grid, for each parameter

box=Nonepair[list[float]]

Grid bounds. format : [low bound, high bound] If None is given, will use the filtration bounds of the simplextree.

grid_strategy=”regular”string

Either “regular”, “quantile”, or “exact”.

Returns

List of filtration values, for each parameter, defining the grid.

Parameters:
  • resolution (Iterable[int] | None)

  • degrees (Iterable[int] | None)

  • drop_quantiles (float | tuple)

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

Return type:

Iterable[ndarray]

get_simplices(self) Iterable[tuple[np.ndarray, np.ndarray]]

File: multipers/simplex_tree_multi.pyx (starting at line 3854) This function returns a generator with simplices and their given

filtration values.

returns:

The simplices.

rtype:

generator with tuples(simplex, filtration)

Return type:

Iterable[tuple[ndarray, ndarray]]

get_simplices_of_dimension(self, dim: int) np.ndarray

File: multipers/simplex_tree_multi.pyx (starting at line 4209)

Parameters:

dim (int)

Return type:

ndarray

get_skeleton(self, dimension) Iterable[tuple[np.ndarray, np.ndarray]]

File: multipers/simplex_tree_multi.pyx (starting at line 3880) This function returns a generator with the (simplices of the) skeleton of a maximum given dimension.

param dimension:

The skeleton dimension value.

type dimension:

int

returns:

The (simplices of the) skeleton of a maximum dimension.

rtype:

generator with tuples(simplex, filtration)

Return type:

Iterable[tuple[ndarray, ndarray]]

grid_squeeze(self, filtration_grid: np.ndarray | list | None = None, coordinate_values: bool = True, force=False, grid_strategy: _available_strategies = 'exact', inplace=False, **filtration_grid_kwargs)

File: multipers/simplex_tree_multi.pyx (starting at line 4425)

Fit the filtration of the simplextree to a grid.

Parameters:
  • filtration_grid (list[list[float]]) – The grid on which to squeeze. An example of grid can be given by the get_filtration_grid method.

  • coordinate_values (bool) – If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.

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

insert(self, simplex: vector[int], filtration: list | np.ndarray | None = None) bool

File: multipers/simplex_tree_multi.pyx (starting at line 3654) This function inserts the given N-simplex and its subfaces with the

given filtration value (default value is ‘0.0’). If some of those simplices are already present with a higher filtration value, their filtration value is lowered.

param simplex:

The N-simplex to insert, represented by a list of vertex.

type simplex:

list of int

param filtration:

The filtration value of the simplex.

type filtration:

float

returns:

true if the simplex was not yet in the complex, false otherwise (whatever its original filtration value).

rtype:

bool

Parameters:

filtration (list | ndarray | None)

Return type:

bool

insert_batch

File: multipers/simplex_tree_multi.pyx (starting at line 3679) Inserts k-simplices given by a sparse array in a format similar

to torch.sparse. The n-th simplex has vertices vertex_array[0,n], …, vertex_array[k,n] and filtration value filtrations[n,num_parameters]. /!Only compatible with 1-critical filtrations. If a simplex is repeated, only one filtration value will be taken into account.

param vertex_array:

the k-simplices to insert.

type vertex_array:

numpy.array of shape (k+1,n)

param filtrations:

the filtration values.

type filtrations:

numpy.array of shape (n,num_parameters)

is_kcritical

is_kcritical: bool

is_squeezed

is_squeezed: bool

key(self, simplex: list | np.ndarray)

File: multipers/simplex_tree_multi.pyx (starting at line 4211)

Parameters:

simplex (list | ndarray)

linear_projections(self, linear_forms: np.ndarray) Iterable[SimplexTree]

File: multipers/simplex_tree_multi.pyx (starting at line 4592)

Compute the 1-parameter projections, w.r.t. given the linear forms, of this simplextree.

Input

Array of shape (num_linear_forms, num_parameters)

Output

List of projected (gudhi) simplextrees.

Parameters:

linear_forms (ndarray)

Return type:

Iterable[SimplexTree]

lower_star_multi_filtration_update(self, nodes_filtrations)

File: multipers/simplex_tree_multi.pyx (starting at line 3730)

Updates the multi filtration of the simplextree to the lower-star filtration defined on the vertices, by node_filtrations.

make_filtration_non_decreasing(self) bool

File: multipers/simplex_tree_multi.pyx (starting at line 4043) This function ensures that each simplex has a higher filtration

value than its faces by increasing the filtration values.

returns:

True if any filtration value was modified, False if the filtration was already non-decreasing.

rtype:

bool

Return type:

bool

num_parameters

num_parameters: int

num_simplices

num_simplices: int This function returns the number of simplices of the simplicial

complex.

returns:

the simplicial complex number of simplices.

rtype:

int

num_vertices

num_vertices: int This function returns the number of vertices of the simplicial

complex.

returns:

The simplicial complex number of vertices.

rtype:

int

persistence_approximation(self, **kwargs)

File: multipers/simplex_tree_multi.pyx (starting at line 3875)

project_on_line(self, parameter: int = 0, basepoint: None | list | np.ndarray = None, direction: None | list | np.ndarray = None) SimplexTree

File: multipers/simplex_tree_multi.pyx (starting at line 4551) Converts an multi simplextree to a gudhi simplextree.

parameter:int = 0

The parameter to keep. WARNING will crash if the multi simplextree is not well filled.

basepoint:None

Instead of keeping a single parameter, will consider the filtration defined by the diagonal line crossing the basepoint.

There are no safeguard yet, it WILL crash if asking for a parameter that is not filled.

A SimplexTree with chosen 1D filtration.

Parameters:
  • parameter (int)

  • basepoint (None | list | ndarray)

  • direction (None | list | ndarray)

Return type:

SimplexTree

prune_above_dimension(self, dimension: int)

File: multipers/simplex_tree_multi.pyx (starting at line 4010) Remove all simplices of dimension greater than a given value.

param dimension:

Maximum dimension value.

type dimension:

int

returns:

The modification information.

rtype:

bool

pts_to_indices(self, pts: np.ndarray, simplices_dimensions: Iterable[int]) tuple[np.ndarray, np.ndarray]

File: multipers/simplex_tree_multi.pyx (starting at line 4072)

Returns the indices of the simplex tree with corresponding filtrations.

Args:
  • st: SimplexTreeMulti on which to recover the indices.

  • pts: (num_pts, num_parameters,) array of points to recover.

    simplices_dimensions: (num_parameters,) the simplices dimension to take into account for each parameter.

Returns:
  • A (m, num_parameters) array containing the found indices (m <= num_pts).

  • A (m, 2) array containing the non-found indices (pt_index, parameter failing).

Parameters:
  • pts (ndarray)

  • simplices_dimensions (Iterable[int])

Return type:

tuple[ndarray, ndarray]

remove_maximal_simplex(self, simplex) SimplexTreeMulti_Ff64

File: multipers/simplex_tree_multi.pyx (starting at line 3968) This function removes a given maximal N-simplex from the simplicial

complex.

param simplex:

The N-simplex, represented by a list of vertex.

type simplex:

list of int

Note

The dimension of the simplicial complex may be lower after calling remove_maximal_simplex than it was before. However, upper_bound_dimension() method will return the old value, which remains a valid upper bound. If you care, you can call dimension() to recompute the exact dimension.

Return type:

SimplexTreeMulti_Ff64

reset_filtration(self, filtration, min_dim=0) SimplexTreeMulti_Ff64

File: multipers/simplex_tree_multi.pyx (starting at line 4056) This function resets the filtration value of all the simplices of dimension at least min_dim. Resets all the

simplex tree when min_dim = 0. reset_filtration may break the filtration property with min_dim > 0, and it is the user’s responsibility to make it a valid filtration (using a large enough filt_value, or calling make_filtration_non_decreasing afterwards for instance).

param filtration:

New threshold value.

type filtration:

float.

param min_dim:

The minimal dimension. Default value is 0.

type min_dim:

int.

Return type:

SimplexTreeMulti_Ff64

set_dimension(self, dimension: int) None

File: multipers/simplex_tree_multi.pyx (starting at line 3616) This function sets the dimension of the simplicial complex.

param dimension:

The new dimension value.

type dimension:

int

Note

This function must be used with caution because it disables dimension recomputation when required (this recomputation can be triggered by remove_maximal_simplex() or prune_above_filtration() ).

Return type:

None

set_key(self, simplex: list | np.ndarray, key: int) None

File: multipers/simplex_tree_multi.pyx (starting at line 4216)

Parameters:
  • simplex (list | ndarray)

  • key (int)

Return type:

None

set_keys_to_enumerate(self) None

File: multipers/simplex_tree_multi.pyx (starting at line 4213)

Return type:

None

set_num_parameter(self, num: int)

File: multipers/simplex_tree_multi.pyx (starting at line 4631)

Sets the numbers of parameters. WARNING : it will resize all the filtrations to this size.

Parameters:

num (int)

thisptr

thisptr: int File: multipers/simplex_tree_multi.pyx (starting at line 3413)

to_rivet(self, path='rivet_dataset.txt', degree: int | None = None, progress: bool = False, overwrite: bool = False, xbins: int | None = None, ybins: int | None = None) None

File: multipers/simplex_tree_multi.pyx (starting at line 4326) Create a file that can be imported by rivet, representing the filtration of the simplextree.

path:str

path of the file.

degree:int

The homological degree to ask rivet to compute.

progress:bool = True

Shows the progress bar.

overwrite:bool = False

If true, will overwrite the previous file if it already exists.

Parameters:
  • degree (int | None)

  • progress (bool)

  • overwrite (bool)

  • xbins (int | None)

  • ybins (int | None)

Return type:

None

to_scc(self, **kwargs)

File: multipers/simplex_tree_multi.pyx (starting at line 4317)

Returns an scc representation of the simplextree.

to_scc_function_st(self, path='scc_dataset.scc', rivet_compatible: bool = False, strip_comments: bool = False, ignore_last_generators: bool = False, overwrite: bool = False, reverse_block: bool = True)

File: multipers/simplex_tree_multi.pyx (starting at line 4273)

to_scc_kcritical(self, path: os.PathLike | str, rivet_compatible: bool = False, strip_comments: bool = False, ignore_last_generators: bool = False, overwrite: bool = False, reverse_block: bool = False)

File: multipers/simplex_tree_multi.pyx (starting at line 4244)

TODO: function-simplextree, from squeezed

Parameters:

path (os.PathLike | str)

upper_bound_dimension(self) int

File: multipers/simplex_tree_multi.pyx (starting at line 3579) This function returns a valid dimension upper bound of the

simplicial complex.

returns:

an upper bound on the dimension of the simplicial complex.

rtype:

int

Return type:

int

class multipers.simplex_tree_multi.SimplexTreeMulti_Fi32

Bases: object

File: multipers/simplex_tree_multi.pyx (starting at line 1075) The simplex tree is an efficient and flexible data structure for

representing general (filtered) simplicial complexes. The data structure is described in Jean-Daniel Boissonnat and Clément Maria. The Simplex Tree: An Efficient Data Structure for General Simplicial Complexes. Algorithmica, pages 1–22, 2014.

This class is a multi-filtered, with keys, and non contiguous vertices version of the simplex tree.

_get_filtration_values(self, degrees: vector[int], inf_to_nan: bool = False, return_raw: bool = False) Iterable[np.ndarray]

File: multipers/simplex_tree_multi.pyx (starting at line 2047)

Parameters:

inf_to_nan (bool)

Return type:

Iterable[ndarray]

_is_function_simplextree

_is_function_simplextree: bool File: multipers/simplex_tree_multi.pyx (starting at line 1088)

_to_scc(self, filtration_dtype=np.int32, flattened: bool = False)

File: multipers/simplex_tree_multi.pyx (starting at line 1894)

Turns a simplextree into a (simplicial) module presentation.

assign_all(self, filtration_values) SimplexTreeMulti_Fi32

File: multipers/simplex_tree_multi.pyx (starting at line 1433)

Updates the filtration values of all of the simplices, with filtration_values with order given by the simplextree iterator, e.g. self.get_simplices().

Return type:

SimplexTreeMulti_Fi32

assign_batch_filtration

File: multipers/simplex_tree_multi.pyx (starting at line 1462) Assign k-simplices given by a sparse array in a format similar

to torch.sparse. The n-th simplex has vertices vertex_array[0,n], …, vertex_array[k,n] and filtration value filtrations[n,num_parameters]. /!Only compatible with 1-critical filtrations. If a simplex is repeated, only one filtration value will be taken into account.

param vertex_array:

the k-simplices to assign.

type vertex_array:

numpy.array of shape (k+1,n)

param filtrations:

the filtration values.

type filtrations:

numpy.array of shape (n,num_parameters)

assign_filtration(self, simplex: list | np.ndarray, filtration: list | np.ndarray) SimplexTreeMulti_Fi32

File: multipers/simplex_tree_multi.pyx (starting at line 1184) This function assigns a new multi-critical filtration value to a

given N-simplex.

param simplex:

The N-simplex, represented by a list of vertex.

type simplex:

list of int

param filtration:

The new filtration(s) value(s), concatenated.

type filtration:

list[float] or np.ndarray[float, ndim=1]

Note

Beware that after this operation, the structure may not be a valid filtration anymore, a simplex could have a lower filtration value than one of its faces. Callers are responsible for fixing this (with more assign_filtration() or

make_filtration_non_decreasing() for instance) before calling

any function that relies on the filtration property, like persistence().

Parameters:
  • simplex (list | ndarray)

  • filtration (list | ndarray)

Return type:

SimplexTreeMulti_Fi32

collapse_edges(self, num: int = 1, max_dimension: int = 0, progress: bool = False, strong: bool = True, full: bool = False, ignore_warning: bool = False) SimplexTreeMulti_Fi32

File: multipers/simplex_tree_multi.pyx (starting at line 1788) Edge collapse for 1-critical 2-parameter clique complex (see https://arxiv.org/abs/2211.05574).

It uses the code from the github repository https://github.com/aj-alonso/filtration_domination .

max_dimension:int

Max simplicial dimension of the complex. Unless specified, keeps the same dimension.

num:int

The number of collapses to do.

strong:bool

Whether to use strong collapses or standard collapses (slower, but may remove more edges)

full:bool

Collapses the maximum number of edges if true, i.e., will do (at most) 100 strong collapses and (at most) 100 non-strong collapses afterward.

progress:bool

If true, shows the progress of the number of collapses.

  • This will destroy all of the k-simplices, with k>=2. Be sure to use this with a clique complex, if you want to preserve the homology >= dimension 1.

  • This is for 1 critical simplices, with 2 parameter persistence.

self:SimplexTreeMulti

A (smaller) simplex tree that has the same homology over this bifiltration.

Return type:

SimplexTreeMulti_Fi32

copy(self) SimplexTreeMulti_Fi32

File: multipers/simplex_tree_multi.pyx (starting at line 1158)

Returns:

A simplex tree that is a deep copy of itself.

Return type:

SimplexTreeMulti

Note:

The persistence information is not copied. If you need it in the clone, you have to call compute_persistence() on it even if you had already computed it in the original.

dimension

dimension: int This function returns the dimension of the simplicial complex.

returns:

the simplicial complex dimension.

rtype:

int

Note

This function is not constant time because it can recompute dimension if required (can be triggered by remove_maximal_simplex() or prune_above_filtration() methods).

dtype

dtype: type

euler_characteristic(self, dtype=np.int32)

File: multipers/simplex_tree_multi.pyx (starting at line 1498) This function returns a generator with simplices and their given

filtration values.

returns:

The simplices.

rtype:

generator with tuples(simplex, filtration)

expansion(self, max_dim: int) SimplexTreeMulti_Fi32

File: multipers/simplex_tree_multi.pyx (starting at line 1692) Expands the simplex tree containing only its one skeleton

until dimension max_dim.

The expanded simplicial complex until dimension \(d\) attached to a graph \(G\) is the maximal simplicial complex of dimension at most \(d\) admitting the graph \(G\) as \(1\)-skeleton. The filtration value assigned to a simplex is the maximal filtration value of one of its edges.

The simplex tree must contain no simplex of dimension bigger than 1 when calling the method.

param max_dim:

The maximal dimension.

type max_dim:

int

Return type:

SimplexTreeMulti_Fi32

fill_distance_matrix(self, distance_matrix, parameter: int, node_value: int = 0) SimplexTreeMulti_Fi32

File: multipers/simplex_tree_multi.pyx (starting at line 2173)

Fills a specific parameter with a rips filtration with the given matrix.

Warning. Undefined behaviour if node_value is not finite or not

smaller or equal to min(distance_matrix).

Parameters:
  • distance_matrix: a (N,N) matrix aligned with the vertices keys, i.e.,

    distance_matrix[i,j] is the distance between simplices [i] and [j].

  • node_value: a float giving the values to the nodes in this filtration.

Returns self. The updated simplextree.

Return type:

SimplexTreeMulti_Fi32

fill_lowerstar(self, F, parameter: int) SimplexTreeMulti_Fi32

File: multipers/simplex_tree_multi.pyx (starting at line 2149) Fills the `dimension`th filtration by the lower-star filtration defined by F.

F:1d array

The density over the vertices, that induces a lowerstar filtration.

parameter:int

Which filtration parameter to fill. /!python starts at 0.

self:SimplexTreeMulti

Return type:

SimplexTreeMulti_Fi32

filtration(self, simplex: list | np.ndarray) np.ndarray

File: multipers/simplex_tree_multi.pyx (starting at line 1174) This function returns the filtration value for a given N-simplex in

this simplicial complex, or +infinity if it is not in the complex. :param simplex: The N-simplex, represented by a list of vertex. :type simplex: list of int :returns: The simplicial complex multi-critical filtration value. :rtype: numpy array of shape (-1, num_parameters)

Parameters:

simplex (list | ndarray)

Return type:

ndarray

filtration_bounds(self, degrees: Iterable[int] | None = None, q: float | tuple = 0, split_dimension: bool = False) np.ndarray

File: multipers/simplex_tree_multi.pyx (starting at line 2132)

Returns the filtrations bounds of the finite filtration values.

Parameters:
  • degrees (Iterable[int] | None)

  • q (float | tuple)

  • split_dimension (bool)

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/simplex_tree_multi.pyx (starting at line 1087)

flagify(self, dim: int = 2)

File: multipers/simplex_tree_multi.pyx (starting at line 1264)

Turns this simplicial complex into a flag complex by resetting filtration values of simplices of dimension > dim by lower-star values.

get_boundaries(self, simplex) Iterable[tuple[np.ndarray, np.ndarray]]

File: multipers/simplex_tree_multi.pyx (starting at line 1620) This function returns a generator with the boundaries of a given N-simplex.

If you do not need the filtration values, the boundary can also be obtained as itertools.combinations(simplex,len(simplex)-1).

param simplex:

The N-simplex, represented by a list of vertex.

type simplex:

list of int.

returns:

The (simplices of the) boundary of a simplex

rtype:

generator with tuples(simplex, filtration)

Return type:

Iterable[tuple[ndarray, ndarray]]

get_edge_list(self)

File: multipers/simplex_tree_multi.pyx (starting at line 1779)

in the filtration-domination’s format

get_filtration_grid(self, resolution: Iterable[int] | None = None, degrees: Iterable[int] | None = None, drop_quantiles: float | tuple = 0, grid_strategy: _available_strategies = 'exact') Iterable[np.ndarray]

File: multipers/simplex_tree_multi.pyx (starting at line 2063)

Returns a grid over the n-filtration, from the simplextree. Usefull for grid_squeeze. TODO : multicritical

Parameters

resolution: list[int]

resolution of the grid, for each parameter

box=Nonepair[list[float]]

Grid bounds. format : [low bound, high bound] If None is given, will use the filtration bounds of the simplextree.

grid_strategy=”regular”string

Either “regular”, “quantile”, or “exact”.

Returns

List of filtration values, for each parameter, defining the grid.

Parameters:
  • resolution (Iterable[int] | None)

  • degrees (Iterable[int] | None)

  • drop_quantiles (float | tuple)

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

Return type:

Iterable[ndarray]

get_simplices(self) Iterable[tuple[np.ndarray, np.ndarray]]

File: multipers/simplex_tree_multi.pyx (starting at line 1526) This function returns a generator with simplices and their given

filtration values.

returns:

The simplices.

rtype:

generator with tuples(simplex, filtration)

Return type:

Iterable[tuple[ndarray, ndarray]]

get_simplices_of_dimension(self, dim: int) np.ndarray

File: multipers/simplex_tree_multi.pyx (starting at line 1881)

Parameters:

dim (int)

Return type:

ndarray

get_skeleton(self, dimension) Iterable[tuple[np.ndarray, np.ndarray]]

File: multipers/simplex_tree_multi.pyx (starting at line 1552) This function returns a generator with the (simplices of the) skeleton of a maximum given dimension.

param dimension:

The skeleton dimension value.

type dimension:

int

returns:

The (simplices of the) skeleton of a maximum dimension.

rtype:

generator with tuples(simplex, filtration)

Return type:

Iterable[tuple[ndarray, ndarray]]

grid_squeeze(self, filtration_grid: np.ndarray | list | None = None, coordinate_values: bool = True, force=False, grid_strategy: _available_strategies = 'exact', inplace=False, **filtration_grid_kwargs)

File: multipers/simplex_tree_multi.pyx (starting at line 2097)

Fit the filtration of the simplextree to a grid.

Parameters:
  • filtration_grid (list[list[float]]) – The grid on which to squeeze. An example of grid can be given by the get_filtration_grid method.

  • coordinate_values (bool) – If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.

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

insert(self, simplex: vector[int], filtration: list | np.ndarray | None = None) bool

File: multipers/simplex_tree_multi.pyx (starting at line 1326) This function inserts the given N-simplex and its subfaces with the

given filtration value (default value is ‘0.0’). If some of those simplices are already present with a higher filtration value, their filtration value is lowered.

param simplex:

The N-simplex to insert, represented by a list of vertex.

type simplex:

list of int

param filtration:

The filtration value of the simplex.

type filtration:

float

returns:

true if the simplex was not yet in the complex, false otherwise (whatever its original filtration value).

rtype:

bool

Parameters:

filtration (list | ndarray | None)

Return type:

bool

insert_batch

File: multipers/simplex_tree_multi.pyx (starting at line 1351) Inserts k-simplices given by a sparse array in a format similar

to torch.sparse. The n-th simplex has vertices vertex_array[0,n], …, vertex_array[k,n] and filtration value filtrations[n,num_parameters]. /!Only compatible with 1-critical filtrations. If a simplex is repeated, only one filtration value will be taken into account.

param vertex_array:

the k-simplices to insert.

type vertex_array:

numpy.array of shape (k+1,n)

param filtrations:

the filtration values.

type filtrations:

numpy.array of shape (n,num_parameters)

is_kcritical

is_kcritical: bool

is_squeezed

is_squeezed: bool

key(self, simplex: list | np.ndarray)

File: multipers/simplex_tree_multi.pyx (starting at line 1883)

Parameters:

simplex (list | ndarray)

linear_projections(self, linear_forms: np.ndarray) Iterable[SimplexTree]

File: multipers/simplex_tree_multi.pyx (starting at line 2264)

Compute the 1-parameter projections, w.r.t. given the linear forms, of this simplextree.

Input

Array of shape (num_linear_forms, num_parameters)

Output

List of projected (gudhi) simplextrees.

Parameters:

linear_forms (ndarray)

Return type:

Iterable[SimplexTree]

lower_star_multi_filtration_update(self, nodes_filtrations)

File: multipers/simplex_tree_multi.pyx (starting at line 1402)

Updates the multi filtration of the simplextree to the lower-star filtration defined on the vertices, by node_filtrations.

make_filtration_non_decreasing(self) bool

File: multipers/simplex_tree_multi.pyx (starting at line 1715) This function ensures that each simplex has a higher filtration

value than its faces by increasing the filtration values.

returns:

True if any filtration value was modified, False if the filtration was already non-decreasing.

rtype:

bool

Return type:

bool

num_parameters

num_parameters: int

num_simplices

num_simplices: int This function returns the number of simplices of the simplicial

complex.

returns:

the simplicial complex number of simplices.

rtype:

int

num_vertices

num_vertices: int This function returns the number of vertices of the simplicial

complex.

returns:

The simplicial complex number of vertices.

rtype:

int

persistence_approximation(self, **kwargs)

File: multipers/simplex_tree_multi.pyx (starting at line 1547)

project_on_line(self, parameter: int = 0, basepoint: None | list | np.ndarray = None, direction: None | list | np.ndarray = None) SimplexTree

File: multipers/simplex_tree_multi.pyx (starting at line 2223) Converts an multi simplextree to a gudhi simplextree.

parameter:int = 0

The parameter to keep. WARNING will crash if the multi simplextree is not well filled.

basepoint:None

Instead of keeping a single parameter, will consider the filtration defined by the diagonal line crossing the basepoint.

There are no safeguard yet, it WILL crash if asking for a parameter that is not filled.

A SimplexTree with chosen 1D filtration.

Parameters:
  • parameter (int)

  • basepoint (None | list | ndarray)

  • direction (None | list | ndarray)

Return type:

SimplexTree

prune_above_dimension(self, dimension: int)

File: multipers/simplex_tree_multi.pyx (starting at line 1682) Remove all simplices of dimension greater than a given value.

param dimension:

Maximum dimension value.

type dimension:

int

returns:

The modification information.

rtype:

bool

pts_to_indices(self, pts: np.ndarray, simplices_dimensions: Iterable[int]) tuple[np.ndarray, np.ndarray]

File: multipers/simplex_tree_multi.pyx (starting at line 1744)

Returns the indices of the simplex tree with corresponding filtrations.

Args:
  • st: SimplexTreeMulti on which to recover the indices.

  • pts: (num_pts, num_parameters,) array of points to recover.

    simplices_dimensions: (num_parameters,) the simplices dimension to take into account for each parameter.

Returns:
  • A (m, num_parameters) array containing the found indices (m <= num_pts).

  • A (m, 2) array containing the non-found indices (pt_index, parameter failing).

Parameters:
  • pts (ndarray)

  • simplices_dimensions (Iterable[int])

Return type:

tuple[ndarray, ndarray]

remove_maximal_simplex(self, simplex) SimplexTreeMulti_Fi32

File: multipers/simplex_tree_multi.pyx (starting at line 1640) This function removes a given maximal N-simplex from the simplicial

complex.

param simplex:

The N-simplex, represented by a list of vertex.

type simplex:

list of int

Note

The dimension of the simplicial complex may be lower after calling remove_maximal_simplex than it was before. However, upper_bound_dimension() method will return the old value, which remains a valid upper bound. If you care, you can call dimension() to recompute the exact dimension.

Return type:

SimplexTreeMulti_Fi32

reset_filtration(self, filtration, min_dim=0) SimplexTreeMulti_Fi32

File: multipers/simplex_tree_multi.pyx (starting at line 1728) This function resets the filtration value of all the simplices of dimension at least min_dim. Resets all the

simplex tree when min_dim = 0. reset_filtration may break the filtration property with min_dim > 0, and it is the user’s responsibility to make it a valid filtration (using a large enough filt_value, or calling make_filtration_non_decreasing afterwards for instance).

param filtration:

New threshold value.

type filtration:

float.

param min_dim:

The minimal dimension. Default value is 0.

type min_dim:

int.

Return type:

SimplexTreeMulti_Fi32

set_dimension(self, dimension: int) None

File: multipers/simplex_tree_multi.pyx (starting at line 1288) This function sets the dimension of the simplicial complex.

param dimension:

The new dimension value.

type dimension:

int

Note

This function must be used with caution because it disables dimension recomputation when required (this recomputation can be triggered by remove_maximal_simplex() or prune_above_filtration() ).

Return type:

None

set_key(self, simplex: list | np.ndarray, key: int) None

File: multipers/simplex_tree_multi.pyx (starting at line 1888)

Parameters:
  • simplex (list | ndarray)

  • key (int)

Return type:

None

set_keys_to_enumerate(self) None

File: multipers/simplex_tree_multi.pyx (starting at line 1885)

Return type:

None

set_num_parameter(self, num: int)

File: multipers/simplex_tree_multi.pyx (starting at line 2303)

Sets the numbers of parameters. WARNING : it will resize all the filtrations to this size.

Parameters:

num (int)

thisptr

thisptr: int File: multipers/simplex_tree_multi.pyx (starting at line 1085)

to_rivet(self, path='rivet_dataset.txt', degree: int | None = None, progress: bool = False, overwrite: bool = False, xbins: int | None = None, ybins: int | None = None) None

File: multipers/simplex_tree_multi.pyx (starting at line 1998) Create a file that can be imported by rivet, representing the filtration of the simplextree.

path:str

path of the file.

degree:int

The homological degree to ask rivet to compute.

progress:bool = True

Shows the progress bar.

overwrite:bool = False

If true, will overwrite the previous file if it already exists.

Parameters:
  • degree (int | None)

  • progress (bool)

  • overwrite (bool)

  • xbins (int | None)

  • ybins (int | None)

Return type:

None

to_scc(self, **kwargs)

File: multipers/simplex_tree_multi.pyx (starting at line 1989)

Returns an scc representation of the simplextree.

to_scc_function_st(self, path='scc_dataset.scc', rivet_compatible: bool = False, strip_comments: bool = False, ignore_last_generators: bool = False, overwrite: bool = False, reverse_block: bool = True)

File: multipers/simplex_tree_multi.pyx (starting at line 1945)

to_scc_kcritical(self, path: os.PathLike | str, rivet_compatible: bool = False, strip_comments: bool = False, ignore_last_generators: bool = False, overwrite: bool = False, reverse_block: bool = False)

File: multipers/simplex_tree_multi.pyx (starting at line 1916)

TODO: function-simplextree, from squeezed

Parameters:

path (os.PathLike | str)

upper_bound_dimension(self) int

File: multipers/simplex_tree_multi.pyx (starting at line 1251) This function returns a valid dimension upper bound of the

simplicial complex.

returns:

an upper bound on the dimension of the simplicial complex.

rtype:

int

Return type:

int

class multipers.simplex_tree_multi.SimplexTreeMulti_KFf64

Bases: object

File: multipers/simplex_tree_multi.pyx (starting at line 2402) The simplex tree is an efficient and flexible data structure for

representing general (filtered) simplicial complexes. The data structure is described in Jean-Daniel Boissonnat and Clément Maria. The Simplex Tree: An Efficient Data Structure for General Simplicial Complexes. Algorithmica, pages 1–22, 2014.

This class is a multi-filtered, with keys, and non contiguous vertices version of the simplex tree.

_get_filtration_values(self, degrees: vector[int], inf_to_nan: bool = False, return_raw: bool = False) Iterable[np.ndarray]

File: multipers/simplex_tree_multi.pyx (starting at line 3046)

Parameters:

inf_to_nan (bool)

Return type:

Iterable[ndarray]

_is_function_simplextree

_is_function_simplextree: bool File: multipers/simplex_tree_multi.pyx (starting at line 2415)

_to_scc(self, filtration_dtype=np.float64, flattened: bool = False)

File: multipers/simplex_tree_multi.pyx (starting at line 2893)

Turns a simplextree into a (simplicial) module presentation.

assign_filtration(self, simplex: list | np.ndarray, filtration: list | np.ndarray) SimplexTreeMulti_KFf64

File: multipers/simplex_tree_multi.pyx (starting at line 2511) This function assigns a new multi-critical filtration value to a

given N-simplex.

param simplex:

The N-simplex, represented by a list of vertex.

type simplex:

list of int

param filtration:

The new filtration(s) value(s), concatenated.

type filtration:

list[float] or np.ndarray[float, ndim=1]

Note

Beware that after this operation, the structure may not be a valid filtration anymore, a simplex could have a lower filtration value than one of its faces. Callers are responsible for fixing this (with more assign_filtration() or

make_filtration_non_decreasing() for instance) before calling

any function that relies on the filtration property, like persistence().

Parameters:
  • simplex (list | ndarray)

  • filtration (list | ndarray)

Return type:

SimplexTreeMulti_KFf64

copy(self) SimplexTreeMulti_KFf64

File: multipers/simplex_tree_multi.pyx (starting at line 2485)

Returns:

A simplex tree that is a deep copy of itself.

Return type:

SimplexTreeMulti

Note:

The persistence information is not copied. If you need it in the clone, you have to call compute_persistence() on it even if you had already computed it in the original.

dimension

dimension: int This function returns the dimension of the simplicial complex.

returns:

the simplicial complex dimension.

rtype:

int

Note

This function is not constant time because it can recompute dimension if required (can be triggered by remove_maximal_simplex() or prune_above_filtration() methods).

dtype

dtype: type

fill_distance_matrix(self, distance_matrix, parameter: int, node_value: float = 0) SimplexTreeMulti_KFf64

File: multipers/simplex_tree_multi.pyx (starting at line 3172)

Fills a specific parameter with a rips filtration with the given matrix.

Warning. Undefined behaviour if node_value is not finite or not

smaller or equal to min(distance_matrix).

Parameters:
  • distance_matrix: a (N,N) matrix aligned with the vertices keys, i.e.,

    distance_matrix[i,j] is the distance between simplices [i] and [j].

  • node_value: a float giving the values to the nodes in this filtration.

Returns self. The updated simplextree.

Return type:

SimplexTreeMulti_KFf64

fill_lowerstar(self, F, parameter: int) SimplexTreeMulti_KFf64

File: multipers/simplex_tree_multi.pyx (starting at line 3148) Fills the `dimension`th filtration by the lower-star filtration defined by F.

F:1d array

The density over the vertices, that induces a lowerstar filtration.

parameter:int

Which filtration parameter to fill. /!python starts at 0.

self:SimplexTreeMulti

Return type:

SimplexTreeMulti_KFf64

filtration(self, simplex: list | np.ndarray) np.ndarray

File: multipers/simplex_tree_multi.pyx (starting at line 2501) This function returns the filtration value for a given N-simplex in

this simplicial complex, or +infinity if it is not in the complex. :param simplex: The N-simplex, represented by a list of vertex. :type simplex: list of int :returns: The simplicial complex multi-critical filtration value. :rtype: numpy array of shape (-1, num_parameters)

Parameters:

simplex (list | ndarray)

Return type:

ndarray

filtration_bounds(self, degrees: Iterable[int] | None = None, q: float | tuple = 0, split_dimension: bool = False) np.ndarray

File: multipers/simplex_tree_multi.pyx (starting at line 3131)

Returns the filtrations bounds of the finite filtration values.

Parameters:
  • degrees (Iterable[int] | None)

  • q (float | tuple)

  • split_dimension (bool)

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/simplex_tree_multi.pyx (starting at line 2414)

flagify(self, dim: int = 2)

File: multipers/simplex_tree_multi.pyx (starting at line 2591)

Turns this simplicial complex into a flag complex by resetting filtration values of simplices of dimension > dim by lower-star values.

get_boundaries(self, simplex) Iterable[tuple[np.ndarray, np.ndarray]]

File: multipers/simplex_tree_multi.pyx (starting at line 2787) This function returns a generator with the boundaries of a given N-simplex.

If you do not need the filtration values, the boundary can also be obtained as itertools.combinations(simplex,len(simplex)-1).

param simplex:

The N-simplex, represented by a list of vertex.

type simplex:

list of int.

returns:

The (simplices of the) boundary of a simplex

rtype:

generator with tuples(simplex, filtration)

Return type:

Iterable[tuple[ndarray, ndarray]]

get_filtration_grid(self, resolution: Iterable[int] | None = None, degrees: Iterable[int] | None = None, drop_quantiles: float | tuple = 0, grid_strategy: _available_strategies = 'exact') Iterable[np.ndarray]

File: multipers/simplex_tree_multi.pyx (starting at line 3062)

Returns a grid over the n-filtration, from the simplextree. Usefull for grid_squeeze. TODO : multicritical

Parameters

resolution: list[int]

resolution of the grid, for each parameter

box=Nonepair[list[float]]

Grid bounds. format : [low bound, high bound] If None is given, will use the filtration bounds of the simplextree.

grid_strategy=”regular”string

Either “regular”, “quantile”, or “exact”.

Returns

List of filtration values, for each parameter, defining the grid.

Parameters:
  • resolution (Iterable[int] | None)

  • degrees (Iterable[int] | None)

  • drop_quantiles (float | tuple)

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

Return type:

Iterable[ndarray]

get_simplices(self) Iterable[tuple[np.ndarray, np.ndarray]]

File: multipers/simplex_tree_multi.pyx (starting at line 2693) This function returns a generator with simplices and their given

filtration values.

returns:

The simplices.

rtype:

generator with tuples(simplex, filtration)

Return type:

Iterable[tuple[ndarray, ndarray]]

get_simplices_of_dimension(self, dim: int) np.ndarray

File: multipers/simplex_tree_multi.pyx (starting at line 2880)

Parameters:

dim (int)

Return type:

ndarray

get_skeleton(self, dimension) Iterable[tuple[np.ndarray, np.ndarray]]

File: multipers/simplex_tree_multi.pyx (starting at line 2719) This function returns a generator with the (simplices of the) skeleton of a maximum given dimension.

param dimension:

The skeleton dimension value.

type dimension:

int

returns:

The (simplices of the) skeleton of a maximum dimension.

rtype:

generator with tuples(simplex, filtration)

Return type:

Iterable[tuple[ndarray, ndarray]]

grid_squeeze(self, filtration_grid: np.ndarray | list | None = None, coordinate_values: bool = True, force=False, grid_strategy: _available_strategies = 'exact', inplace=False, **filtration_grid_kwargs)

File: multipers/simplex_tree_multi.pyx (starting at line 3096)

Fit the filtration of the simplextree to a grid.

Parameters:
  • filtration_grid (list[list[float]]) – The grid on which to squeeze. An example of grid can be given by the get_filtration_grid method.

  • coordinate_values (bool) – If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.

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

insert(self, simplex: vector[int], filtration: list | np.ndarray | None = None) bool

File: multipers/simplex_tree_multi.pyx (starting at line 2653) This function inserts the given N-simplex and its subfaces with the

given filtration value (default value is ‘0.0’). If some of those simplices are already present with a higher filtration value, their filtration value is lowered.

param simplex:

The N-simplex to insert, represented by a list of vertex.

type simplex:

list of int

param filtration:

The filtration value of the simplex.

type filtration:

float

returns:

true if the simplex was not yet in the complex, false otherwise (whatever its original filtration value).

rtype:

bool

Parameters:

filtration (list | ndarray | None)

Return type:

bool

is_kcritical

is_kcritical: bool

is_squeezed

is_squeezed: bool

key(self, simplex: list | np.ndarray)

File: multipers/simplex_tree_multi.pyx (starting at line 2882)

Parameters:

simplex (list | ndarray)

linear_projections(self, linear_forms: np.ndarray) Iterable[SimplexTree]

File: multipers/simplex_tree_multi.pyx (starting at line 3265)

Compute the 1-parameter projections, w.r.t. given the linear forms, of this simplextree.

Input

Array of shape (num_linear_forms, num_parameters)

Output

List of projected (gudhi) simplextrees.

Parameters:

linear_forms (ndarray)

Return type:

Iterable[SimplexTree]

num_parameters

num_parameters: int

num_simplices

num_simplices: int This function returns the number of simplices of the simplicial

complex.

returns:

the simplicial complex number of simplices.

rtype:

int

num_vertices

num_vertices: int This function returns the number of vertices of the simplicial

complex.

returns:

The simplicial complex number of vertices.

rtype:

int

persistence_approximation(self, **kwargs)

File: multipers/simplex_tree_multi.pyx (starting at line 2714)

project_on_line(self, parameter: int = 0, basepoint: None | list | np.ndarray = None, direction: None | list | np.ndarray = None) SimplexTree

File: multipers/simplex_tree_multi.pyx (starting at line 3224) Converts an multi simplextree to a gudhi simplextree.

parameter:int = 0

The parameter to keep. WARNING will crash if the multi simplextree is not well filled.

basepoint:None

Instead of keeping a single parameter, will consider the filtration defined by the diagonal line crossing the basepoint.

There are no safeguard yet, it WILL crash if asking for a parameter that is not filled.

A SimplexTree with chosen 1D filtration.

Parameters:
  • parameter (int)

  • basepoint (None | list | ndarray)

  • direction (None | list | ndarray)

Return type:

SimplexTree

prune_above_dimension(self, dimension: int)

File: multipers/simplex_tree_multi.pyx (starting at line 2849) Remove all simplices of dimension greater than a given value.

param dimension:

Maximum dimension value.

type dimension:

int

returns:

The modification information.

rtype:

bool

remove_maximal_simplex(self, simplex) SimplexTreeMulti_KFf64

File: multipers/simplex_tree_multi.pyx (starting at line 2807) This function removes a given maximal N-simplex from the simplicial

complex.

param simplex:

The N-simplex, represented by a list of vertex.

type simplex:

list of int

Note

The dimension of the simplicial complex may be lower after calling remove_maximal_simplex than it was before. However, upper_bound_dimension() method will return the old value, which remains a valid upper bound. If you care, you can call dimension() to recompute the exact dimension.

Return type:

SimplexTreeMulti_KFf64

reset_filtration(self, filtration, min_dim=0) SimplexTreeMulti_KFf64

File: multipers/simplex_tree_multi.pyx (starting at line 2860) This function resets the filtration value of all the simplices of dimension at least min_dim. Resets all the

simplex tree when min_dim = 0. reset_filtration may break the filtration property with min_dim > 0, and it is the user’s responsibility to make it a valid filtration (using a large enough filt_value, or calling make_filtration_non_decreasing afterwards for instance).

param filtration:

New threshold value.

type filtration:

float.

param min_dim:

The minimal dimension. Default value is 0.

type min_dim:

int.

Return type:

SimplexTreeMulti_KFf64

set_dimension(self, dimension: int) None

File: multipers/simplex_tree_multi.pyx (starting at line 2615) This function sets the dimension of the simplicial complex.

param dimension:

The new dimension value.

type dimension:

int

Note

This function must be used with caution because it disables dimension recomputation when required (this recomputation can be triggered by remove_maximal_simplex() or prune_above_filtration() ).

Return type:

None

set_key(self, simplex: list | np.ndarray, key: int) None

File: multipers/simplex_tree_multi.pyx (starting at line 2887)

Parameters:
  • simplex (list | ndarray)

  • key (int)

Return type:

None

set_keys_to_enumerate(self) None

File: multipers/simplex_tree_multi.pyx (starting at line 2884)

Return type:

None

set_num_parameter(self, num: int)

File: multipers/simplex_tree_multi.pyx (starting at line 3304)

Sets the numbers of parameters. WARNING : it will resize all the filtrations to this size.

Parameters:

num (int)

thisptr

thisptr: int File: multipers/simplex_tree_multi.pyx (starting at line 2412)

to_rivet(self, path='rivet_dataset.txt', degree: int | None = None, progress: bool = False, overwrite: bool = False, xbins: int | None = None, ybins: int | None = None) None

File: multipers/simplex_tree_multi.pyx (starting at line 2997) Create a file that can be imported by rivet, representing the filtration of the simplextree.

path:str

path of the file.

degree:int

The homological degree to ask rivet to compute.

progress:bool = True

Shows the progress bar.

overwrite:bool = False

If true, will overwrite the previous file if it already exists.

Parameters:
  • degree (int | None)

  • progress (bool)

  • overwrite (bool)

  • xbins (int | None)

  • ybins (int | None)

Return type:

None

to_scc(self, **kwargs)

File: multipers/simplex_tree_multi.pyx (starting at line 2988)

Returns an scc representation of the simplextree.

to_scc_function_st(self, path='scc_dataset.scc', rivet_compatible: bool = False, strip_comments: bool = False, ignore_last_generators: bool = False, overwrite: bool = False, reverse_block: bool = True)

File: multipers/simplex_tree_multi.pyx (starting at line 2944)

to_scc_kcritical(self, path: os.PathLike | str, rivet_compatible: bool = False, strip_comments: bool = False, ignore_last_generators: bool = False, overwrite: bool = False, reverse_block: bool = False)

File: multipers/simplex_tree_multi.pyx (starting at line 2915)

TODO: function-simplextree, from squeezed

Parameters:

path (os.PathLike | str)

upper_bound_dimension(self) int

File: multipers/simplex_tree_multi.pyx (starting at line 2578) This function returns a valid dimension upper bound of the

simplicial complex.

returns:

an upper bound on the dimension of the simplicial complex.

rtype:

int

Return type:

int

class multipers.simplex_tree_multi.SimplexTreeMulti_KFi32

Bases: object

File: multipers/simplex_tree_multi.pyx (starting at line 74) The simplex tree is an efficient and flexible data structure for

representing general (filtered) simplicial complexes. The data structure is described in Jean-Daniel Boissonnat and Clément Maria. The Simplex Tree: An Efficient Data Structure for General Simplicial Complexes. Algorithmica, pages 1–22, 2014.

This class is a multi-filtered, with keys, and non contiguous vertices version of the simplex tree.

_get_filtration_values(self, degrees: vector[int], inf_to_nan: bool = False, return_raw: bool = False) Iterable[np.ndarray]

File: multipers/simplex_tree_multi.pyx (starting at line 718)

Parameters:

inf_to_nan (bool)

Return type:

Iterable[ndarray]

_is_function_simplextree

_is_function_simplextree: bool File: multipers/simplex_tree_multi.pyx (starting at line 87)

_to_scc(self, filtration_dtype=np.int32, flattened: bool = False)

File: multipers/simplex_tree_multi.pyx (starting at line 565)

Turns a simplextree into a (simplicial) module presentation.

assign_filtration(self, simplex: list | np.ndarray, filtration: list | np.ndarray) SimplexTreeMulti_KFi32

File: multipers/simplex_tree_multi.pyx (starting at line 183) This function assigns a new multi-critical filtration value to a

given N-simplex.

param simplex:

The N-simplex, represented by a list of vertex.

type simplex:

list of int

param filtration:

The new filtration(s) value(s), concatenated.

type filtration:

list[float] or np.ndarray[float, ndim=1]

Note

Beware that after this operation, the structure may not be a valid filtration anymore, a simplex could have a lower filtration value than one of its faces. Callers are responsible for fixing this (with more assign_filtration() or

make_filtration_non_decreasing() for instance) before calling

any function that relies on the filtration property, like persistence().

Parameters:
  • simplex (list | ndarray)

  • filtration (list | ndarray)

Return type:

SimplexTreeMulti_KFi32

copy(self) SimplexTreeMulti_KFi32

File: multipers/simplex_tree_multi.pyx (starting at line 157)

Returns:

A simplex tree that is a deep copy of itself.

Return type:

SimplexTreeMulti

Note:

The persistence information is not copied. If you need it in the clone, you have to call compute_persistence() on it even if you had already computed it in the original.

dimension

dimension: int This function returns the dimension of the simplicial complex.

returns:

the simplicial complex dimension.

rtype:

int

Note

This function is not constant time because it can recompute dimension if required (can be triggered by remove_maximal_simplex() or prune_above_filtration() methods).

dtype

dtype: type

fill_distance_matrix(self, distance_matrix, parameter: int, node_value: int = 0) SimplexTreeMulti_KFi32

File: multipers/simplex_tree_multi.pyx (starting at line 844)

Fills a specific parameter with a rips filtration with the given matrix.

Warning. Undefined behaviour if node_value is not finite or not

smaller or equal to min(distance_matrix).

Parameters:
  • distance_matrix: a (N,N) matrix aligned with the vertices keys, i.e.,

    distance_matrix[i,j] is the distance between simplices [i] and [j].

  • node_value: a float giving the values to the nodes in this filtration.

Returns self. The updated simplextree.

Return type:

SimplexTreeMulti_KFi32

fill_lowerstar(self, F, parameter: int) SimplexTreeMulti_KFi32

File: multipers/simplex_tree_multi.pyx (starting at line 820) Fills the `dimension`th filtration by the lower-star filtration defined by F.

F:1d array

The density over the vertices, that induces a lowerstar filtration.

parameter:int

Which filtration parameter to fill. /!python starts at 0.

self:SimplexTreeMulti

Return type:

SimplexTreeMulti_KFi32

filtration(self, simplex: list | np.ndarray) np.ndarray

File: multipers/simplex_tree_multi.pyx (starting at line 173) This function returns the filtration value for a given N-simplex in

this simplicial complex, or +infinity if it is not in the complex. :param simplex: The N-simplex, represented by a list of vertex. :type simplex: list of int :returns: The simplicial complex multi-critical filtration value. :rtype: numpy array of shape (-1, num_parameters)

Parameters:

simplex (list | ndarray)

Return type:

ndarray

filtration_bounds(self, degrees: Iterable[int] | None = None, q: float | tuple = 0, split_dimension: bool = False) np.ndarray

File: multipers/simplex_tree_multi.pyx (starting at line 803)

Returns the filtrations bounds of the finite filtration values.

Parameters:
  • degrees (Iterable[int] | None)

  • q (float | tuple)

  • split_dimension (bool)

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/simplex_tree_multi.pyx (starting at line 86)

flagify(self, dim: int = 2)

File: multipers/simplex_tree_multi.pyx (starting at line 263)

Turns this simplicial complex into a flag complex by resetting filtration values of simplices of dimension > dim by lower-star values.

get_boundaries(self, simplex) Iterable[tuple[np.ndarray, np.ndarray]]

File: multipers/simplex_tree_multi.pyx (starting at line 459) This function returns a generator with the boundaries of a given N-simplex.

If you do not need the filtration values, the boundary can also be obtained as itertools.combinations(simplex,len(simplex)-1).

param simplex:

The N-simplex, represented by a list of vertex.

type simplex:

list of int.

returns:

The (simplices of the) boundary of a simplex

rtype:

generator with tuples(simplex, filtration)

Return type:

Iterable[tuple[ndarray, ndarray]]

get_filtration_grid(self, resolution: Iterable[int] | None = None, degrees: Iterable[int] | None = None, drop_quantiles: float | tuple = 0, grid_strategy: _available_strategies = 'exact') Iterable[np.ndarray]

File: multipers/simplex_tree_multi.pyx (starting at line 734)

Returns a grid over the n-filtration, from the simplextree. Usefull for grid_squeeze. TODO : multicritical

Parameters

resolution: list[int]

resolution of the grid, for each parameter

box=Nonepair[list[float]]

Grid bounds. format : [low bound, high bound] If None is given, will use the filtration bounds of the simplextree.

grid_strategy=”regular”string

Either “regular”, “quantile”, or “exact”.

Returns

List of filtration values, for each parameter, defining the grid.

Parameters:
  • resolution (Iterable[int] | None)

  • degrees (Iterable[int] | None)

  • drop_quantiles (float | tuple)

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

Return type:

Iterable[ndarray]

get_simplices(self) Iterable[tuple[np.ndarray, np.ndarray]]

File: multipers/simplex_tree_multi.pyx (starting at line 365) This function returns a generator with simplices and their given

filtration values.

returns:

The simplices.

rtype:

generator with tuples(simplex, filtration)

Return type:

Iterable[tuple[ndarray, ndarray]]

get_simplices_of_dimension(self, dim: int) np.ndarray

File: multipers/simplex_tree_multi.pyx (starting at line 552)

Parameters:

dim (int)

Return type:

ndarray

get_skeleton(self, dimension) Iterable[tuple[np.ndarray, np.ndarray]]

File: multipers/simplex_tree_multi.pyx (starting at line 391) This function returns a generator with the (simplices of the) skeleton of a maximum given dimension.

param dimension:

The skeleton dimension value.

type dimension:

int

returns:

The (simplices of the) skeleton of a maximum dimension.

rtype:

generator with tuples(simplex, filtration)

Return type:

Iterable[tuple[ndarray, ndarray]]

grid_squeeze(self, filtration_grid: np.ndarray | list | None = None, coordinate_values: bool = True, force=False, grid_strategy: _available_strategies = 'exact', inplace=False, **filtration_grid_kwargs)

File: multipers/simplex_tree_multi.pyx (starting at line 768)

Fit the filtration of the simplextree to a grid.

Parameters:
  • filtration_grid (list[list[float]]) – The grid on which to squeeze. An example of grid can be given by the get_filtration_grid method.

  • coordinate_values (bool) – If true, the filtrations values of the simplices will be set to the coordinate of the filtration grid.

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

insert(self, simplex: vector[int], filtration: list | np.ndarray | None = None) bool

File: multipers/simplex_tree_multi.pyx (starting at line 325) This function inserts the given N-simplex and its subfaces with the

given filtration value (default value is ‘0.0’). If some of those simplices are already present with a higher filtration value, their filtration value is lowered.

param simplex:

The N-simplex to insert, represented by a list of vertex.

type simplex:

list of int

param filtration:

The filtration value of the simplex.

type filtration:

float

returns:

true if the simplex was not yet in the complex, false otherwise (whatever its original filtration value).

rtype:

bool

Parameters:

filtration (list | ndarray | None)

Return type:

bool

is_kcritical

is_kcritical: bool

is_squeezed

is_squeezed: bool

key(self, simplex: list | np.ndarray)

File: multipers/simplex_tree_multi.pyx (starting at line 554)

Parameters:

simplex (list | ndarray)

linear_projections(self, linear_forms: np.ndarray) Iterable[SimplexTree]

File: multipers/simplex_tree_multi.pyx (starting at line 937)

Compute the 1-parameter projections, w.r.t. given the linear forms, of this simplextree.

Input

Array of shape (num_linear_forms, num_parameters)

Output

List of projected (gudhi) simplextrees.

Parameters:

linear_forms (ndarray)

Return type:

Iterable[SimplexTree]

num_parameters

num_parameters: int

num_simplices

num_simplices: int This function returns the number of simplices of the simplicial

complex.

returns:

the simplicial complex number of simplices.

rtype:

int

num_vertices

num_vertices: int This function returns the number of vertices of the simplicial

complex.

returns:

The simplicial complex number of vertices.

rtype:

int

persistence_approximation(self, **kwargs)

File: multipers/simplex_tree_multi.pyx (starting at line 386)

project_on_line(self, parameter: int = 0, basepoint: None | list | np.ndarray = None, direction: None | list | np.ndarray = None) SimplexTree

File: multipers/simplex_tree_multi.pyx (starting at line 896) Converts an multi simplextree to a gudhi simplextree.

parameter:int = 0

The parameter to keep. WARNING will crash if the multi simplextree is not well filled.

basepoint:None

Instead of keeping a single parameter, will consider the filtration defined by the diagonal line crossing the basepoint.

There are no safeguard yet, it WILL crash if asking for a parameter that is not filled.

A SimplexTree with chosen 1D filtration.

Parameters:
  • parameter (int)

  • basepoint (None | list | ndarray)

  • direction (None | list | ndarray)

Return type:

SimplexTree

prune_above_dimension(self, dimension: int)

File: multipers/simplex_tree_multi.pyx (starting at line 521) Remove all simplices of dimension greater than a given value.

param dimension:

Maximum dimension value.

type dimension:

int

returns:

The modification information.

rtype:

bool

remove_maximal_simplex(self, simplex) SimplexTreeMulti_KFi32

File: multipers/simplex_tree_multi.pyx (starting at line 479) This function removes a given maximal N-simplex from the simplicial

complex.

param simplex:

The N-simplex, represented by a list of vertex.

type simplex:

list of int

Note

The dimension of the simplicial complex may be lower after calling remove_maximal_simplex than it was before. However, upper_bound_dimension() method will return the old value, which remains a valid upper bound. If you care, you can call dimension() to recompute the exact dimension.

Return type:

SimplexTreeMulti_KFi32

reset_filtration(self, filtration, min_dim=0) SimplexTreeMulti_KFi32

File: multipers/simplex_tree_multi.pyx (starting at line 532) This function resets the filtration value of all the simplices of dimension at least min_dim. Resets all the

simplex tree when min_dim = 0. reset_filtration may break the filtration property with min_dim > 0, and it is the user’s responsibility to make it a valid filtration (using a large enough filt_value, or calling make_filtration_non_decreasing afterwards for instance).

param filtration:

New threshold value.

type filtration:

float.

param min_dim:

The minimal dimension. Default value is 0.

type min_dim:

int.

Return type:

SimplexTreeMulti_KFi32

set_dimension(self, dimension: int) None

File: multipers/simplex_tree_multi.pyx (starting at line 287) This function sets the dimension of the simplicial complex.

param dimension:

The new dimension value.

type dimension:

int

Note

This function must be used with caution because it disables dimension recomputation when required (this recomputation can be triggered by remove_maximal_simplex() or prune_above_filtration() ).

Return type:

None

set_key(self, simplex: list | np.ndarray, key: int) None

File: multipers/simplex_tree_multi.pyx (starting at line 559)

Parameters:
  • simplex (list | ndarray)

  • key (int)

Return type:

None

set_keys_to_enumerate(self) None

File: multipers/simplex_tree_multi.pyx (starting at line 556)

Return type:

None

set_num_parameter(self, num: int)

File: multipers/simplex_tree_multi.pyx (starting at line 976)

Sets the numbers of parameters. WARNING : it will resize all the filtrations to this size.

Parameters:

num (int)

thisptr

thisptr: int File: multipers/simplex_tree_multi.pyx (starting at line 84)

to_rivet(self, path='rivet_dataset.txt', degree: int | None = None, progress: bool = False, overwrite: bool = False, xbins: int | None = None, ybins: int | None = None) None

File: multipers/simplex_tree_multi.pyx (starting at line 669) Create a file that can be imported by rivet, representing the filtration of the simplextree.

path:str

path of the file.

degree:int

The homological degree to ask rivet to compute.

progress:bool = True

Shows the progress bar.

overwrite:bool = False

If true, will overwrite the previous file if it already exists.

Parameters:
  • degree (int | None)

  • progress (bool)

  • overwrite (bool)

  • xbins (int | None)

  • ybins (int | None)

Return type:

None

to_scc(self, **kwargs)

File: multipers/simplex_tree_multi.pyx (starting at line 660)

Returns an scc representation of the simplextree.

to_scc_function_st(self, path='scc_dataset.scc', rivet_compatible: bool = False, strip_comments: bool = False, ignore_last_generators: bool = False, overwrite: bool = False, reverse_block: bool = True)

File: multipers/simplex_tree_multi.pyx (starting at line 616)

to_scc_kcritical(self, path: os.PathLike | str, rivet_compatible: bool = False, strip_comments: bool = False, ignore_last_generators: bool = False, overwrite: bool = False, reverse_block: bool = False)

File: multipers/simplex_tree_multi.pyx (starting at line 587)

TODO: function-simplextree, from squeezed

Parameters:

path (os.PathLike | str)

upper_bound_dimension(self) int

File: multipers/simplex_tree_multi.pyx (starting at line 250) This function returns a valid dimension upper bound of the

simplicial complex.

returns:

an upper bound on the dimension of the simplicial complex.

rtype:

int

Return type:

int

multipers.simplex_tree_multi._euler_signed_measure(simplextree, mass_default=None, verbose: bool = False)

File: multipers/simplex_tree_multi.pyx (starting at line 4911)

Computes the signed measures given by the decomposition of the hilbert function.

Input

  • simplextree:SimplexTreeMulti, the multifiltered simplicial complex

  • mass_default: Either None, or ‘auto’ or ‘inf’, or array-like of floats. Where to put the default mass to get a zero-mass measure.

  • plot:bool, plots the computed measures if true.

  • n_jobs:int, number of jobs. Defaults to #cpu, but when doing parallel computations of signed measures, we recommend setting this to 1.

  • verbose:bool, prints c++ logs.

Output

[signed_measure_of_degree for degree in degrees] with signed_measure_of_degree of the form (dirac location, dirac weights).

multipers.simplex_tree_multi._hilbert_signed_measure(simplextree, degrees: vector[indices_type], mass_default=None, plot=False, n_jobs: int = 0, verbose: bool = False, expand_collapse: bool = False)

File: multipers/simplex_tree_multi.pyx (starting at line 4819)

Computes the signed measures given by the decomposition of the hilbert function.

Input

  • simplextree:SimplexTreeMulti, the multifiltered simplicial complex

  • degrees:array-like of ints, the degrees to compute

  • mass_default: Either None, or ‘auto’ or ‘inf’, or array-like of floats. Where to put the default mass to get a zero-mass measure.

  • plot:bool, plots the computed measures if true.

  • n_jobs:int, number of jobs. Defaults to #cpu, but when doing parallel computations of signed measures, we recommend setting this to 1.

  • verbose:bool, prints c++ logs.

Output

[signed_measure_of_degree for degree in degrees] with signed_measure_of_degree of the form (dirac location, dirac weights).

multipers.simplex_tree_multi._rank_signed_measure(simplextree, degrees: vector[indices_type], mass_default=None, plot=False, n_jobs: int = 0, verbose: bool = False, expand_collapse: bool = False)

File: multipers/simplex_tree_multi.pyx (starting at line 5000)

Computes the signed measures given by the decomposition of the hilbert function.

Input

  • simplextree:SimplexTreeMulti, the multifiltered simplicial complex

  • degrees:array-like of ints, the degrees to compute

  • mass_default: Either None, or ‘auto’ or ‘inf’, or array-like of floats. Where to put the default mass to get a zero-mass measure.

  • plot:bool, plots the computed measures if true.

  • n_jobs:int, number of jobs. Defaults to #cpu, but when doing parallel computations of signed measures, we recommend setting this to 1.

  • verbose:bool, prints c++ logs.

Output

[signed_measure_of_degree for degree in degrees] with signed_measure_of_degree of the form (dirac location, dirac weights).

multipers.simplex_tree_multi._safe_simplextree_multify_Ff64(simplextree: SimplexTree, num_parameters: int = 2, default_values: ndarray = np.array(-np.inf)) SimplexTreeMulti_Ff64

File: multipers/simplex_tree_multi.pyx (starting at line 4674)

Parameters:

simplextree (SimplexTree)

Return type:

SimplexTreeMulti_Ff64

multipers.simplex_tree_multi._safe_simplextree_multify_Ff642(simplextree: SimplexTree, num_parameters: int = 2, default_values: ndarray = np.array(-np.inf)) SimplexTreeMulti_Ff64

File: multipers/simplex_tree_multi.pyx (starting at line 4697)

Parameters:

simplextree (SimplexTree)

Return type:

SimplexTreeMulti_Ff64

multipers.simplex_tree_multi._safe_simplextree_multify_Fi32(simplextree: SimplexTree, num_parameters: int = 2, default_values: ndarray = np.array(-np.inf)) SimplexTreeMulti_Fi32

File: multipers/simplex_tree_multi.pyx (starting at line 2346)

Parameters:

simplextree (SimplexTree)

Return type:

SimplexTreeMulti_Fi32

multipers.simplex_tree_multi._safe_simplextree_multify_Fi322(simplextree: SimplexTree, num_parameters: int = 2, default_values: ndarray = np.array(-np.inf)) SimplexTreeMulti_Fi32

File: multipers/simplex_tree_multi.pyx (starting at line 2369)

Parameters:

simplextree (SimplexTree)

Return type:

SimplexTreeMulti_Fi32

multipers.simplex_tree_multi._safe_simplextree_multify_KFf64(simplextree: SimplexTree, num_parameters: int = 2, default_values: ndarray = np.array(-np.inf)) SimplexTreeMulti_KFf64

File: multipers/simplex_tree_multi.pyx (starting at line 3347)

Parameters:

simplextree (SimplexTree)

Return type:

SimplexTreeMulti_KFf64

multipers.simplex_tree_multi._safe_simplextree_multify_KFf642(simplextree: SimplexTree, num_parameters: int = 2, default_values: ndarray = np.array(-np.inf)) SimplexTreeMulti_KFf64

File: multipers/simplex_tree_multi.pyx (starting at line 3370)

Parameters:

simplextree (SimplexTree)

Return type:

SimplexTreeMulti_KFf64

multipers.simplex_tree_multi._safe_simplextree_multify_KFi32(simplextree: SimplexTree, num_parameters: int = 2, default_values: ndarray = np.array(-np.inf)) SimplexTreeMulti_KFi32

File: multipers/simplex_tree_multi.pyx (starting at line 1019)

Parameters:

simplextree (SimplexTree)

Return type:

SimplexTreeMulti_KFi32

multipers.simplex_tree_multi._safe_simplextree_multify_KFi322(simplextree: SimplexTree, num_parameters: int = 2, default_values: ndarray = np.array(-np.inf)) SimplexTreeMulti_KFi32

File: multipers/simplex_tree_multi.pyx (starting at line 1042)

Parameters:

simplextree (SimplexTree)

Return type:

SimplexTreeMulti_KFi32

multipers.simplex_tree_multi._simplextree_multify_Ff64(simplextree: SimplexTree, num_parameters: int, default_values=[]) SimplexTreeMulti_Ff64

File: multipers/simplex_tree_multi.pyx (starting at line 4652) Converts a gudhi simplextree to a multi simplextree.

parameters:int = 2

The number of filtrations

A multi simplextree, with first filtration value being the one from the original simplextree.

Parameters:

simplextree (SimplexTree)

Return type:

SimplexTreeMulti_Ff64

multipers.simplex_tree_multi._simplextree_multify_Fi32(simplextree: SimplexTree, num_parameters: int, default_values=[]) SimplexTreeMulti_Fi32

File: multipers/simplex_tree_multi.pyx (starting at line 2324) Converts a gudhi simplextree to a multi simplextree.

parameters:int = 2

The number of filtrations

A multi simplextree, with first filtration value being the one from the original simplextree.

Parameters:

simplextree (SimplexTree)

Return type:

SimplexTreeMulti_Fi32

multipers.simplex_tree_multi._simplextree_multify_KFf64(simplextree: SimplexTree, num_parameters: int, default_values=[]) SimplexTreeMulti_KFf64

File: multipers/simplex_tree_multi.pyx (starting at line 3325) Converts a gudhi simplextree to a multi simplextree.

parameters:int = 2

The number of filtrations

A multi simplextree, with first filtration value being the one from the original simplextree.

Parameters:

simplextree (SimplexTree)

Return type:

SimplexTreeMulti_KFf64

multipers.simplex_tree_multi._simplextree_multify_KFi32(simplextree: SimplexTree, num_parameters: int, default_values=[]) SimplexTreeMulti_KFi32

File: multipers/simplex_tree_multi.pyx (starting at line 997) Converts a gudhi simplextree to a multi simplextree.

parameters:int = 2

The number of filtrations

A multi simplextree, with first filtration value being the one from the original simplextree.

Parameters:

simplextree (SimplexTree)

Return type:

SimplexTreeMulti_KFi32

multipers.simplex_tree_multi.is_simplextree_multi(input) bool

File: multipers/simplex_tree_multi.pyx (starting at line 4737)

Return type:

bool

multipers.slicer module

File: multipers/slicer.pyx (starting at line 2)

class multipers.slicer._KSlicer_GudhiCohomology0_f64

Bases: object

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 3214)

_from_ptr(self, slicer_ptr: int)

File: multipers/slicer.pyx (starting at line 3142)

static _inf_value()

File: multipers/slicer.pyx (starting at line 3133)

col_type

col_type: str

compute_persistence(self, one_filtration=None) _KSlicer_GudhiCohomology0_f64

File: multipers/slicer.pyx (starting at line 3272)

Computes the current persistence, or the persistence given by the filtration one_filtration (num_generators,).

Return type:

_KSlicer_GudhiCohomology0_f64

copy(self) _KSlicer_GudhiCohomology0_f64

File: multipers/slicer.pyx (starting at line 3184)

Returns a copy of the slicer.

Return type:

_KSlicer_GudhiCohomology0_f64

dimension

dimension: int

Returns the maximum dimension of the complex.

dtype

dtype: type

filtration_bounds(self) np.ndarray

File: multipers/slicer.pyx (starting at line 3311)

Computes the bounding box of the current multifiltration.

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/slicer.pyx (starting at line 3121)

get_barcode(self)

File: multipers/slicer.pyx (starting at line 3287)

Returns the barcode of the current 1d-persistence.

get_boundaries(self) tuple[tuple]

File: multipers/slicer.pyx (starting at line 3355)

Returns the boundaries of the generators.

Return type:

tuple[tuple]

get_dimensions(self) np.ndarray

File: multipers/slicer.pyx (starting at line 3338)

Returns the ordered dimensions of the generators.

Return type:

ndarray

get_filtration_grid(self, grid_strategy: str = 'exact', **infer_grid_kwargs)

File: multipers/slicer.pyx (starting at line 3326)

Parameters:

grid_strategy (str)

get_filtrations(self)

File: multipers/slicer.pyx (starting at line 3332)

Returns a view of the filtration values, as a list of numpy arrays.

get_filtrations_values(self) np.ndarray

File: multipers/slicer.pyx (starting at line 3319)

Returns the current filtration values of the slicer.

Return type:

ndarray

get_ptr(self)

File: multipers/slicer.pyx (starting at line 3137)

Returns a pointer to the underlying C++ slicer.

grid_squeeze(self, filtration_grid=None, grid_strategy='exact', resolution: int | None = None, coordinates: bool = True, inplace: bool = False, force: bool = False) _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64

File: multipers/slicer.pyx (starting at line 3360)

Coarsen the filtration values on a grid. This is necessary to compute some invariants.

If the filtration grid is not given, it is infered from filtration values, using the multipers.grids.compute_grid() function, whose args are

  • grid_strategy:str see multipers.grids.available_strategies. Defaults to exact.

  • resolution:int if strategy is not exact.

  • inplace:bool if true, does the operation inplace, i.e., doesn’t return a copy.

Parameters:

resolution (int | None)

Return type:

_KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64

info
is_kcritical

is_kcritical: bool

is_minpres

is_minpres: bool

is_squeezed

is_squeezed: bool

is_vine

is_vine: bool

minpres(self, degree: int = -1, degrees: list = [], backend: Literal['mpfree', '2pac'] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = False, id: str | None = None, dtype=np.float64, **minpres_kwargs) Slicer_type

File: multipers/slicer.pyx (starting at line 3389)

Computes the minimal presentation of the slicer, and returns it as a new slicer. See multipers.slicer.minimal_presentation().

Parameters:
  • backend (Literal['mpfree', '2pac'])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (str | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

minpres_degree

minpres_degree: int File: multipers/slicer.pyx (starting at line 3122)

num_generators
num_parameters
pers_backend

pers_backend: str

persistence_on_line(self, basepoint, direction=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 3221)

Computes the persistence on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

Warning: This is not parallelizable. Use persitence_on_lines.

persistence_on_lines(self, basepoints=None, directions=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 3240)

Same as persistence_on_line, but with vineyards operation between lines if self.is_vine, and in parallel otherwise.

prune_above_dimension(self, max_dimension: int) _KSlicer_GudhiCohomology0_f64

File: multipers/slicer.pyx (starting at line 3349)

Prunes the generators above a given dimension.

Return type:

_KSlicer_GudhiCohomology0_f64

push_to_line(self, basepoint, direction=None) _KSlicer_GudhiCohomology0_f64

File: multipers/slicer.pyx (starting at line 3198)

Pushes the current slicer to the line defined by a basepoint and an optional direction. If the direction is not provided, it is assumed to be diagonal.

Return type:

_KSlicer_GudhiCohomology0_f64

sliced_filtration(self, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 3292)

Computes the filtration on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

class multipers.slicer._KSlicer_GudhiCohomology0_i32

Bases: object

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 2908)

_from_ptr(self, slicer_ptr: int)

File: multipers/slicer.pyx (starting at line 2836)

static _inf_value()

File: multipers/slicer.pyx (starting at line 2827)

col_type

col_type: str

compute_persistence(self, one_filtration=None) _KSlicer_GudhiCohomology0_i32

File: multipers/slicer.pyx (starting at line 2966)

Computes the current persistence, or the persistence given by the filtration one_filtration (num_generators,).

Return type:

_KSlicer_GudhiCohomology0_i32

copy(self) _KSlicer_GudhiCohomology0_i32

File: multipers/slicer.pyx (starting at line 2878)

Returns a copy of the slicer.

Return type:

_KSlicer_GudhiCohomology0_i32

dimension

dimension: int

Returns the maximum dimension of the complex.

dtype

dtype: type

filtration_bounds(self) np.ndarray

File: multipers/slicer.pyx (starting at line 3005)

Computes the bounding box of the current multifiltration.

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/slicer.pyx (starting at line 2815)

get_barcode(self)

File: multipers/slicer.pyx (starting at line 2981)

Returns the barcode of the current 1d-persistence.

get_boundaries(self) tuple[tuple]

File: multipers/slicer.pyx (starting at line 3049)

Returns the boundaries of the generators.

Return type:

tuple[tuple]

get_dimensions(self) np.ndarray

File: multipers/slicer.pyx (starting at line 3032)

Returns the ordered dimensions of the generators.

Return type:

ndarray

get_filtration_grid(self, grid_strategy: str = 'exact', **infer_grid_kwargs)

File: multipers/slicer.pyx (starting at line 3020)

Parameters:

grid_strategy (str)

get_filtrations(self)

File: multipers/slicer.pyx (starting at line 3026)

Returns a view of the filtration values, as a list of numpy arrays.

get_filtrations_values(self) np.ndarray

File: multipers/slicer.pyx (starting at line 3013)

Returns the current filtration values of the slicer.

Return type:

ndarray

get_ptr(self)

File: multipers/slicer.pyx (starting at line 2831)

Returns a pointer to the underlying C++ slicer.

grid_squeeze(self, filtration_grid=None, grid_strategy='exact', resolution: int | None = None, coordinates: bool = True, inplace: bool = False, force: bool = False) _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_i32

File: multipers/slicer.pyx (starting at line 3054)

Coarsen the filtration values on a grid. This is necessary to compute some invariants.

If the filtration grid is not given, it is infered from filtration values, using the multipers.grids.compute_grid() function, whose args are

  • grid_strategy:str see multipers.grids.available_strategies. Defaults to exact.

  • resolution:int if strategy is not exact.

  • inplace:bool if true, does the operation inplace, i.e., doesn’t return a copy.

Parameters:

resolution (int | None)

Return type:

_KSlicer_GudhiCohomology0_i32

info
is_kcritical

is_kcritical: bool

is_minpres

is_minpres: bool

is_squeezed

is_squeezed: bool

is_vine

is_vine: bool

minpres(self, degree: int = -1, degrees: list = [], backend: Literal['mpfree', '2pac'] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = False, id: str | None = None, dtype=np.int32, **minpres_kwargs) Slicer_type

File: multipers/slicer.pyx (starting at line 3083)

Computes the minimal presentation of the slicer, and returns it as a new slicer. See multipers.slicer.minimal_presentation().

Parameters:
  • backend (Literal['mpfree', '2pac'])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (str | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

minpres_degree

minpres_degree: int File: multipers/slicer.pyx (starting at line 2816)

num_generators
num_parameters
pers_backend

pers_backend: str

persistence_on_line(self, basepoint, direction=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 2915)

Computes the persistence on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

Warning: This is not parallelizable. Use persitence_on_lines.

persistence_on_lines(self, basepoints=None, directions=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 2934)

Same as persistence_on_line, but with vineyards operation between lines if self.is_vine, and in parallel otherwise.

prune_above_dimension(self, max_dimension: int) _KSlicer_GudhiCohomology0_i32

File: multipers/slicer.pyx (starting at line 3043)

Prunes the generators above a given dimension.

Return type:

_KSlicer_GudhiCohomology0_i32

push_to_line(self, basepoint, direction=None) _KSlicer_GudhiCohomology0_i32

File: multipers/slicer.pyx (starting at line 2892)

Pushes the current slicer to the line defined by a basepoint and an optional direction. If the direction is not provided, it is assumed to be diagonal.

Return type:

_KSlicer_GudhiCohomology0_i32

sliced_filtration(self, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 2986)

Computes the filtration on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

class multipers.slicer._KSlicer_Matrix0_f64

Bases: object

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 1924)

_from_ptr(self, slicer_ptr: int)

File: multipers/slicer.pyx (starting at line 1852)

static _inf_value()

File: multipers/slicer.pyx (starting at line 1843)

col_type

col_type: str

compute_persistence(self, one_filtration=None) _KSlicer_Matrix0_f64

File: multipers/slicer.pyx (starting at line 1982)

Computes the current persistence, or the persistence given by the filtration one_filtration (num_generators,).

Return type:

_KSlicer_Matrix0_f64

copy(self) _KSlicer_Matrix0_f64

File: multipers/slicer.pyx (starting at line 1894)

Returns a copy of the slicer.

Return type:

_KSlicer_Matrix0_f64

dimension

dimension: int

Returns the maximum dimension of the complex.

dtype

dtype: type

filtration_bounds(self) np.ndarray

File: multipers/slicer.pyx (starting at line 2021)

Computes the bounding box of the current multifiltration.

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/slicer.pyx (starting at line 1831)

get_barcode(self)

File: multipers/slicer.pyx (starting at line 1997)

Returns the barcode of the current 1d-persistence.

get_boundaries(self) tuple[tuple]

File: multipers/slicer.pyx (starting at line 2065)

Returns the boundaries of the generators.

Return type:

tuple[tuple]

get_dimensions(self) np.ndarray

File: multipers/slicer.pyx (starting at line 2048)

Returns the ordered dimensions of the generators.

Return type:

ndarray

get_filtration_grid(self, grid_strategy: str = 'exact', **infer_grid_kwargs)

File: multipers/slicer.pyx (starting at line 2036)

Parameters:

grid_strategy (str)

get_filtrations(self)

File: multipers/slicer.pyx (starting at line 2042)

Returns a view of the filtration values, as a list of numpy arrays.

get_filtrations_values(self) np.ndarray

File: multipers/slicer.pyx (starting at line 2029)

Returns the current filtration values of the slicer.

Return type:

ndarray

get_ptr(self)

File: multipers/slicer.pyx (starting at line 1847)

Returns a pointer to the underlying C++ slicer.

grid_squeeze(self, filtration_grid=None, grid_strategy='exact', resolution: int | None = None, coordinates: bool = True, inplace: bool = False, force: bool = False) _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64

File: multipers/slicer.pyx (starting at line 2070)

Coarsen the filtration values on a grid. This is necessary to compute some invariants.

If the filtration grid is not given, it is infered from filtration values, using the multipers.grids.compute_grid() function, whose args are

  • grid_strategy:str see multipers.grids.available_strategies. Defaults to exact.

  • resolution:int if strategy is not exact.

  • inplace:bool if true, does the operation inplace, i.e., doesn’t return a copy.

Parameters:

resolution (int | None)

Return type:

_KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64

info
is_kcritical

is_kcritical: bool

is_minpres

is_minpres: bool

is_squeezed

is_squeezed: bool

is_vine

is_vine: bool

minpres(self, degree: int = -1, degrees: list = [], backend: Literal['mpfree', '2pac'] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = False, id: str | None = None, dtype=np.float64, **minpres_kwargs) Slicer_type

File: multipers/slicer.pyx (starting at line 2099)

Computes the minimal presentation of the slicer, and returns it as a new slicer. See multipers.slicer.minimal_presentation().

Parameters:
  • backend (Literal['mpfree', '2pac'])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (str | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

minpres_degree

minpres_degree: int File: multipers/slicer.pyx (starting at line 1832)

num_generators
num_parameters
pers_backend

pers_backend: str

persistence_on_line(self, basepoint, direction=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 1931)

Computes the persistence on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

Warning: This is not parallelizable. Use persitence_on_lines.

persistence_on_lines(self, basepoints=None, directions=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 1950)

Same as persistence_on_line, but with vineyards operation between lines if self.is_vine, and in parallel otherwise.

prune_above_dimension(self, max_dimension: int) _KSlicer_Matrix0_f64

File: multipers/slicer.pyx (starting at line 2059)

Prunes the generators above a given dimension.

Return type:

_KSlicer_Matrix0_f64

push_to_line(self, basepoint, direction=None) _KSlicer_Matrix0_f64

File: multipers/slicer.pyx (starting at line 1908)

Pushes the current slicer to the line defined by a basepoint and an optional direction. If the direction is not provided, it is assumed to be diagonal.

Return type:

_KSlicer_Matrix0_f64

sliced_filtration(self, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 2002)

Computes the filtration on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

class multipers.slicer._KSlicer_Matrix0_i32

Bases: object

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 1618)

_from_ptr(self, slicer_ptr: int)

File: multipers/slicer.pyx (starting at line 1546)

static _inf_value()

File: multipers/slicer.pyx (starting at line 1537)

col_type

col_type: str

compute_persistence(self, one_filtration=None) _KSlicer_Matrix0_i32

File: multipers/slicer.pyx (starting at line 1676)

Computes the current persistence, or the persistence given by the filtration one_filtration (num_generators,).

Return type:

_KSlicer_Matrix0_i32

copy(self) _KSlicer_Matrix0_i32

File: multipers/slicer.pyx (starting at line 1588)

Returns a copy of the slicer.

Return type:

_KSlicer_Matrix0_i32

dimension

dimension: int

Returns the maximum dimension of the complex.

dtype

dtype: type

filtration_bounds(self) np.ndarray

File: multipers/slicer.pyx (starting at line 1715)

Computes the bounding box of the current multifiltration.

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/slicer.pyx (starting at line 1525)

get_barcode(self)

File: multipers/slicer.pyx (starting at line 1691)

Returns the barcode of the current 1d-persistence.

get_boundaries(self) tuple[tuple]

File: multipers/slicer.pyx (starting at line 1759)

Returns the boundaries of the generators.

Return type:

tuple[tuple]

get_dimensions(self) np.ndarray

File: multipers/slicer.pyx (starting at line 1742)

Returns the ordered dimensions of the generators.

Return type:

ndarray

get_filtration_grid(self, grid_strategy: str = 'exact', **infer_grid_kwargs)

File: multipers/slicer.pyx (starting at line 1730)

Parameters:

grid_strategy (str)

get_filtrations(self)

File: multipers/slicer.pyx (starting at line 1736)

Returns a view of the filtration values, as a list of numpy arrays.

get_filtrations_values(self) np.ndarray

File: multipers/slicer.pyx (starting at line 1723)

Returns the current filtration values of the slicer.

Return type:

ndarray

get_ptr(self)

File: multipers/slicer.pyx (starting at line 1541)

Returns a pointer to the underlying C++ slicer.

grid_squeeze(self, filtration_grid=None, grid_strategy='exact', resolution: int | None = None, coordinates: bool = True, inplace: bool = False, force: bool = False) _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_i32

File: multipers/slicer.pyx (starting at line 1764)

Coarsen the filtration values on a grid. This is necessary to compute some invariants.

If the filtration grid is not given, it is infered from filtration values, using the multipers.grids.compute_grid() function, whose args are

  • grid_strategy:str see multipers.grids.available_strategies. Defaults to exact.

  • resolution:int if strategy is not exact.

  • inplace:bool if true, does the operation inplace, i.e., doesn’t return a copy.

Parameters:

resolution (int | None)

Return type:

_KSlicer_Matrix0_i32

info
is_kcritical

is_kcritical: bool

is_minpres

is_minpres: bool

is_squeezed

is_squeezed: bool

is_vine

is_vine: bool

minpres(self, degree: int = -1, degrees: list = [], backend: Literal['mpfree', '2pac'] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = False, id: str | None = None, dtype=np.int32, **minpres_kwargs) Slicer_type

File: multipers/slicer.pyx (starting at line 1793)

Computes the minimal presentation of the slicer, and returns it as a new slicer. See multipers.slicer.minimal_presentation().

Parameters:
  • backend (Literal['mpfree', '2pac'])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (str | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

minpres_degree

minpres_degree: int File: multipers/slicer.pyx (starting at line 1526)

num_generators
num_parameters
pers_backend

pers_backend: str

persistence_on_line(self, basepoint, direction=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 1625)

Computes the persistence on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

Warning: This is not parallelizable. Use persitence_on_lines.

persistence_on_lines(self, basepoints=None, directions=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 1644)

Same as persistence_on_line, but with vineyards operation between lines if self.is_vine, and in parallel otherwise.

prune_above_dimension(self, max_dimension: int) _KSlicer_Matrix0_i32

File: multipers/slicer.pyx (starting at line 1753)

Prunes the generators above a given dimension.

Return type:

_KSlicer_Matrix0_i32

push_to_line(self, basepoint, direction=None) _KSlicer_Matrix0_i32

File: multipers/slicer.pyx (starting at line 1602)

Pushes the current slicer to the line defined by a basepoint and an optional direction. If the direction is not provided, it is assumed to be diagonal.

Return type:

_KSlicer_Matrix0_i32

sliced_filtration(self, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 1696)

Computes the filtration on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

class multipers.slicer._KSlicer_Matrix0_vine_f64

Bases: object

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 580)

_from_ptr(self, slicer_ptr: int)

File: multipers/slicer.pyx (starting at line 508)

static _inf_value()

File: multipers/slicer.pyx (starting at line 499)

col_type

col_type: str

compute_persistence(self, one_filtration=None) _KSlicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 638)

Computes the current persistence, or the persistence given by the filtration one_filtration (num_generators,).

Return type:

_KSlicer_Matrix0_vine_f64

copy(self) _KSlicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 550)

Returns a copy of the slicer.

Return type:

_KSlicer_Matrix0_vine_f64

dimension

dimension: int

Returns the maximum dimension of the complex.

dtype

dtype: type

filtration_bounds(self) np.ndarray

File: multipers/slicer.pyx (starting at line 677)

Computes the bounding box of the current multifiltration.

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/slicer.pyx (starting at line 487)

get_barcode(self)

File: multipers/slicer.pyx (starting at line 653)

Returns the barcode of the current 1d-persistence.

get_boundaries(self) tuple[tuple]

File: multipers/slicer.pyx (starting at line 721)

Returns the boundaries of the generators.

Return type:

tuple[tuple]

get_dimensions(self) np.ndarray

File: multipers/slicer.pyx (starting at line 704)

Returns the ordered dimensions of the generators.

Return type:

ndarray

get_filtration_grid(self, grid_strategy: str = 'exact', **infer_grid_kwargs)

File: multipers/slicer.pyx (starting at line 692)

Parameters:

grid_strategy (str)

get_filtrations(self)

File: multipers/slicer.pyx (starting at line 698)

Returns a view of the filtration values, as a list of numpy arrays.

get_filtrations_values(self) np.ndarray

File: multipers/slicer.pyx (starting at line 685)

Returns the current filtration values of the slicer.

Return type:

ndarray

get_permutation(self)

File: multipers/slicer.pyx (starting at line 802)

Returns the current generator permutation (w.r.t. vineyard).

get_ptr(self)

File: multipers/slicer.pyx (starting at line 503)

Returns a pointer to the underlying C++ slicer.

get_representative_cycles(self, update: bool = True, detailed: bool = False)

File: multipers/slicer.pyx (starting at line 796)

Returns the representative cycles of the current barcode. Recomputes the generators if update=True

grid_squeeze(self, filtration_grid=None, grid_strategy='exact', resolution: int | None = None, coordinates: bool = True, inplace: bool = False, force: bool = False) _KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 726)

Coarsen the filtration values on a grid. This is necessary to compute some invariants.

If the filtration grid is not given, it is infered from filtration values, using the multipers.grids.compute_grid() function, whose args are

  • grid_strategy:str see multipers.grids.available_strategies. Defaults to exact.

  • resolution:int if strategy is not exact.

  • inplace:bool if true, does the operation inplace, i.e., doesn’t return a copy.

Parameters:

resolution (int | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64

info
is_kcritical

is_kcritical: bool

is_minpres

is_minpres: bool

is_squeezed

is_squeezed: bool

is_vine

is_vine: bool

minpres(self, degree: int = -1, degrees: list = [], backend: Literal['mpfree', '2pac'] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = True, id: str | None = None, dtype=np.float64, **minpres_kwargs) Slicer_type

File: multipers/slicer.pyx (starting at line 755)

Computes the minimal presentation of the slicer, and returns it as a new slicer. See multipers.slicer.minimal_presentation().

Parameters:
  • backend (Literal['mpfree', '2pac'])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (str | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

minpres_degree

minpres_degree: int File: multipers/slicer.pyx (starting at line 488)

num_generators
num_parameters
pers_backend

pers_backend: str

persistence_on_line(self, basepoint, direction=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 587)

Computes the persistence on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

Warning: This is not parallelizable. Use persitence_on_lines.

persistence_on_lines(self, basepoints=None, directions=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 606)

Same as persistence_on_line, but with vineyards operation between lines if self.is_vine, and in parallel otherwise.

prune_above_dimension(self, max_dimension: int) _KSlicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 715)

Prunes the generators above a given dimension.

Return type:

_KSlicer_Matrix0_vine_f64

push_to_line(self, basepoint, direction=None) _KSlicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 564)

Pushes the current slicer to the line defined by a basepoint and an optional direction. If the direction is not provided, it is assumed to be diagonal.

Return type:

_KSlicer_Matrix0_vine_f64

sliced_filtration(self, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 658)

Computes the filtration on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

vine_update(self, basepoint, direction=None) _KSlicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 789)

Updates the barcode, on a line, using the vineyard algorithm.

Return type:

_KSlicer_Matrix0_vine_f64

class multipers.slicer._KSlicer_Matrix0_vine_i32

Bases: object

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 256)

_from_ptr(self, slicer_ptr: int)

File: multipers/slicer.pyx (starting at line 184)

static _inf_value()

File: multipers/slicer.pyx (starting at line 175)

col_type

col_type: str

compute_persistence(self, one_filtration=None) _KSlicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 314)

Computes the current persistence, or the persistence given by the filtration one_filtration (num_generators,).

Return type:

_KSlicer_Matrix0_vine_i32

copy(self) _KSlicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 226)

Returns a copy of the slicer.

Return type:

_KSlicer_Matrix0_vine_i32

dimension

dimension: int

Returns the maximum dimension of the complex.

dtype

dtype: type

filtration_bounds(self) np.ndarray

File: multipers/slicer.pyx (starting at line 353)

Computes the bounding box of the current multifiltration.

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/slicer.pyx (starting at line 163)

get_barcode(self)

File: multipers/slicer.pyx (starting at line 329)

Returns the barcode of the current 1d-persistence.

get_boundaries(self) tuple[tuple]

File: multipers/slicer.pyx (starting at line 397)

Returns the boundaries of the generators.

Return type:

tuple[tuple]

get_dimensions(self) np.ndarray

File: multipers/slicer.pyx (starting at line 380)

Returns the ordered dimensions of the generators.

Return type:

ndarray

get_filtration_grid(self, grid_strategy: str = 'exact', **infer_grid_kwargs)

File: multipers/slicer.pyx (starting at line 368)

Parameters:

grid_strategy (str)

get_filtrations(self)

File: multipers/slicer.pyx (starting at line 374)

Returns a view of the filtration values, as a list of numpy arrays.

get_filtrations_values(self) np.ndarray

File: multipers/slicer.pyx (starting at line 361)

Returns the current filtration values of the slicer.

Return type:

ndarray

get_permutation(self)

File: multipers/slicer.pyx (starting at line 478)

Returns the current generator permutation (w.r.t. vineyard).

get_ptr(self)

File: multipers/slicer.pyx (starting at line 179)

Returns a pointer to the underlying C++ slicer.

get_representative_cycles(self, update: bool = True, detailed: bool = False)

File: multipers/slicer.pyx (starting at line 472)

Returns the representative cycles of the current barcode. Recomputes the generators if update=True

grid_squeeze(self, filtration_grid=None, grid_strategy='exact', resolution: int | None = None, coordinates: bool = True, inplace: bool = False, force: bool = False) _KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 402)

Coarsen the filtration values on a grid. This is necessary to compute some invariants.

If the filtration grid is not given, it is infered from filtration values, using the multipers.grids.compute_grid() function, whose args are

  • grid_strategy:str see multipers.grids.available_strategies. Defaults to exact.

  • resolution:int if strategy is not exact.

  • inplace:bool if true, does the operation inplace, i.e., doesn’t return a copy.

Parameters:

resolution (int | None)

Return type:

_KSlicer_Matrix0_vine_i32

info
is_kcritical

is_kcritical: bool

is_minpres

is_minpres: bool

is_squeezed

is_squeezed: bool

is_vine

is_vine: bool

minpres(self, degree: int = -1, degrees: list = [], backend: Literal['mpfree', '2pac'] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = True, id: str | None = None, dtype=np.int32, **minpres_kwargs) Slicer_type

File: multipers/slicer.pyx (starting at line 431)

Computes the minimal presentation of the slicer, and returns it as a new slicer. See multipers.slicer.minimal_presentation().

Parameters:
  • backend (Literal['mpfree', '2pac'])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (str | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

minpres_degree

minpres_degree: int File: multipers/slicer.pyx (starting at line 164)

num_generators
num_parameters
pers_backend

pers_backend: str

persistence_on_line(self, basepoint, direction=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 263)

Computes the persistence on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

Warning: This is not parallelizable. Use persitence_on_lines.

persistence_on_lines(self, basepoints=None, directions=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 282)

Same as persistence_on_line, but with vineyards operation between lines if self.is_vine, and in parallel otherwise.

prune_above_dimension(self, max_dimension: int) _KSlicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 391)

Prunes the generators above a given dimension.

Return type:

_KSlicer_Matrix0_vine_i32

push_to_line(self, basepoint, direction=None) _KSlicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 240)

Pushes the current slicer to the line defined by a basepoint and an optional direction. If the direction is not provided, it is assumed to be diagonal.

Return type:

_KSlicer_Matrix0_vine_i32

sliced_filtration(self, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 334)

Computes the filtration on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

vine_update(self, basepoint, direction=None) _KSlicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 465)

Updates the barcode, on a line, using the vineyard algorithm.

Return type:

_KSlicer_Matrix0_vine_i32

class multipers.slicer._Slicer_GudhiCohomology0_f64

Bases: object

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 3848)

_build_from_scc_file(self, path: os.PathLike, rivet_compatible: bool = False, reverse: bool = False, shift_dimension: int = 0) _Slicer_GudhiCohomology0_f64

File: multipers/slicer.pyx (starting at line 4057)

Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.

Parameters:

path (PathLike)

Return type:

_Slicer_GudhiCohomology0_f64

_from_ptr(self, slicer_ptr: int)

File: multipers/slicer.pyx (starting at line 3787)

static _inf_value()

File: multipers/slicer.pyx (starting at line 3778)

col_type

col_type: str

compute_persistence(self, one_filtration=None) _Slicer_GudhiCohomology0_f64

File: multipers/slicer.pyx (starting at line 3906)

Computes the current persistence, or the persistence given by the filtration one_filtration (num_generators,).

Return type:

_Slicer_GudhiCohomology0_f64

copy(self) _Slicer_GudhiCohomology0_f64

File: multipers/slicer.pyx (starting at line 3818)

Returns a copy of the slicer.

Return type:

_Slicer_GudhiCohomology0_f64

dimension

dimension: int

Returns the maximum dimension of the complex.

dtype

dtype: type

filtration_bounds(self) np.ndarray

File: multipers/slicer.pyx (starting at line 3945)

Computes the bounding box of the current multifiltration.

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/slicer.pyx (starting at line 3766)

get_barcode(self)

File: multipers/slicer.pyx (starting at line 3921)

Returns the barcode of the current 1d-persistence.

get_boundaries(self) tuple[tuple]

File: multipers/slicer.pyx (starting at line 3989)

Returns the boundaries of the generators.

Return type:

tuple[tuple]

get_dimensions(self) np.ndarray

File: multipers/slicer.pyx (starting at line 3972)

Returns the ordered dimensions of the generators.

Return type:

ndarray

get_filtration_grid(self, grid_strategy: str = 'exact', **infer_grid_kwargs)

File: multipers/slicer.pyx (starting at line 3960)

Parameters:

grid_strategy (str)

get_filtrations(self)

File: multipers/slicer.pyx (starting at line 3966)

Returns a view of the filtration values, as a list of numpy arrays.

get_filtrations_values(self) np.ndarray

File: multipers/slicer.pyx (starting at line 3953)

Returns the current filtration values of the slicer.

Return type:

ndarray

get_ptr(self)

File: multipers/slicer.pyx (starting at line 3782)

Returns a pointer to the underlying C++ slicer.

grid_squeeze(self, filtration_grid=None, grid_strategy='exact', resolution: int | None = None, coordinates: bool = True, inplace: bool = False, force: bool = False) _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

File: multipers/slicer.pyx (starting at line 3994)

Coarsen the filtration values on a grid. This is necessary to compute some invariants.

If the filtration grid is not given, it is infered from filtration values, using the multipers.grids.compute_grid() function, whose args are

  • grid_strategy:str see multipers.grids.available_strategies. Defaults to exact.

  • resolution:int if strategy is not exact.

  • inplace:bool if true, does the operation inplace, i.e., doesn’t return a copy.

Parameters:

resolution (int | None)

Return type:

_Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

info
is_kcritical

is_kcritical: bool

is_minpres

is_minpres: bool

is_squeezed

is_squeezed: bool

is_vine

is_vine: bool

minpres(self, degree: int = -1, degrees: list = [], backend: Literal['mpfree', '2pac'] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = False, id: str | None = None, dtype=np.float64, **minpres_kwargs) Slicer_type

File: multipers/slicer.pyx (starting at line 4023)

Computes the minimal presentation of the slicer, and returns it as a new slicer. See multipers.slicer.minimal_presentation().

Parameters:
  • backend (Literal['mpfree', '2pac'])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (str | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

minpres_degree

minpres_degree: int File: multipers/slicer.pyx (starting at line 3767)

num_generators
num_parameters
pers_backend

pers_backend: str

persistence_on_line(self, basepoint, direction=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 3855)

Computes the persistence on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

Warning: This is not parallelizable. Use persitence_on_lines.

persistence_on_lines(self, basepoints=None, directions=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 3874)

Same as persistence_on_line, but with vineyards operation between lines if self.is_vine, and in parallel otherwise.

prune_above_dimension(self, max_dimension: int) _Slicer_GudhiCohomology0_f64

File: multipers/slicer.pyx (starting at line 3983)

Prunes the generators above a given dimension.

Return type:

_Slicer_GudhiCohomology0_f64

push_to_line(self, basepoint, direction=None) _Slicer_GudhiCohomology0_f64

File: multipers/slicer.pyx (starting at line 3832)

Pushes the current slicer to the line defined by a basepoint and an optional direction. If the direction is not provided, it is assumed to be diagonal.

Return type:

_Slicer_GudhiCohomology0_f64

sliced_filtration(self, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 3926)

Computes the filtration on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

to_scc(self, path: os.PathLike, num_parameters: int = -1, degree: int = 1, rivet_compatible: bool = False, ignore_last_generators: bool = False, strip_comments: bool = False, reverse: bool = False, unsqueeze: bool = True)

File: multipers/slicer.pyx (starting at line 4066)

Writes current slicer to a file in scc format.

Parameters:

path (PathLike)

unsqueeze(self, grid=None, dtype=np.float64)

File: multipers/slicer.pyx (starting at line 4089)

class multipers.slicer._Slicer_GudhiCohomology0_i32

Bases: object

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 3509)

_build_from_scc_file(self, path: os.PathLike, rivet_compatible: bool = False, reverse: bool = False, shift_dimension: int = 0) _Slicer_GudhiCohomology0_i32

File: multipers/slicer.pyx (starting at line 3718)

Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.

Parameters:

path (PathLike)

Return type:

_Slicer_GudhiCohomology0_i32

_from_ptr(self, slicer_ptr: int)

File: multipers/slicer.pyx (starting at line 3448)

static _inf_value()

File: multipers/slicer.pyx (starting at line 3439)

col_type

col_type: str

compute_persistence(self, one_filtration=None) _Slicer_GudhiCohomology0_i32

File: multipers/slicer.pyx (starting at line 3567)

Computes the current persistence, or the persistence given by the filtration one_filtration (num_generators,).

Return type:

_Slicer_GudhiCohomology0_i32

copy(self) _Slicer_GudhiCohomology0_i32

File: multipers/slicer.pyx (starting at line 3479)

Returns a copy of the slicer.

Return type:

_Slicer_GudhiCohomology0_i32

dimension

dimension: int

Returns the maximum dimension of the complex.

dtype

dtype: type

filtration_bounds(self) np.ndarray

File: multipers/slicer.pyx (starting at line 3606)

Computes the bounding box of the current multifiltration.

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/slicer.pyx (starting at line 3427)

get_barcode(self)

File: multipers/slicer.pyx (starting at line 3582)

Returns the barcode of the current 1d-persistence.

get_boundaries(self) tuple[tuple]

File: multipers/slicer.pyx (starting at line 3650)

Returns the boundaries of the generators.

Return type:

tuple[tuple]

get_dimensions(self) np.ndarray

File: multipers/slicer.pyx (starting at line 3633)

Returns the ordered dimensions of the generators.

Return type:

ndarray

get_filtration_grid(self, grid_strategy: str = 'exact', **infer_grid_kwargs)

File: multipers/slicer.pyx (starting at line 3621)

Parameters:

grid_strategy (str)

get_filtrations(self)

File: multipers/slicer.pyx (starting at line 3627)

Returns a view of the filtration values, as a list of numpy arrays.

get_filtrations_values(self) np.ndarray

File: multipers/slicer.pyx (starting at line 3614)

Returns the current filtration values of the slicer.

Return type:

ndarray

get_ptr(self)

File: multipers/slicer.pyx (starting at line 3443)

Returns a pointer to the underlying C++ slicer.

grid_squeeze(self, filtration_grid=None, grid_strategy='exact', resolution: int | None = None, coordinates: bool = True, inplace: bool = False, force: bool = False) _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_i32

File: multipers/slicer.pyx (starting at line 3655)

Coarsen the filtration values on a grid. This is necessary to compute some invariants.

If the filtration grid is not given, it is infered from filtration values, using the multipers.grids.compute_grid() function, whose args are

  • grid_strategy:str see multipers.grids.available_strategies. Defaults to exact.

  • resolution:int if strategy is not exact.

  • inplace:bool if true, does the operation inplace, i.e., doesn’t return a copy.

Parameters:

resolution (int | None)

Return type:

_Slicer_GudhiCohomology0_i32

info
is_kcritical

is_kcritical: bool

is_minpres

is_minpres: bool

is_squeezed

is_squeezed: bool

is_vine

is_vine: bool

minpres(self, degree: int = -1, degrees: list = [], backend: Literal['mpfree', '2pac'] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = False, id: str | None = None, dtype=np.int32, **minpres_kwargs) Slicer_type

File: multipers/slicer.pyx (starting at line 3684)

Computes the minimal presentation of the slicer, and returns it as a new slicer. See multipers.slicer.minimal_presentation().

Parameters:
  • backend (Literal['mpfree', '2pac'])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (str | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

minpres_degree

minpres_degree: int File: multipers/slicer.pyx (starting at line 3428)

num_generators
num_parameters
pers_backend

pers_backend: str

persistence_on_line(self, basepoint, direction=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 3516)

Computes the persistence on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

Warning: This is not parallelizable. Use persitence_on_lines.

persistence_on_lines(self, basepoints=None, directions=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 3535)

Same as persistence_on_line, but with vineyards operation between lines if self.is_vine, and in parallel otherwise.

prune_above_dimension(self, max_dimension: int) _Slicer_GudhiCohomology0_i32

File: multipers/slicer.pyx (starting at line 3644)

Prunes the generators above a given dimension.

Return type:

_Slicer_GudhiCohomology0_i32

push_to_line(self, basepoint, direction=None) _Slicer_GudhiCohomology0_i32

File: multipers/slicer.pyx (starting at line 3493)

Pushes the current slicer to the line defined by a basepoint and an optional direction. If the direction is not provided, it is assumed to be diagonal.

Return type:

_Slicer_GudhiCohomology0_i32

sliced_filtration(self, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 3587)

Computes the filtration on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

to_scc(self, path: os.PathLike, num_parameters: int = -1, degree: int = 1, rivet_compatible: bool = False, ignore_last_generators: bool = False, strip_comments: bool = False, reverse: bool = False, unsqueeze: bool = True)

File: multipers/slicer.pyx (starting at line 3727)

Writes current slicer to a file in scc format.

Parameters:

path (PathLike)

unsqueeze(self, grid=None, dtype=np.float64)

File: multipers/slicer.pyx (starting at line 3750)

class multipers.slicer._Slicer_Matrix0_f64

Bases: object

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 2558)

_build_from_scc_file(self, path: os.PathLike, rivet_compatible: bool = False, reverse: bool = False, shift_dimension: int = 0) _Slicer_Matrix0_f64

File: multipers/slicer.pyx (starting at line 2767)

Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.

Parameters:

path (PathLike)

Return type:

_Slicer_Matrix0_f64

_from_ptr(self, slicer_ptr: int)

File: multipers/slicer.pyx (starting at line 2497)

static _inf_value()

File: multipers/slicer.pyx (starting at line 2488)

col_type

col_type: str

compute_persistence(self, one_filtration=None) _Slicer_Matrix0_f64

File: multipers/slicer.pyx (starting at line 2616)

Computes the current persistence, or the persistence given by the filtration one_filtration (num_generators,).

Return type:

_Slicer_Matrix0_f64

copy(self) _Slicer_Matrix0_f64

File: multipers/slicer.pyx (starting at line 2528)

Returns a copy of the slicer.

Return type:

_Slicer_Matrix0_f64

dimension

dimension: int

Returns the maximum dimension of the complex.

dtype

dtype: type

filtration_bounds(self) np.ndarray

File: multipers/slicer.pyx (starting at line 2655)

Computes the bounding box of the current multifiltration.

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/slicer.pyx (starting at line 2476)

get_barcode(self)

File: multipers/slicer.pyx (starting at line 2631)

Returns the barcode of the current 1d-persistence.

get_boundaries(self) tuple[tuple]

File: multipers/slicer.pyx (starting at line 2699)

Returns the boundaries of the generators.

Return type:

tuple[tuple]

get_dimensions(self) np.ndarray

File: multipers/slicer.pyx (starting at line 2682)

Returns the ordered dimensions of the generators.

Return type:

ndarray

get_filtration_grid(self, grid_strategy: str = 'exact', **infer_grid_kwargs)

File: multipers/slicer.pyx (starting at line 2670)

Parameters:

grid_strategy (str)

get_filtrations(self)

File: multipers/slicer.pyx (starting at line 2676)

Returns a view of the filtration values, as a list of numpy arrays.

get_filtrations_values(self) np.ndarray

File: multipers/slicer.pyx (starting at line 2663)

Returns the current filtration values of the slicer.

Return type:

ndarray

get_ptr(self)

File: multipers/slicer.pyx (starting at line 2492)

Returns a pointer to the underlying C++ slicer.

grid_squeeze(self, filtration_grid=None, grid_strategy='exact', resolution: int | None = None, coordinates: bool = True, inplace: bool = False, force: bool = False) _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64

File: multipers/slicer.pyx (starting at line 2704)

Coarsen the filtration values on a grid. This is necessary to compute some invariants.

If the filtration grid is not given, it is infered from filtration values, using the multipers.grids.compute_grid() function, whose args are

  • grid_strategy:str see multipers.grids.available_strategies. Defaults to exact.

  • resolution:int if strategy is not exact.

  • inplace:bool if true, does the operation inplace, i.e., doesn’t return a copy.

Parameters:

resolution (int | None)

Return type:

_Slicer_Matrix0_i32 | _Slicer_Matrix0_f64

info
is_kcritical

is_kcritical: bool

is_minpres

is_minpres: bool

is_squeezed

is_squeezed: bool

is_vine

is_vine: bool

minpres(self, degree: int = -1, degrees: list = [], backend: Literal['mpfree', '2pac'] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = False, id: str | None = None, dtype=np.float64, **minpres_kwargs) Slicer_type

File: multipers/slicer.pyx (starting at line 2733)

Computes the minimal presentation of the slicer, and returns it as a new slicer. See multipers.slicer.minimal_presentation().

Parameters:
  • backend (Literal['mpfree', '2pac'])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (str | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

minpres_degree

minpres_degree: int File: multipers/slicer.pyx (starting at line 2477)

num_generators
num_parameters
pers_backend

pers_backend: str

persistence_on_line(self, basepoint, direction=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 2565)

Computes the persistence on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

Warning: This is not parallelizable. Use persitence_on_lines.

persistence_on_lines(self, basepoints=None, directions=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 2584)

Same as persistence_on_line, but with vineyards operation between lines if self.is_vine, and in parallel otherwise.

prune_above_dimension(self, max_dimension: int) _Slicer_Matrix0_f64

File: multipers/slicer.pyx (starting at line 2693)

Prunes the generators above a given dimension.

Return type:

_Slicer_Matrix0_f64

push_to_line(self, basepoint, direction=None) _Slicer_Matrix0_f64

File: multipers/slicer.pyx (starting at line 2542)

Pushes the current slicer to the line defined by a basepoint and an optional direction. If the direction is not provided, it is assumed to be diagonal.

Return type:

_Slicer_Matrix0_f64

sliced_filtration(self, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 2636)

Computes the filtration on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

to_scc(self, path: os.PathLike, num_parameters: int = -1, degree: int = 1, rivet_compatible: bool = False, ignore_last_generators: bool = False, strip_comments: bool = False, reverse: bool = False, unsqueeze: bool = True)

File: multipers/slicer.pyx (starting at line 2776)

Writes current slicer to a file in scc format.

Parameters:

path (PathLike)

unsqueeze(self, grid=None, dtype=np.float64)

File: multipers/slicer.pyx (starting at line 2799)

class multipers.slicer._Slicer_Matrix0_i32

Bases: object

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 2219)

_build_from_scc_file(self, path: os.PathLike, rivet_compatible: bool = False, reverse: bool = False, shift_dimension: int = 0) _Slicer_Matrix0_i32

File: multipers/slicer.pyx (starting at line 2428)

Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.

Parameters:

path (PathLike)

Return type:

_Slicer_Matrix0_i32

_from_ptr(self, slicer_ptr: int)

File: multipers/slicer.pyx (starting at line 2158)

static _inf_value()

File: multipers/slicer.pyx (starting at line 2149)

col_type

col_type: str

compute_persistence(self, one_filtration=None) _Slicer_Matrix0_i32

File: multipers/slicer.pyx (starting at line 2277)

Computes the current persistence, or the persistence given by the filtration one_filtration (num_generators,).

Return type:

_Slicer_Matrix0_i32

copy(self) _Slicer_Matrix0_i32

File: multipers/slicer.pyx (starting at line 2189)

Returns a copy of the slicer.

Return type:

_Slicer_Matrix0_i32

dimension

dimension: int

Returns the maximum dimension of the complex.

dtype

dtype: type

filtration_bounds(self) np.ndarray

File: multipers/slicer.pyx (starting at line 2316)

Computes the bounding box of the current multifiltration.

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/slicer.pyx (starting at line 2137)

get_barcode(self)

File: multipers/slicer.pyx (starting at line 2292)

Returns the barcode of the current 1d-persistence.

get_boundaries(self) tuple[tuple]

File: multipers/slicer.pyx (starting at line 2360)

Returns the boundaries of the generators.

Return type:

tuple[tuple]

get_dimensions(self) np.ndarray

File: multipers/slicer.pyx (starting at line 2343)

Returns the ordered dimensions of the generators.

Return type:

ndarray

get_filtration_grid(self, grid_strategy: str = 'exact', **infer_grid_kwargs)

File: multipers/slicer.pyx (starting at line 2331)

Parameters:

grid_strategy (str)

get_filtrations(self)

File: multipers/slicer.pyx (starting at line 2337)

Returns a view of the filtration values, as a list of numpy arrays.

get_filtrations_values(self) np.ndarray

File: multipers/slicer.pyx (starting at line 2324)

Returns the current filtration values of the slicer.

Return type:

ndarray

get_ptr(self)

File: multipers/slicer.pyx (starting at line 2153)

Returns a pointer to the underlying C++ slicer.

grid_squeeze(self, filtration_grid=None, grid_strategy='exact', resolution: int | None = None, coordinates: bool = True, inplace: bool = False, force: bool = False) _Slicer_Matrix0_i32 | _Slicer_Matrix0_i32

File: multipers/slicer.pyx (starting at line 2365)

Coarsen the filtration values on a grid. This is necessary to compute some invariants.

If the filtration grid is not given, it is infered from filtration values, using the multipers.grids.compute_grid() function, whose args are

  • grid_strategy:str see multipers.grids.available_strategies. Defaults to exact.

  • resolution:int if strategy is not exact.

  • inplace:bool if true, does the operation inplace, i.e., doesn’t return a copy.

Parameters:

resolution (int | None)

Return type:

_Slicer_Matrix0_i32

info
is_kcritical

is_kcritical: bool

is_minpres

is_minpres: bool

is_squeezed

is_squeezed: bool

is_vine

is_vine: bool

minpres(self, degree: int = -1, degrees: list = [], backend: Literal['mpfree', '2pac'] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = False, id: str | None = None, dtype=np.int32, **minpres_kwargs) Slicer_type

File: multipers/slicer.pyx (starting at line 2394)

Computes the minimal presentation of the slicer, and returns it as a new slicer. See multipers.slicer.minimal_presentation().

Parameters:
  • backend (Literal['mpfree', '2pac'])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (str | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

minpres_degree

minpres_degree: int File: multipers/slicer.pyx (starting at line 2138)

num_generators
num_parameters
pers_backend

pers_backend: str

persistence_on_line(self, basepoint, direction=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 2226)

Computes the persistence on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

Warning: This is not parallelizable. Use persitence_on_lines.

persistence_on_lines(self, basepoints=None, directions=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 2245)

Same as persistence_on_line, but with vineyards operation between lines if self.is_vine, and in parallel otherwise.

prune_above_dimension(self, max_dimension: int) _Slicer_Matrix0_i32

File: multipers/slicer.pyx (starting at line 2354)

Prunes the generators above a given dimension.

Return type:

_Slicer_Matrix0_i32

push_to_line(self, basepoint, direction=None) _Slicer_Matrix0_i32

File: multipers/slicer.pyx (starting at line 2203)

Pushes the current slicer to the line defined by a basepoint and an optional direction. If the direction is not provided, it is assumed to be diagonal.

Return type:

_Slicer_Matrix0_i32

sliced_filtration(self, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 2297)

Computes the filtration on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

to_scc(self, path: os.PathLike, num_parameters: int = -1, degree: int = 1, rivet_compatible: bool = False, ignore_last_generators: bool = False, strip_comments: bool = False, reverse: bool = False, unsqueeze: bool = True)

File: multipers/slicer.pyx (starting at line 2437)

Writes current slicer to a file in scc format.

Parameters:

path (PathLike)

unsqueeze(self, grid=None, dtype=np.float64)

File: multipers/slicer.pyx (starting at line 2460)

class multipers.slicer._Slicer_Matrix0_vine_f64

Bases: object

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 1250)

_build_from_scc_file(self, path: os.PathLike, rivet_compatible: bool = False, reverse: bool = False, shift_dimension: int = 0) _Slicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 1477)

Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.

Parameters:

path (PathLike)

Return type:

_Slicer_Matrix0_vine_f64

_from_ptr(self, slicer_ptr: int)

File: multipers/slicer.pyx (starting at line 1189)

static _inf_value()

File: multipers/slicer.pyx (starting at line 1180)

col_type

col_type: str

compute_persistence(self, one_filtration=None) _Slicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 1308)

Computes the current persistence, or the persistence given by the filtration one_filtration (num_generators,).

Return type:

_Slicer_Matrix0_vine_f64

copy(self) _Slicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 1220)

Returns a copy of the slicer.

Return type:

_Slicer_Matrix0_vine_f64

dimension

dimension: int

Returns the maximum dimension of the complex.

dtype

dtype: type

filtration_bounds(self) np.ndarray

File: multipers/slicer.pyx (starting at line 1347)

Computes the bounding box of the current multifiltration.

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/slicer.pyx (starting at line 1168)

get_barcode(self)

File: multipers/slicer.pyx (starting at line 1323)

Returns the barcode of the current 1d-persistence.

get_boundaries(self) tuple[tuple]

File: multipers/slicer.pyx (starting at line 1391)

Returns the boundaries of the generators.

Return type:

tuple[tuple]

get_dimensions(self) np.ndarray

File: multipers/slicer.pyx (starting at line 1374)

Returns the ordered dimensions of the generators.

Return type:

ndarray

get_filtration_grid(self, grid_strategy: str = 'exact', **infer_grid_kwargs)

File: multipers/slicer.pyx (starting at line 1362)

Parameters:

grid_strategy (str)

get_filtrations(self)

File: multipers/slicer.pyx (starting at line 1368)

Returns a view of the filtration values, as a list of numpy arrays.

get_filtrations_values(self) np.ndarray

File: multipers/slicer.pyx (starting at line 1355)

Returns the current filtration values of the slicer.

Return type:

ndarray

get_permutation(self)

File: multipers/slicer.pyx (starting at line 1472)

Returns the current generator permutation (w.r.t. vineyard).

get_ptr(self)

File: multipers/slicer.pyx (starting at line 1184)

Returns a pointer to the underlying C++ slicer.

get_representative_cycles(self, update: bool = True, detailed: bool = False)

File: multipers/slicer.pyx (starting at line 1466)

Returns the representative cycles of the current barcode. Recomputes the generators if update=True

grid_squeeze(self, filtration_grid=None, grid_strategy='exact', resolution: int | None = None, coordinates: bool = True, inplace: bool = False, force: bool = False) _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 1396)

Coarsen the filtration values on a grid. This is necessary to compute some invariants.

If the filtration grid is not given, it is infered from filtration values, using the multipers.grids.compute_grid() function, whose args are

  • grid_strategy:str see multipers.grids.available_strategies. Defaults to exact.

  • resolution:int if strategy is not exact.

  • inplace:bool if true, does the operation inplace, i.e., doesn’t return a copy.

Parameters:

resolution (int | None)

Return type:

_Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64

info
is_kcritical

is_kcritical: bool

is_minpres

is_minpres: bool

is_squeezed

is_squeezed: bool

is_vine

is_vine: bool

minpres(self, degree: int = -1, degrees: list = [], backend: Literal['mpfree', '2pac'] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = True, id: str | None = None, dtype=np.float64, **minpres_kwargs) Slicer_type

File: multipers/slicer.pyx (starting at line 1425)

Computes the minimal presentation of the slicer, and returns it as a new slicer. See multipers.slicer.minimal_presentation().

Parameters:
  • backend (Literal['mpfree', '2pac'])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (str | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

minpres_degree

minpres_degree: int File: multipers/slicer.pyx (starting at line 1169)

num_generators
num_parameters
pers_backend

pers_backend: str

persistence_on_line(self, basepoint, direction=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 1257)

Computes the persistence on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

Warning: This is not parallelizable. Use persitence_on_lines.

persistence_on_lines(self, basepoints=None, directions=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 1276)

Same as persistence_on_line, but with vineyards operation between lines if self.is_vine, and in parallel otherwise.

prune_above_dimension(self, max_dimension: int) _Slicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 1385)

Prunes the generators above a given dimension.

Return type:

_Slicer_Matrix0_vine_f64

push_to_line(self, basepoint, direction=None) _Slicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 1234)

Pushes the current slicer to the line defined by a basepoint and an optional direction. If the direction is not provided, it is assumed to be diagonal.

Return type:

_Slicer_Matrix0_vine_f64

sliced_filtration(self, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 1328)

Computes the filtration on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

to_scc(self, path: os.PathLike, num_parameters: int = -1, degree: int = 1, rivet_compatible: bool = False, ignore_last_generators: bool = False, strip_comments: bool = False, reverse: bool = False, unsqueeze: bool = True)

File: multipers/slicer.pyx (starting at line 1486)

Writes current slicer to a file in scc format.

Parameters:

path (PathLike)

unsqueeze(self, grid=None, dtype=np.float64)

File: multipers/slicer.pyx (starting at line 1509)

vine_update(self, basepoint, direction=None) _Slicer_Matrix0_vine_f64

File: multipers/slicer.pyx (starting at line 1459)

Updates the barcode, on a line, using the vineyard algorithm.

Return type:

_Slicer_Matrix0_vine_f64

class multipers.slicer._Slicer_Matrix0_vine_i32

Bases: object

static _bc_to_full(bcs, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 893)

_build_from_scc_file(self, path: os.PathLike, rivet_compatible: bool = False, reverse: bool = False, shift_dimension: int = 0) _Slicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 1120)

Builds the slicer from the given scc file. Should be empty before, otherwise will be completely overwritten.

Parameters:

path (PathLike)

Return type:

_Slicer_Matrix0_vine_i32

_from_ptr(self, slicer_ptr: int)

File: multipers/slicer.pyx (starting at line 832)

static _inf_value()

File: multipers/slicer.pyx (starting at line 823)

col_type

col_type: str

compute_persistence(self, one_filtration=None) _Slicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 951)

Computes the current persistence, or the persistence given by the filtration one_filtration (num_generators,).

Return type:

_Slicer_Matrix0_vine_i32

copy(self) _Slicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 863)

Returns a copy of the slicer.

Return type:

_Slicer_Matrix0_vine_i32

dimension

dimension: int

Returns the maximum dimension of the complex.

dtype

dtype: type

filtration_bounds(self) np.ndarray

File: multipers/slicer.pyx (starting at line 990)

Computes the bounding box of the current multifiltration.

Return type:

ndarray

filtration_grid

filtration_grid: vector[vector[double]] File: multipers/slicer.pyx (starting at line 811)

get_barcode(self)

File: multipers/slicer.pyx (starting at line 966)

Returns the barcode of the current 1d-persistence.

get_boundaries(self) tuple[tuple]

File: multipers/slicer.pyx (starting at line 1034)

Returns the boundaries of the generators.

Return type:

tuple[tuple]

get_dimensions(self) np.ndarray

File: multipers/slicer.pyx (starting at line 1017)

Returns the ordered dimensions of the generators.

Return type:

ndarray

get_filtration_grid(self, grid_strategy: str = 'exact', **infer_grid_kwargs)

File: multipers/slicer.pyx (starting at line 1005)

Parameters:

grid_strategy (str)

get_filtrations(self)

File: multipers/slicer.pyx (starting at line 1011)

Returns a view of the filtration values, as a list of numpy arrays.

get_filtrations_values(self) np.ndarray

File: multipers/slicer.pyx (starting at line 998)

Returns the current filtration values of the slicer.

Return type:

ndarray

get_permutation(self)

File: multipers/slicer.pyx (starting at line 1115)

Returns the current generator permutation (w.r.t. vineyard).

get_ptr(self)

File: multipers/slicer.pyx (starting at line 827)

Returns a pointer to the underlying C++ slicer.

get_representative_cycles(self, update: bool = True, detailed: bool = False)

File: multipers/slicer.pyx (starting at line 1109)

Returns the representative cycles of the current barcode. Recomputes the generators if update=True

grid_squeeze(self, filtration_grid=None, grid_strategy='exact', resolution: int | None = None, coordinates: bool = True, inplace: bool = False, force: bool = False) _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 1039)

Coarsen the filtration values on a grid. This is necessary to compute some invariants.

If the filtration grid is not given, it is infered from filtration values, using the multipers.grids.compute_grid() function, whose args are

  • grid_strategy:str see multipers.grids.available_strategies. Defaults to exact.

  • resolution:int if strategy is not exact.

  • inplace:bool if true, does the operation inplace, i.e., doesn’t return a copy.

Parameters:

resolution (int | None)

Return type:

_Slicer_Matrix0_vine_i32

info
is_kcritical

is_kcritical: bool

is_minpres

is_minpres: bool

is_squeezed

is_squeezed: bool

is_vine

is_vine: bool

minpres(self, degree: int = -1, degrees: list = [], backend: Literal['mpfree', '2pac'] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = True, id: str | None = None, dtype=np.int32, **minpres_kwargs) Slicer_type

File: multipers/slicer.pyx (starting at line 1068)

Computes the minimal presentation of the slicer, and returns it as a new slicer. See multipers.slicer.minimal_presentation().

Parameters:
  • backend (Literal['mpfree', '2pac'])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (str | None)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

minpres_degree

minpres_degree: int File: multipers/slicer.pyx (starting at line 812)

num_generators
num_parameters
pers_backend

pers_backend: str

persistence_on_line(self, basepoint, direction=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 900)

Computes the persistence on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

Warning: This is not parallelizable. Use persitence_on_lines.

persistence_on_lines(self, basepoints=None, directions=None, keep_inf: bool = True, full: bool = False)

File: multipers/slicer.pyx (starting at line 919)

Same as persistence_on_line, but with vineyards operation between lines if self.is_vine, and in parallel otherwise.

prune_above_dimension(self, max_dimension: int) _Slicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 1028)

Prunes the generators above a given dimension.

Return type:

_Slicer_Matrix0_vine_i32

push_to_line(self, basepoint, direction=None) _Slicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 877)

Pushes the current slicer to the line defined by a basepoint and an optional direction. If the direction is not provided, it is assumed to be diagonal.

Return type:

_Slicer_Matrix0_vine_i32

sliced_filtration(self, basepoint, direction=None)

File: multipers/slicer.pyx (starting at line 971)

Computes the filtration on a line L defined by
  • a basepoint (num_parameters,) array

  • an optional direction (num_parameters,) array

to_scc(self, path: os.PathLike, num_parameters: int = -1, degree: int = 1, rivet_compatible: bool = False, ignore_last_generators: bool = False, strip_comments: bool = False, reverse: bool = False, unsqueeze: bool = True)

File: multipers/slicer.pyx (starting at line 1129)

Writes current slicer to a file in scc format.

Parameters:

path (PathLike)

unsqueeze(self, grid=None, dtype=np.float64)

File: multipers/slicer.pyx (starting at line 1152)

vine_update(self, basepoint, direction=None) _Slicer_Matrix0_vine_i32

File: multipers/slicer.pyx (starting at line 1102)

Updates the barcode, on a line, using the vineyard algorithm.

Return type:

_Slicer_Matrix0_vine_i32

multipers.slicer._hilbert_signed_measure(slicer, degrees: vector[indices_type], zero_pad: bool = False, n_jobs: int = 0, verbose: bool = False)

File: multipers/slicer.pyx (starting at line 4350)

Computes the signed measures given by the decomposition of the hilbert function.

Input

  • simplextree:SimplexTreeMulti, the multifiltered simplicial complex

  • degrees:array-like of ints, the degrees to compute

  • n_jobs:int, number of jobs. Defaults to #cpu, but when doing parallel computations of signed measures, we recommend setting this to 1.

  • verbose:bool, prints c++ logs.

Output

[signed_measure_of_degree for degree in degrees] with signed_measure_of_degree of the form (dirac location, dirac weights).

multipers.slicer._is_slicer(input) bool

File: multipers/slicer.pyx (starting at line 4279)

Checks if the input is a slicer. Equivalent (but faster) to isinstance(input, multipers.slicer.Slicer_type).

Return type:

bool

multipers.slicer._rank_from_slicer(slicer, degrees: vector[indices_type], verbose: bool = False, n_jobs: int = 1, zero_pad: bool = False, grid_shape=None, plot: bool = False, return_raw: bool = False)

File: multipers/slicer.pyx (starting at line 4406)

multipers.slicer.from_bitmap(image, **slicer_kwargs)

File: multipers/slicer.pyx (starting at line 4109)

multipers.slicer.from_function_delaunay(points, grades, degree: int = -1, backend: _valid_pers_backend | None = None, vineyard: bool | None = None, dtype=np.float64, verbose: bool = False, clear: bool = True)

File: multipers/slicer.pyx (starting at line 4144)

Given points in $mathbb R^n$ and function grades, compute the function-delaunay bifiltration as a in an scc format, and converts it into a slicer.

points : (num_pts, n) float array grades : (num_pts,) float array degree (opt) : if given, computes a minimal presentation of this homological degree first backend : slicer backend, e.g. “matrix”, “clement” vineyard : bool, use a vineyard-compatible backend

Parameters:
  • backend (Literal['Matrix', 'GudhiCohomology'] | None)

  • vineyard (bool | None)

multipers.slicer.get_matrix_slicer(is_vineyard: bool, is_k_critical: bool, dtype: type, col: unicode, pers_backend: unicode)

File: multipers/slicer.pyx (starting at line 4338)

Given various parameters, returns the specific slicer type associated with them.

multipers.slicer.is_slicer(input, allow_minpres: bool = True) bool

File: multipers/slicer.pyx (starting at line 4297)

Return type:

bool

multipers.slicer.minimal_presentation(slicer, degree: int = -1, degrees: Iterable[int] = [], backend: Literal['mpfree', '2pac', ''] = 'mpfree', slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', vineyard: bool = True, id: str | None = None, dtype=None, n_jobs: int = -1, force: bool = False, **minpres_kwargs)

File: multipers/slicer.pyx (starting at line 4190)

Computes a minimal presentation of the multifiltered complex given by the slicer, and returns it as a slicer. Backends differents than mpfree are unstable.

Parameters:
  • degrees (Iterable[int])

  • backend (Literal['mpfree', '2pac', ''])

  • slicer_backend (Literal['matrix', 'clement', 'graph'])

  • id (Optional[str])

multipers.slicer.slicer2blocks(slicer, degree: int = -1, reverse: bool = True)

File: multipers/slicer.pyx (starting at line 4170)

Convert any slicer to the block format a.k.a. scc format for python

multipers.slicer.to_blocks(input)

File: multipers/slicer.pyx (starting at line 4306)

Converts input to blocks, if possible.

multipers.slicer.to_simplextree(s: Slicer_type, max_dim: int = -1) SimplexTreeMulti_type

File: multipers/slicer.pyx (starting at line 4241)

Turns a –simplicial– slicer into a simplextree.

Warning: Won’t work for non-simplicial complexes, i.e., complexes $K$ not satisfying $

orall sigma in K,, mathrm{dim}(sigma) = |\partial \sigma|-1$

Parameters:
Return type:

SimplexTreeMulti_KFi32 | SimplexTreeMulti_Fi32 | SimplexTreeMulti_KFf64 | SimplexTreeMulti_Ff64

multipers.test module

Module contents

multipers.SimplexTreeMulti(input=None, num_parameters: int = 2, dtype: type = np.float64, kcritical: bool = False, **kwargs) SimplexTreeMulti_type

File: multipers/simplex_tree_multi.pyx (starting at line 4749) SimplexTreeMulti constructor.

param other:

If other is None (default value), an empty SimplexTreeMulti is created. If other is a SimplexTree, the SimplexTreeMulti is constructed from a deep copy of other. If other is a SimplexTreeMulti, the SimplexTreeMulti is constructed from a deep copy of other.

type other:

SimplexTree or SimplexTreeMulti (Optional)

param num_parameters:

The number of parameter of the multi-parameter filtration.

type num_parameters:

int

returns:

An empty or a copy simplex tree.

rtype:

SimplexTreeMulti

raises TypeError:

In case other is neither None, nor a SimplexTree, nor a SimplexTreeMulti.

Parameters:

dtype (type)

Return type:

SimplexTreeMulti_KFi32 | SimplexTreeMulti_Fi32 | SimplexTreeMulti_KFf64 | SimplexTreeMulti_Ff64

multipers.Slicer(st=None, vineyard=None, reduce=False, reduce_backend=None, dtype=None, is_kcritical=None, column_type=None, backend=None, max_dim=None, return_type_only=False)

Given a simplextree or blocks (a.k.a scc for python), returns a structure that can compute persistence on line (or more) slices, eventually vineyard update, etc.

This can be used to compute interval-decomposable module approximations or signed measures, using, e.g.

  • multipers.module_approximation(this, *args)

  • multipers.signed_measure(this, *args)

Noteit is recommended and sometime required to apply

a minimal presentation before computing these functions !

mp.slicer.minimal_presentation(slicer, *args, **kwargs)

Input

  • st : SimplexTreeMulti or scc-like blocks or path to scc file

  • backend: slicer backend, e.g, “matrix”, “clement”, “graph”

  • vineyard: vineyard capable (may slow down computations if true)

Output

The corresponding slicer.

Parameters:
  • vineyard (bool | None)

  • reduce (bool)

  • reduce_backend (str | None)

  • dtype (int32 | float64 | None)

  • is_kcritical (bool | None)

  • column_type (Literal['INTRUSIVE_SET'] | None)

  • backend (Literal['Matrix', 'GudhiCohomology'] | None)

  • max_dim (int | None)

  • return_type_only (bool)

Return type:

_KSlicer_Matrix0_vine_i32 | _KSlicer_Matrix0_vine_f64 | _Slicer_Matrix0_vine_i32 | _Slicer_Matrix0_vine_f64 | _KSlicer_Matrix0_i32 | _KSlicer_Matrix0_f64 | _Slicer_Matrix0_i32 | _Slicer_Matrix0_f64 | _KSlicer_GudhiCohomology0_i32 | _KSlicer_GudhiCohomology0_f64 | _Slicer_GudhiCohomology0_i32 | _Slicer_GudhiCohomology0_f64

multipers.module_approximation(input: SimplexTreeMulti_type | Slicer_type | tuple, box: np.ndarray | None = None, max_error: float = -1, nlines: int = 500, slicer_backend: Literal['matrix', 'clement', 'graph'] = 'matrix', minpres: Literal['mpfree'] | None = None, degree: int | None = None, complete: bool = True, threshold: bool = False, verbose: bool = False, ignore_warning: bool = False, id='', direction: list = [], swap_box_coords: list = [], *, n_jobs: int = -1) PyModule_type

File: multipers/multiparameter_module_approximation.pyx (starting at line 90) Computes an interval module approximation of a multiparameter filtration.

input: SimplexTreeMulti or Slicer-like.

Holds the multifiltered complex.

max_error: positive float

Trade-off between approximation and computational complexity. Upper bound of the module approximation, in bottleneck distance, for interval-decomposable modules.

nlines: int = 200

Alternative to max_error; specifies the number of persistence computation used for the approximation.

box(Optional) pair of list of floats

Defines a rectangle on which to compute the approximation. Format : [x,y], This defines a rectangle on which we draw the lines, uniformly drawn (with a max_error step). The first line is x. Warning: For custom boxes, and directions, you must ensure that the first line captures a generic barcode.

direction: float[:] = []

If given, the line are drawn with this angle. Warning: You must ensure that the first line, defined by box, captures a generic barcode.

slicer_backend: Either “matrix”,”clement”, or “graph”.

If a simplextree is given, it is first converted to this structure, with different choices of backends.

minpres: (Optional) “mpfree” only for the moment.

If given, and the input is a simplextree, computes a minimal presentation before starting the computation. A degree has to be given.

degree: int Only required when minpres is given.

Homological degree of the minimal degree.

threshold: bool

When true, intersects the module support with the box, i.e. no more infinite summands.

verbose: bool

Prints C++ infos.

ignore_warningbool

Unless set to true, prevents computing on more than 10k lines. Useful to prevent a segmentation fault due to “infinite” recursion.

PyModule

An interval decomposable module approximation of the module defined by the homology of this multi-filtration.

Parameters:
Return type:

PyModule_f32 | PyModule_f64

multipers.signed_measure(filtered_complex, degree=None, degrees=[], mass_default=None, grid_strategy='exact', invariant=None, plot=False, verbose=False, n_jobs=-1, expand_collapse=False, backend=None, thread_id='', grid=None, coordinate_measure=False, num_collapses=0, clean=None, vineyard=False, grid_conversion=None, **infer_grid_kwargs)

Computes the signed measures given by the decomposition of the hilbert function or the euler characteristic, or the rank invariant.

Input

  • filtered_complex: given by a simplextree or a slicer.

  • degree:int|None / degrees:list[int] the degrees to compute. None represents the euler characteristic.

  • mass_default: Either None, or ‘auto’ or ‘inf’, or array-like of floats. Where to put the default mass to get a zero-mass measure. This corresponds to zero-out the filtered complex outside of ${ xin mathbb R^n mid xle mass_default}$

  • invariant: The invariant to use, either “hilbert”, “rank”, or “euler”.

  • plot:bool, plots the computed measures if true.

  • n_jobs:int, number of jobs. Defaults to #cpu.

  • verbose:bool, prints c++ logs.

  • expand_collapse: when the input is a simplextree, only expands the complex when computing 1-dimensional slices. Meant to reduce memory footprint at some computational expense.

  • backend:str reduces first the filtered complex using an external library backend,

    see backend in multipers.io.reduce_complex().

  • grid: If given, the computations will be done on the restriction of the filtered complex to this grid.

    It can also be used for auto-differentiation, i.e., if the grid is a list of pytorch tensors, then the output measure will be pytorch-differentiable.

  • grid_strategy: If not squeezed yet, and no grid is given, the strategy to coarsen the grid; see strategy in multipers.grids.compute_grid().

  • coordinate_measure: bool, if True, compute the signed measure as a coordinates given in grid.

  • num_collapses: int, if filtered_complex is a simplextree, does some collapses if possible.

  • clean: if True, reduces the measure. It is not necessary in general.

Output

[signed_measure_of_degree for degree in degrees] with signed_measure_of_degree of the form (dirac location, dirac weights).

Notes on computational backends

There are several backends for each of these computations. The backend for computations used can be displayed with verbose=True, use it! Also note that if backend is given, then the input will be converted to a slicer.

  • Euler: is always computed by summing the weights of the simplices

  • Hilbert: is computed by computing persistence on slices, and a Möbius inversion, unless the detected input is a minimal presentation (i.e., filtered_complex.is_minpres), which in that case, doesn’t need any computation. - If the input is a simplextree, this is done via a the standard Gudhi implementation,

    with parallel (TBB) computations of slices.

    • If the input is a slicer then - If the input is vineyard-capable, then slices are computed via vineyards updates.

      It is slower in general, but faster if single threaded. In particular, it is usually faster to use this backend if you want to compute the signed measure of multiple datasets in a parallel context.

      • Otherwise, slices are computed in parallel. It is usually faster to use this backend if not in a parallel context.

  • Rank: Same as Hilbert.

Parameters:
Return type:

list[tuple[ndarray, ndarray]]