rust-ndarray / ndarray

ndarray: an N-dimensional array with array views, multidimensional slicing, and efficient operations
https://docs.rs/ndarray/
Apache License 2.0
3.53k stars 297 forks source link

accumulate_axis_inplace bug ? #1276

Closed yinshurman closed 1 year ago

yinshurman commented 1 year ago

Is this a bug ?

 let mut a =array![3.,4.,5.,6.,7.,8.,9.0];
 a.accumulate_axis_inplace(Axis(0),|&prev,curr| {*curr *= prev  })
// now a is [3.0, 12.0, 20.0, 30.0, 42.0, 336.0, 3024.0], shape=[7], strides=[1], layout=CFcf (0xf), const ndim=1

 let mut b =array![3.,4.,5.,6.,7.,8.,9.0];
 b.accumulate_axis_inplace(Axis(0),|&prev,curr| {println!("{prev}--{curr}"); *curr *= prev  })
// now b is [3.0, 12.0, 60.0, 360.0, 2520.0, 20160.0, 181440.0], shape=[7], strides=[1], layout=CFcf (0xf), const ndim=1

ps: ndarray version ^0.15 rust 1.68.1 windows 11

bluss commented 1 year ago

Cannot reproduce. Make some code that outputs the arrays. Give actual output and expected output, and ndarray version thanks

yinshurman commented 1 year ago

weird. it seems to be a bug of evcxr . b89e2aa01ed7dd82acbaa11a76ca28d

with evcxr versin 0.14.2 cargo version 1.68.1 ndarray version 0.15.6 windows 11 powershell 7