From 9b96dad9564836f131a86233b6ba84744264088a Mon Sep 17 00:00:00 2001 From: Palash Tyagi <23239946+Magnus167@users.noreply.github.com> Date: Sat, 26 Apr 2025 02:45:18 +0100 Subject: [PATCH] Refactor Axis enum definition: move to appropriate location and remove duplicate --- src/matrix/mat.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/matrix/mat.rs b/src/matrix/mat.rs index 20ff191..284be31 100644 --- a/src/matrix/mat.rs +++ b/src/matrix/mat.rs @@ -192,6 +192,16 @@ impl<'a, T> MatrixRow<'a, T> { (0..self.matrix.cols).map(move |c| &self.matrix[(self.row, c)]) } } + +/// Specifies the axis along which to perform a reduction operation. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Axis { + /// Apply reduction along columns (vertical axis). + Col, + /// Apply reduction along rows (horizontal axis). + Row, +} + /// A trait to turn either a Matrix or a scalar T into a Vec of /// length rows*cols (broadcasting the scalar). pub trait Broadcastable { @@ -335,14 +345,6 @@ impl Not for Matrix { } } -/// Specifies the axis along which to perform a reduction operation. -#[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub enum Axis { - /// Apply reduction along columns (vertical axis). - Col, - /// Apply reduction along rows (horizontal axis). - Row, -} #[cfg(test)] mod tests {