yasfpy.coupling.factory#

Factory for per-simulation dense coupling operations.

The dense coupling backend uses a low-level “ops” object that performs matvecs and owns any per-simulation caches/buffers.

This module provides a single entry point get_dense_coupling_ops() that selects a CPU or CUDA implementation at runtime.

Functions#

get_dense_coupling_ops(sim)

Return a per-simulation dense coupling ops instance.

Module Contents#

yasfpy.coupling.factory.get_dense_coupling_ops(sim)#

Return a per-simulation dense coupling ops instance.

Parameters:

sim – Simulation instance.

Returns:

A CPU or CUDA implementation of yasfpy.coupling.ops.DenseCouplingOps.

Return type:

DenseCouplingOps

Notes

The returned object is cached on the simulation instance under sim._dense_coupling_ops so repeated matvec calls reuse internal buffers.

If sim.numerics.gpu is true but Numba CUDA is unavailable, the factory falls back to CPU ops (and emits a warning).