From 4c020061531a4d4a3c6c3c6d421091acf997113b Mon Sep 17 00:00:00 2001 From: Palash Tyagi <23239946+Magnus167@users.noreply.github.com> Date: Sat, 3 May 2025 00:29:14 +0100 Subject: [PATCH] Optimize column swapping logic to handle empty matrices and prevent unnecessary swaps --- src/matrix/mat.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/matrix/mat.rs b/src/matrix/mat.rs index 14e5937..4ef1c4f 100644 --- a/src/matrix/mat.rs +++ b/src/matrix/mat.rs @@ -148,12 +148,7 @@ impl Matrix { c2, self.cols ); - if c1 == c2 { - return; - } - - if self.rows == 0 { - self.data.swap(c1, c2); + if c1 == c2 || self.rows == 0 || self.cols == 0 { return; }