From 82b496074068f25b59ecc8098bb42eab13bc9a8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sat, 14 Jan 2023 15:48:42 +0100 Subject: [PATCH] Better coding-style in the doc-tests. --- src/base/par_iter.rs | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/base/par_iter.rs b/src/base/par_iter.rs index 820c408a..0f1202c9 100644 --- a/src/base/par_iter.rs +++ b/src/base/par_iter.rs @@ -169,20 +169,19 @@ where /// Using parallel column iterators to calculate the sum of the maximum /// elements in each column: /// ``` - /// use nalgebra::{dmatrix,DMatrix}; + /// use nalgebra::{dmatrix, DMatrix}; /// use rayon::prelude::*; /// - /// let matrix : DMatrix = - /// nalgebra::dmatrix![1.,0.,5.; - /// 2.,4.,1.; - /// 3.,2.,2.;]; - /// let sum_of_max :f64 = - /// matrix - /// .par_column_iter() - /// .map(|col|col.max()) - /// .sum(); + /// let matrix : DMatrix = dmatrix![1.0, 0.0, 5.0; + /// 2.0, 4.0, 1.0; + /// 3.0, 2.0, 2.0; + /// ]; + /// let sum_of_max :f64 = matrix + /// .par_column_iter() + /// .map(|col| col.max()) + /// .sum(); /// - /// assert_eq!(sum_of_max,3.+4.+5.); + /// assert_eq!(sum_of_max,3.0 + 4.0 + 5.0); /// /// ``` /// @@ -200,17 +199,16 @@ where /// Normalize each column of a matrix with respect to its own maximum value. /// /// ``` - /// use nalgebra::{dmatrix,DMatrix}; + /// use nalgebra::{dmatrix, DMatrix}; /// use rayon::prelude::*; /// - /// let mut matrix : DMatrix = - /// dmatrix![2.,4.,6.; - /// 1.,2.,3.]; + /// let mut matrix : DMatrix = dmatrix![ + /// 2.0, 4.0, 6.0; + /// 1.0, 2.0, 3.0; + /// ]; /// matrix.par_column_iter_mut().for_each(|mut col| col /= col.max()); /// - /// assert_eq!(matrix, - /// dmatrix![1. ,1. , 1.; - /// 0.5,0.5,0.5]); + /// assert_eq!(matrix, dmatrix![1.0, 1.0, 1.0; 0.5, 0.5, 0.5]); /// ``` /// /// [`par_column_iter`]: crate::Matrix::par_column_iter