@@ -13,8 +13,6 @@ use crate::imp_prelude::*;
1313use crate :: itertools:: enumerate;
1414use crate :: numeric_util;
1515
16- use crate :: { FoldWhile , Zip } ;
17-
1816/// # Numerical Methods for Arrays
1917impl < A , S , D > ArrayBase < S , D >
2018where
4846 sum
4947 }
5048
49+ /// Return the sum of all elements in the array.
50+ ///
51+ /// *This method has been renamed to `.sum()`*
52+ #[ deprecated( note="renamed to `sum`" , since="0.15.0" ) ]
53+ pub fn scalar_sum ( & self ) -> A
54+ where
55+ A : Clone + Add < Output = A > + num_traits:: Zero ,
56+ {
57+ self . sum ( )
58+ }
59+
5160 /// Returns the [arithmetic mean] x̅ of all elements in the array:
5261 ///
5362 /// ```text
7584 }
7685 }
7786
78- /// Return the sum of all elements in the array.
79- ///
80- /// *This method has been renamed to `.sum()` and will be deprecated in the
81- /// next version.*
82- // #[deprecated(note="renamed to `sum`", since="0.13")]
83- pub fn scalar_sum ( & self ) -> A
84- where
85- A : Clone + Add < Output = A > + num_traits:: Zero ,
86- {
87- self . sum ( )
88- }
89-
9087 /// Return the product of all elements in the array.
9188 ///
9289 /// ```
@@ -305,32 +302,4 @@ where
305302 {
306303 self . var_axis ( axis, ddof) . mapv_into ( |x| x. sqrt ( ) )
307304 }
308-
309- /// Return `true` if the arrays' elementwise differences are all within
310- /// the given absolute tolerance, `false` otherwise.
311- ///
312- /// If their shapes disagree, `rhs` is broadcast to the shape of `self`.
313- ///
314- /// **Panics** if broadcasting to the same shape isn’t possible.
315- #[ deprecated(
316- note = "Use `abs_diff_eq` - it requires the `approx` crate feature" ,
317- since = "0.13.0"
318- ) ]
319- pub fn all_close < S2 , E > ( & self , rhs : & ArrayBase < S2 , E > , tol : A ) -> bool
320- where
321- A : Float ,
322- S2 : Data < Elem = A > ,
323- E : Dimension ,
324- {
325- !Zip :: from ( self )
326- . and ( rhs. broadcast_unwrap ( self . raw_dim ( ) ) )
327- . fold_while ( ( ) , |_, x, y| {
328- if ( * x - * y) . abs ( ) <= tol {
329- FoldWhile :: Continue ( ( ) )
330- } else {
331- FoldWhile :: Done ( ( ) )
332- }
333- } )
334- . is_done ( )
335- }
336305}
0 commit comments