diff --git a/src/matrix/boolops.rs b/src/matrix/boolops.rs index c830139..bba5e6c 100644 --- a/src/matrix/boolops.rs +++ b/src/matrix/boolops.rs @@ -1,3 +1,14 @@ +//! Logical reductions for boolean matrices. +//! +//! The [`BoolOps`] trait mirrors common boolean aggregations such as `any` and +//! `all` over rows or columns of a [`BoolMatrix`]. +//! +//! ``` +//! use rustframe::matrix::{BoolMatrix, BoolOps}; +//! +//! let m = BoolMatrix::from_vec(vec![true, false], 2, 1); +//! assert!(m.any()); +//! ``` use crate::matrix::{Axis, BoolMatrix}; /// Boolean operations on `Matrix` diff --git a/src/matrix/mod.rs b/src/matrix/mod.rs index 509d449..1b4c372 100644 --- a/src/matrix/mod.rs +++ b/src/matrix/mod.rs @@ -1,3 +1,18 @@ +//! Core matrix types and operations. +//! +//! The [`Matrix`](crate::matrix::Matrix) struct provides a simple column‑major 2D array with a +//! suite of numeric helpers. Additional traits like [`SeriesOps`](crate::matrix::SeriesOps) and +//! [`BoolOps`](crate::matrix::BoolOps) extend functionality for common statistics and logical reductions. +//! +//! # Examples +//! +//! ``` +//! use rustframe::matrix::Matrix; +//! +//! let m = Matrix::from_cols(vec![vec![1, 2], vec![3, 4]]); +//! assert_eq!(m.shape(), (2, 2)); +//! assert_eq!(m[(0,1)], 3); +//! ``` pub mod boolops; pub mod mat; pub mod seriesops; diff --git a/src/matrix/seriesops.rs b/src/matrix/seriesops.rs index 99f89d3..ad6dffc 100644 --- a/src/matrix/seriesops.rs +++ b/src/matrix/seriesops.rs @@ -1,3 +1,14 @@ +//! Numeric reductions and transformations over matrix axes. +//! +//! [`SeriesOps`] provides methods like [`SeriesOps::sum_vertical`] or +//! [`SeriesOps::map`] that operate on [`FloatMatrix`] values. +//! +//! ``` +//! use rustframe::matrix::{Matrix, SeriesOps}; +//! +//! let m = Matrix::from_cols(vec![vec![1.0, 2.0], vec![3.0, 4.0]]); +//! assert_eq!(m.sum_horizontal(), vec![4.0, 6.0]); +//! ``` use crate::matrix::{Axis, BoolMatrix, FloatMatrix}; /// "Series-like" helpers that work along a single axis.