use super::vector::{F16x1, F16x16}; use core::fmt::Display; use nalgebra::{SMatrix, SVector}; #[repr(C, align(65536))] #[derive(Debug)] pub struct Matrix(pub [SMatrix; X16R]); #[repr(C, align(1024))] #[derive(Debug)] pub struct Vector(pub SVector); impl Display for Matrix { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { for block in self.0.iter() { block.fmt(f)? } Ok(()) } } impl From> for Matrix { fn from(matrix: SMatrix) -> Self { Self(core::array::from_fn(|i| { SMatrix::from_row_iterator( matrix .fixed_rows::<16>(i * 16) .transpose() .iter() .map(|e| *e) .array_chunks::<16>() .map(|chunk| F16x16(chunk)), ) })) } }