ezarrays Python Module Reference

 

MultiArray Class Reference

Array2DEZ Arrays

Defines a true multi-dimensional array of 2 or more dimensions. The elements of the array, which store Python references, can be accessed using subscript notation, x[i, j]. A multi-dimensional array is implemented as a single 1-D array with the elements stored in "row-major" order.

Public Methods

MultiArray(d1, d2, ... dN)
Creates a multi-dimensional array organized into N-dimensions.
v = x[i1, i2, ... iN]
Returns the value stored in an element of the array.
x[i1, i2, ... iN] = value
Stores a new value into a specific element of the array.
clear()
Clears the array by setting every element to None.
clear(value)
Sets every element to a given value.
dims()
Returns the number of dimensions in the multi-dimensional array.
length(dim)
Returns the length of the given dimension.

Detailed Description

MultiArray(d1, d2, ... dN)
Creates a multi-dimensional array organized into N-dimensions. The number of dimensions is based on the number of arguments provided and the value of each argument determines the length of each dimension. The elements of the array are initialized to None.
Parameters:
d1, d2, ... dN
The size or length of each dimension of the array. The dimensions are specified from highest to lowest, where d1 is the highest possible dimension and dN the lowest. N must be >= 2.
dims()
Returns the number of dimensions in the multi-dimensional array.
Returns:
The number of dimensions.
length(dim)
Returns the length of the given dimension.
Parameters:
dim
The dimension of the N-dimensional array for which the length is returned. The dimensions are numbered from 1 through N, with dimension 1 being the highest dimension and dimension N being the lowest.
Returns:
The length of the given dimension.
clear()
Clears the array by setting every element to None.
clear(value)
Sets every element to a given value. All of the elements will reference the same object, not separate copies.
Parameters:
value
The value to be stored in each element of the array.
__getitem__: v = x[i1, i2, ... iN]
Returns the value stored in an element of the array.
Parameters:
i1, i2, ... iN
The position of the element whose value is to be returned. The position of an element is defined by the index of that element within each dimension. There must be one index value for each dimension of the array and all indices must be >= 0 and less than the length of the given dimension.
Returns:
The value stored in the given array element.
Exceptions:
IndexError
__setitem__: x[i1, i2, ... iN] = value
Stores a new value into a specific element of the array. The contents of the array element in the given row and column is changed to value.
Parameters:
i1, i2, ... iN
The position of the element whose value is to be changed. The position of an element is defined by the index of that element within each dimension. There must be one index value for each dimension of the array and all indices must be >= 0 and less than the length of the given dimension.
Returns:
The value stored in the given array element.
Exceptions:
IndexError



Array2DEZ Arrays
Print -- Recent Changes
Page last modified on March 06, 2013, at 04:24 PM