Optimizing element-wise operations #1240
-
| Hi, I'm new to Rust and ndarray and have been tinkering with element-wise array operations. Below is the code snippet to multiply five arrays and write to  The code in the  I also tried  pub fn mul_1d_inplace<'a>(arr_out: &'a mut Array1::<f64>,
                          arr1: &'a Array1::<f64>,
                          arr2: &'a Array1::<f64>,
                          arr3: &'a Array1::<f64>,
                          arr4: &'a Array1::<f64>,
                          arr5: &'a Array1::<f64>,
                          ) -> Option<f64> {
    for i in 0..arr1.len() {
        arr_out[i] = arr1[i] * arr2[i] * arr3[i] * arr4[i] * arr5[i];
    }
    // *arr_out = arr1 * arr2 * arr3 * arr4 * arr5;  // slower
    None
} | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
| Please have a look at the  | 
Beta Was this translation helpful? Give feedback.
Please have a look at the
Ziptype and for convenience theazip!macro.