ce5030ff13f054bbc7c9924e75d7dc6835bd9c38 — axect 3 months ago e57c0cc
little bit optimize
1 files changed, 11 insertions(+), 10 deletions(-)

M src/structure/matrix.rs
M src/structure/matrix.rs => src/structure/matrix.rs +11 -10
@@ 1981,17 1981,18 @@ impl LinearAlgebra for Matrix {
             }
             One => {
                 let mut m = std::f64::MIN;
-                let a = match self.shape {
-                    Row => self.change_shape(),
-                    Col => self.clone(),
-                };
-                for c in 0..a.col {
-                    let s = a.col(c).reduce(0f64, |x, y| x + y);
-                    if s > m {
-                        m = s;
-                    }
+                match self.shape {
+                    Row => self.change_shape().norm(One),
+                    Col => {
+                        for c in 0..self.col {
+                            let s = self.col(c).reduce(0f64, |x, y| x + y);
+                            if s > m {
+                                m = s;
+                            }
+                        }
+                        m
+                    },
                 }
-                m
             }
             Infinity => {
                 let mut m = std::f64::MIN;