Skip to main content

Crate embedded_matrix

Crate embedded_matrix 

Source
Expand description

§embedded-matrix

Matrices 2×2 et 3×3 en f32 pour systèmes embarqués no_std.

Sans dépendance, sans unsafe.

use embedded_matrix::{Matrix2x2, Matrix3x3, MatrixError};

// Identité 2×2
let i2 = Matrix2x2::identity();

// Produit matriciel avec l'opérateur *
let a = Matrix3x3::new([
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0],
    [7.0, 8.0, 9.0],
]);
let b = Matrix3x3::identity();
let c = a * b;  // == a, syntaxe opérateur

// Addition et soustraction
let d = a + b;
let e = d - b;

// Scalaire
let f = a * 2.0;

// Inversion (retourne Err si singulière)
match Matrix2x2::identity().inv() {
    Ok(inv) => { let _ = inv; }
    Err(MatrixError::SingularMatrix) => { /* gérer */ }
}

Structs§

Matrix2x2
Matrice 2×2 en f32, stockée en row-major.
Matrix3x3
Matrice 3×3 en f32, stockée en row-major.

Enums§

MatrixError
Erreur retournée lors d’une opération invalide sur une matrice.