Expand description
§accelerate-rs
Safe Rust bindings for Apple’s
Accelerate
framework on macOS using pure C FFI.
The GitHub repository is accelerate-rs; the published crates.io package is
apple-accelerate.
§Install
cargo add apple-accelerate§Quick start
use apple_accelerate::{add_f32, sgemm_row_major};
let added = add_f32(&[1.0, 2.0, 3.0], &[4.0, 5.0, 6.0]).expect("vector add");
assert_eq!(added, vec![5.0, 7.0, 9.0]);
let mut output = vec![0.0_f32; 4];
sgemm_row_major(
2,
2,
3,
1.0,
&[1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
&[7.0, 8.0, 9.0, 10.0, 11.0, 12.0],
0.0,
&mut output,
)
.expect("sgemm");
assert_eq!(output, vec![58.0, 64.0, 139.0, 154.0]);§v0.1 surface
- Safe
vDSPhelpers for FFT setup, vector arithmetic, dot product, reductions, and window generation - Safe
CBLAShelpers forsdot, row-majorsgemv, and row-majorsgemm - Safe
vImagehelpers for ARGB8888 rotate / box-convolve / scale and Planar8 contrast stretch - Thin unsafe BNNS filter wrapper for convolution / fully connected create-apply-destroy workflows
- Raw
ffimodule exposing the underlying C types and functions
§Smoke examples
cargo run --example 01_vdsp_fft
cargo run --example 02_blas_vimageRe-exports§
pub use crate::blas::blas_order;pub use crate::blas::blas_transpose;pub use crate::blas::sdot;pub use crate::blas::sgemm_row_major;pub use crate::blas::sgemv_row_major;pub use crate::bnns::Filter as BnnsFilter;pub use crate::error::Error;pub use crate::error::Result;pub use crate::vdsp::add_f32;pub use crate::vdsp::blackman_window;pub use crate::vdsp::dot_f32;pub use crate::vdsp::fft_direction;pub use crate::vdsp::fft_radix;pub use crate::vdsp::hamming_window;pub use crate::vdsp::max_f32;pub use crate::vdsp::mean_f32;pub use crate::vdsp::min_f32;pub use crate::vdsp::sub_f32;pub use crate::vdsp::sum_f32;pub use crate::vdsp::window_flags;pub use crate::vdsp::BiquadSetup;pub use crate::vdsp::FftSetup;pub use crate::vimage::box_convolve_argb8888;pub use crate::vimage::contrast_stretch_planar8;pub use crate::vimage::rotate_argb8888;pub use crate::vimage::scale_argb8888;pub use crate::vimage::vimage_flags;pub use crate::vimage::ImageBuffer;