_engine module¶
Centralized engine resolution for dispatching between Numba and Rust engines.
array_and_non_neg_int_compatible_with_rust function¶
array_and_non_neg_int_compatible_with_rust(
a,
name,
value
)
Return whether an array and a non-negative integer parameter are compatible with the Rust engine.
array_compatible_with_rust function¶
array_compatible_with_rust(
a,
dtype=numpy.float64
)
Return whether the array is compatible with the Rust engine.
array_shape_compatible_with_rust function¶
array_shape_compatible_with_rust(
name,
a,
shape
)
Return whether an array has the exact shape required by Rust.
broadcast_2d_to_shape function¶
broadcast_2d_to_shape(
a,
shape,
dtype=None
)
Cast array to dtype if provided, reshape to 2D, and broadcast to shape.
broadcast_to_shape function¶
broadcast_to_shape(
a,
shape,
dtype=None
)
Cast array to dtype if provided and broadcast to shape.
callback_unsupported_with_rust function¶
callback_unsupported_with_rust()
Return Rust support for callback-accepting functions.
clear_engine_cache function¶
clear_engine_cache()
Clear cached engine availability checks.
col_map_compatible_with_rust function¶
col_map_compatible_with_rust(
col_map
)
Return whether a column map (pair of arrays) is compatible with the Rust engine.
col_range_compatible_with_rust function¶
col_range_compatible_with_rust(
col_range
)
Return whether a ColRange (2D int64 array) is compatible with the Rust engine.
combine_rust_support function¶
combine_rust_support(
*support_results
)
Return the first unsupported Rust support result.
exact_array_compatible_with_rust function¶
exact_array_compatible_with_rust(
a,
dtype=numpy.float64
)
Return whether the array already has the exact dtype expected by Rust.
flex_array_compatible_with_rust function¶
flex_array_compatible_with_rust(
name,
a,
shape,
dtype=numpy.float64,
flex_2d=True
)
Return whether an array-like can be broadcast and cast before Rust dispatch.
is_rust_available function¶
is_rust_available()
Return whether vectorbt-rust is installed and version-compatible.
mask_and_array_compatible_with_rust function¶
mask_and_array_compatible_with_rust(
a,
mask
)
Return whether an array and its boolean mask are compatible with the Rust engine.
mask_and_values_compatible_with_rust function¶
mask_and_values_compatible_with_rust(
a,
mask,
values
)
Return whether an array, its mask, and replacement values are compatible with the Rust engine.
matching_shape_compatible_with_rust function¶
matching_shape_compatible_with_rust(
name,
a,
other
)
Return whether two arrays have the same shape.
non_neg_array_compatible_with_rust function¶
non_neg_array_compatible_with_rust(
name,
a
)
Return whether an array contains only non-negative int64 values for Rust.
non_neg_int_compatible_with_rust function¶
non_neg_int_compatible_with_rust(
name,
value
)
Return whether a Python integer parameter can be passed to Rust as usize.
prepare_array_for_rust function¶
prepare_array_for_rust(
a,
dtype=numpy.float64
)
Return a as the exact dtype expected by Rust.
Exact dtype arrays are returned unchanged. Other arrays are accepted only when NumPy considers the cast safe.
prepare_flex_array_for_rust function¶
prepare_flex_array_for_rust(
a,
shape,
dtype=numpy.float64,
flex_2d=True,
name='array'
)
Return a compact flexible array for Rust without broadcasting to shape.
resolve_engine function¶
resolve_engine(
engine=None,
supports_rust=RustSupport(supported=True, reason='', conversions=())
)
Resolve which engine to use for a given function call.
Set engine to override the global settings['engine']. Set supports_rust to a RustSupport instance for callback-accepting functions, unsupported dtypes, or any other condition that prevents Rust dispatch.
Returns 'numba' or 'rust'.
resolve_random_engine function¶
resolve_random_engine(
engine=None
)
Resolve engine for randomized functions.
Randomized functions default to Numba, including engine='auto', to preserve legacy NumPy/Numba random streams unless an engine is requested explicitly.
rolling_compatible_with_rust function¶
rolling_compatible_with_rust(
a,
window,
minp
)
Return whether rolling arguments are compatible with the Rust engine.
scalar_compatible_with_rust function¶
scalar_compatible_with_rust(
name,
value
)
Return whether a scalar can be passed to Rust as f64.
seed_for_rust function¶
seed_for_rust(
seed,
engine,
supports_rust
)
Return seed only when the resolved engine is Rust.
unit_interval_compatible_with_rust function¶
unit_interval_compatible_with_rust(
name,
value
)
Return whether a scalar lies within the closed unit interval.
RustConversion class¶
RustConversion(
dtype,
n_elements
)
Array conversion required before calling the Rust engine.
dtype class variable¶
Target NumPy dtype expected by Rust.
n_elements class variable¶
Number of array elements to be converted.
RustSupport class¶
RustSupport(
supported,
reason='',
conversions=<factory>
)
Rust support result for an engine-neutral function call.
conversions class variable¶
Soft array conversions required before calling Rust.
reason class variable¶
Reason shown when this function call cannot use the Rust engine.
requires_conversion property¶
Whether this call needs any soft conversion before Rust dispatch.
supported class variable¶
Whether the Rust engine supports this function call.