Version 1.0b1 API Documentation generated by Endo 2006-08-14
row_stack = vstack
Execute func1d(arr[i],*args) where func1d takes 1-D arrays and arr is an N-d array. i varies so as to apply the function along the given axis for each 1-d subarray in arr.
Apply a function repeatedly over multiple axes, keeping the same shape for the resulting array.
func is called as res = func(a, axis). The result is assumed to be either the same shape as a or have one less dimension. This call is repeated for each axis in the axes sequence.
Divide an array into a list of sub-arrays.
Force a sequence of arrays to each be at least 1D. Description: Force an array to be at least 1D. If an array is 0D, the array is converted to a single row of values. Otherwise, the array is unaltered. Arguments: *arys -- arrays to be converted to 1 or more dimensional array. Returns: input array converted to at least 1D array.
Force a sequence of arrays to each be at least 2D.
Force a sequence of arrays to each be at least 3D.
Stack 1D arrays as columns into a 2D array
>>> import numpy
>>> a = array((1,2,3))
>>> b = array((2,3,4))
>>> numpy.column_stack((a,b))
array([[1, 2],
[2, 3],
[3, 4]])
Split ary into multiple sub-arrays along the 3rd axis (depth)
>>> a = array([[[1,2,3,4],[1,2,3,4]]])
[array([ [[1, 2],
[1, 2]]]), array([ [[3, 4],
[3, 4]]])]
Stack arrays in sequence depth wise (along third dimension)
>>> import numpy
>>> a = array((1,2,3))
>>> b = array((2,3,4))
>>> numpy.dstack((a,b))
array([ [[1, 2],
[2, 3],
[3, 4]]])
>>> a = array([[1],[2],[3]])
>>> b = array([[2],[3],[4]])
>>> numpy.dstack((a,b))
array([[ [1, 2]],
[ [2, 3]],
[ [3, 4]]])
Expand the shape of a by including newaxis before given axis.
Split ary into multiple columns of sub-arrays
>>> import numpy
>>> a= array((1,2,3,4))
>>> numpy.hsplit(a,2)
[array([1, 2]), array([3, 4])]
>>> a = array([[1,2,3,4],[1,2,3,4]])
[array([[1, 2],
[1, 2]]), array([[3, 4],
[3, 4]])]
Stack arrays in sequence horizontally (column wise)
>>> import numpy
>>> a = array((1,2,3))
>>> b = array((2,3,4))
>>> numpy.hstack((a,b))
array([1, 2, 3, 2, 3, 4])
>>> a = array([[1],[2],[3]])
>>> b = array([[2],[3],[4]])
>>> numpy.hstack((a,b))
array([[1, 2],
[2, 3],
[3, 4]])
kronecker product of a and b Kronecker product of two matrices is block matrix [[ a[ 0 ,0]*b, a[ 0 ,1]*b, ... , a[ 0 ,n-1]*b ], [ ... ... ], [ a[m-1,0]*b, a[m-1,1]*b, ... , a[m-1,n-1]*b ]]
Repeat a 0-d to 2-d array mxn times
Divide an array into a list of sub-arrays.
Split ary into multiple rows of sub-arrays
How should we handle 1D arrays here? I am currently raising an error when I encounter them. Any better approach?
Should we reduce the returned array to their minium dimensions by getting rid of any dimensions that are 1?
Stack arrays in sequence vertically (row wise)
>>> import numpy
>>> a = array((1,2,3))
>>> b = array((2,3,4))
>>> numpy.vstack((a,b))
array([[1, 2, 3],
[2, 3, 4]])
>>> a = array([[1],[2],[3]])
>>> b = array([[2],[3],[4]])
>>> numpy.vstack((a,b))
array([[1],
[2],
[3],
[2],
[3],
[4]])
| Local name | Refers to |
|---|---|
| array | multiarray.array |
| asanyarray | numpy.core.numeric.asanyarray |
| asarray | numpy.core.numeric.asarray |
| concatenate | numpy.core.numeric.concatenate |
| isscalar | numpy.core.numeric.isscalar |
| newaxis | numpy.core.numeric.newaxis |
| outer | numpy.core.numeric.outer |
| product | numpy.core.fromnumeric.product |
| reshape | numpy.core.fromnumeric.reshape |
| zeros | numpy.core.numeric.zeros |
| _nx | numpy.core.numeric |