Trait HalfFloatVecExt
pub trait HalfFloatVecExt: SealedHalfFloatVec
Extensions to [Vec<f16>] and [Vec<bf16>] to support reinterpret operations.
This trait is sealed and cannot be implemented outside of this crate.
Required Methods
fn reinterpret_into(self) -> Vec<u16>Reinterprets a vector of [
struct@f16]orbf16numbers as a vector ofu16bits.This is a zero-copy operation. The reinterpreted vector has the same memory location as
self.Examples
# use *; let float_buffer = vec!; let int_buffer = float_buffer.reinterpret_into; assert_eq!;fn from_f32_slice(slice: &[f32]) -> SelfConverts all of the elements of a
[f32]slice into a new [struct@f16] orbf16vector.The conversion operation is vectorized over the slice, meaning the conversion may be more efficient than converting individual elements on some hardware that supports SIMD conversions. See [crate documentation][crate] for more information on hardware conversion support.
Examples
# use *; let float_values = ; let vec: = Vecfrom_f32_slice; assert_eq!;fn from_f64_slice(slice: &[f64]) -> SelfConverts all of the elements of a
[f64]slice into a new [struct@f16] orbf16vector.The conversion operation is vectorized over the slice, meaning the conversion may be more efficient than converting individual elements on some hardware that supports SIMD conversions. See [crate documentation][crate] for more information on hardware conversion support.
Examples
# use *; let float_values = ; let vec: = Vecfrom_f64_slice; assert_eq!;
Implementors
impl HalfFloatVecExt for Vec<bf16>impl HalfFloatVecExt for Vec<f16>