Home > OS >  Divide a java array like a numpy array
Divide a java array like a numpy array

Time:10-06

Is it possible to divide each element of a java float array by a constant, similarly to elementwise division possible with numPy arrays? Or is it necessary to iterate through the array with a loop and perform the division one by one?

CodePudding user response:

The class Arrays has nice utility functions:

Arrays.setAll(array, i -> array[i] / 2);
  • Related