Module conversions

Module conversions 

Source
Expand description

Type conversion utilities for Python integration

This module provides comprehensive conversion utilities between Python types and scirs2-core types, with a focus on performance and correctness.

Structs§

MemoryLayoutInfo
Information about NumPy array memory layout

Functions§

get_memory_layout_info
Get detailed memory layout information from NumPy array
numpy_to_scirs_array1
Convert NumPy array to scirs2 Array1
numpy_to_scirs_array2
Convert NumPy array to scirs2 Array2
py_float_to_f32
Convert Python float to Rust f32
py_float_to_f64
Convert Python float to Rust f64
py_int_to_i32
Convert Python int to Rust i32
py_int_to_i64
Convert Python int to Rust i64
py_list_to_vec_f32
Convert Python list to Rust Vec<f32>
py_list_to_vec_i32
Convert Python list to Rust Vec<i32>
py_list_to_vec_usize
Convert Python list to Rust Vec<usize>
py_shape_to_vec
Convert Python shape tuple to Rust Vec<usize>
rust_dtype_to_numpy_str
Get NumPy dtype string for a Rust type
scirs_array1_to_numpy
Convert scirs2 Array1 to NumPy
scirs_array2_to_numpy
Convert scirs2 Array2 to NumPy
shape_to_py_tuple
Convert Rust shape Vec to Python tuple
validate_numpy_array
Validate NumPy array meets scirs2 requirements