How kthtda/stablebear works
stablebear is a Python package with C++ and optional CUDA backends for scalable computation on piecewise-constant functions and topological data analysis. The principal workflow is to create typed tensor, point-cloud, or distance-matrix inputs; apply functional or similarity operations, or compute persistence-related outputs; and consume results through Python objects or serialization. The graph preserves the documented reductions, kernels, persistence statistics, sampling, and point-process capabilities. Some subsystem links are based on README statements rather than inspected implementation excerpts; those are marked dashed.
Main entry points: _sb_cpp.py Backend selection · distance_matrix.py Distance matrices · __init__.py Package facade · point_cloud.py Point clouds
Components 22
Python API
- Package facade
stablebear/__init__.py - Serialization and IO
stablebear/io.py
Data and functions
- Tensor operations
stablebear/_tensor_base.py - Typed tensors
stablebear/base_tensor.py - Tensor creation
stablebear/tensor_create.py - PCF functions
stablebear/functional/pcf.py - Nested tensors
stablebear/nested_tensor.py - Point clouds
stablebear/point_cloud.py
Analysis
- Distance matrices
stablebear/distance_matrix.py - Similarity operations
stablebear/distance.py - Reductions and norms
stablebear/reductions.py - Random sampling
stablebear/random/subsample.py - Point processes
stablebear/point_process/poisson.py
Compute runtime
- Backend selection
stablebear/_sb_cpp.py - Python C++ bindings
src/python/py_tensor.hpp - C++ compute core
include/sbear/tensor.hpp - C++ PCF algorithms
include/sbear/functional/pcf.hpp - C++ persistence algorithms
include/sbear/persistence/compute_homological_kernel.hpp
Persistent homology
- Homology computations
stablebear/persistence/homology.py - Homological kernel
stablebear/persistence/homological_kernel.py - Barcode results
stablebear/persistence/ph_tensor.py
Other components
- Python user
Connections 29
- Python user → Package facade: uses
README.md - Package facade → Tensor operations: exports
stablebear/__init__.py - Package facade → Point clouds: exports
stablebear/__init__.py - Package facade → Distance matrices: exports
stablebear/__init__.py - Package facade → Serialization and IO: exports
stablebear/__init__.py - Tensor operations → Backend selection: calls
stablebear/_tensor_base.py - Tensor operations → Typed tensors: builds on
stablebear/base_tensor.py - Tensor creation → Typed tensors: constructs
stablebear/tensor_create.py - Tensor creation → Nested tensors: constructs
stablebear/tensor_create.py - Tensor creation → Point clouds: constructs
stablebear/tensor_create.py - PCF functions → Backend selection: calls
stablebear/functional/pcf.py - Point clouds → Typed tensors: wraps
stablebear/point_cloud.py - Distance matrices → Backend selection: calls
stablebear/distance_matrix.py - Similarity operations → Distance matrices: computes matrices
- Reductions and norms → Typed tensors: reduces
- Random sampling → Backend selection: samples with
stablebear/random/subsample.py - Random sampling → Point clouds: accepts
stablebear/random/subsample.py - Random sampling → Distance matrices: accepts
stablebear/random/subsample.py - Point processes → Backend selection: generates with
stablebear/point_process/poisson.py - Homology computations → Backend selection: dispatches to
stablebear/persistence/homology.py - Homology computations → Distance matrices: accepts
stablebear/persistence/homology.py - Homological kernel → Backend selection: spawns task
stablebear/persistence/homological_kernel.py - Homological kernel → Barcode results: writes output
stablebear/persistence/homological_kernel.py - Homological kernel → Distance matrices: accepts
stablebear/persistence/homological_kernel.py - Serialization and IO → Backend selection: uses binary IO
- Backend selection → Python C++ bindings: loads extension
- Python C++ bindings → C++ compute core: binds tensor API
src/python/py_tensor.hpp - C++ PCF algorithms → C++ compute core: uses tensor algorithms
include/sbear/functional/pcf.hpp - C++ persistence algorithms → Backend selection: provides computation