Multidimensional arrays and some manipulations with VectorZ
Code: "vectorz1.py". Programming language: Python DMelt Version 2.29. Last modified: 11/25/2018. License: Pro
https://datamelt.org/code/cache/vectorz1_4029.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.


# Create a multidimensional arrays and do some manipulations

from mikera.arrayz import NDArray;

#  create a new 3x3x3 array
a1=NDArray.newArray(3,3,3)

# fill a slice on dimension 1 with zeros
a1.slice(1,1).fill(2.0)

# add 1.0 to the first slice (on dimension 0 by default)
a1.slice(0).add(1)

print a1




Ads help maintain this website.