geomfum.numerics package#
Submodules#
geomfum.numerics.eig module#
Module for eigenvalue solver.
- class geomfum.numerics.eig.ScipyEigsh(spectrum_size=6, sigma=None, which='LM')[source]#
Bases:
objectSparse eigenvalue solver using SciPy’s ARPACK wrapper.
- Parameters:
spectrum_size (int, optional) – Number of eigenvalues and eigenvectors to compute (default: 6).
sigma (float, optional) – Shift for shift-invert mode. If None, standard mode is used.
which (str, optional) – Which eigenvalues to find: ‘LM’ (largest magnitude), ‘SM’ (smallest magnitude), ‘LA’ (largest algebraic), ‘SA’ (smallest algebraic), etc. (default: ‘LM’).
geomfum.numerics.graph module#
Routines for working with graphs.
- geomfum.numerics.graph.single_source_partial_dijkstra_path_length(graph, source, k, weight='weight')[source]#
Compute shortest-path distances from a source node to the k closest nodes.
Based on cumulative path cost, using an early-stopped Dijkstra’s algorithm.
The search terminates once k nodes (including the source itself) have been reached.
- Parameters:
graph (networkx.Graph) – The input graph. Can be directed or undirected. Edge weights must be non-negative.
source (node) – The starting node for paths.
k (int) – Number of nodes to find distances to (including the source itself).
- Returns:
length (dict) – Dict keyed by node to shortest path length from source.
geomfum.numerics.optimization module#
Optimization routines.
- class geomfum.numerics.optimization.ScipyMinimize(method='L-BFGS-B', bounds=None, constraints=(), tol=None, callback=None, options=None, save_result=False)[source]#
Bases:
objectBackend-agnostic wrapper for SciPy’s optimization routines.
- Parameters:
method (str, optional) – Optimization algorithm (default: ‘L-BFGS-B’).
bounds (sequence, optional) – Bounds on variables for constrained methods.
constraints (dict or sequence of dict, optional) – Constraints definition.
tol (float, optional) – Tolerance for termination.
callback (callable, optional) – Function called after each iteration.
options (dict, optional) – Solver-specific options.
save_result (bool, optional) – Whether to save the optimization result (default: False).
Module contents#
Numerics Module. This module contains numerical methods and utilities used in Geomfum.