Issue
h = numpy.zeros((2,2,2))
What is the last 2 for? Is it creating a multidimensional array or something?
Output:
array([[[ 0., 0.],
[ 0., 0.]],
[[ 0., 0.],
[ 0., 0.]]])
If it is creating number of copies, then what is happening when i do the following?
h = numpy.zeros((2,2,1))
Output:
array([[[ 0.],
[ 0.]],
[[ 0.],
[ 0.]]])
I understand that it is getting filled by zeros, and the first two values are specifying the row and column, what about the third? Thank you in advance. And I tried Google, but I could not word my questions.
Solution
by giving three arguments you're creating a three-dimensional array:
numpy.array((2,2,2))
results in an array of size 2x2x2:
0---0
/ /|
0---0 0
| |/
0---0
numpy.array((2,2,1))
results in an array of size 2x2x1:
0---0
| |
0---0
numpy.array((2,1,2))
results in an array of size 2x2x1:
0---0
/ /
0---0
numpy.array((1,2,2))
results in an array of size 2x2x1:
0
/|
0 0
|/
0
in these representations the matrix "might look like numpy.array((2,2))
" (a 2x2 array) however the underlying structure is still three dimensional.
Answered By - Nils Werner
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.