Package pyjsdl :: Module pyjsarray :: Class Ndarray

Class Ndarray

object --+
         |
        Ndarray

Instance Methods
 
__init__(self, dim, dtype='float64')
Generate an N-dimensional array of TypedArray data.
 
getshape(self)
Return array shape. Ndarray.shape accessible with compilation in --strict mode, and with --enable-descriptor-proto option in --optimized mode.
 
setshape(self, *dim)
Set shape of array. Argument is new shape. Raises TypeError if shape is not appropriate. Ndarray.shape accessible with compilation in --strict mode, and with --enable-descriptor-proto option in --optimized mode.
 
__getitem__(self, index)
 
__setitem__(self, index, value)
 
__getslice__(self, lower, upper)
 
__setslice__(self, lower, upper, data)
 
__iter__(self)
 
__str__(self)
str(x)
 
__repr__(self)
repr(x)
 
__len__(self)
 
__lt__(self, other)
 
__le__(self, other)
 
__eq__(self, other)
 
__ne__(self, other)
 
__gt__(self, other)
 
__ge__(self, other)
 
__add__(self, other)
 
__sub__(self, other)
 
__mul__(self, other)
 
__div__(self, other)
 
__truediv__(self, other)
 
__floordiv__(self, other)
 
__divmod__(self, other)
 
__mod__(self, other)
 
__pow__(self, other)
 
__neg__(self)
 
__pos__(self)
 
__abs__(self)
 
__matmul__(self, other)
 
__iadd__(self, other)
 
__isub__(self, other)
 
__imul__(self, other)
 
__idiv__(self, other)
 
__itruediv__(self, other)
 
__ifloordiv__(self, other)
 
__imod__(self, other)
 
__ipow__(self, other)
 
__lshift__(self, other)
 
__rshift__(self, other)
 
__and__(self, other)
 
__or__(self, other)
 
__xor__(self, other)
 
__ilshift__(self, other)
 
__irshift__(self, other)
 
__iand__(self, other)
 
__ior__(self, other)
 
__ixor__(self, other)
 
__invert__(self)
 
op(self, operator, other)
Arithemtic operation across array elements. Arguments include operator and int/array. Operators: 'add', 'sub', 'mul', 'div', etc. Return array of the operation. Note: operator special methods not called in Pyjs --optimized mode unless build with the --enable-operator-funcs option.
 
cmp(self, operator, other)
Comparison operation across array elements. Arguments include operator and int/array. Operators: 'lt', 'le', 'eq', 'ne', 'gt', 'ge'. Return comparison array. Note: comparison special methods not called.
 
matmul(self, other)
Matrix multiplication. Argument is an int or array. Return matrix multiplied array.
 
reshape(self, dim)
Return view of array with new shape. Argument is new shape. Raises TypeError if shape is not appropriate.
 
set(self, data)
Set array elements. Data argument can be a 1d/2d array or number used to set Ndarray elements, data used repetitively if consists of fewer elements than Ndarray.
 
fill(self, value)
Set array elements to value argument.
 
copy(self)
Return copy of array.
 
empty(self)
Return empty copy of array.
 
astype(self, dtype)
Return copy of array. Argument dtype is TypedArray data type.
 
view(self)
Return view of array.
 
swapaxes(self, axis1, axis2)
Swap axes of array. Arguments are the axis to swap. Return view of array with axes changed.
 
tolist(self)
Return array as a list.
 
getArray(self)
Return JavaScript TypedArray.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables
  shape = property(getshape, setshape)
Properties

Inherited from object: __class__

Method Details

__init__(self, dim, dtype='float64')
(Constructor)

 

Generate an N-dimensional array of TypedArray data.
Argument can be size (int or tuple) or data (list or TypedArray).
Optional argument dtype specifies TypedArray data type:
        'uint8c'    Uint8ClampedArray
        'int8'      Int8Array
        'uint8'     Uint8Array
        'int16'     Int16Array
        'uint16'    Uint16Array
        'int32'     Int32Array
        'uint32'    Uint32Array
        'float32'   Float32Array
        'float64'   Float64Array

Overrides: object.__init__

__str__(self)
(Informal representation operator)

 
str(x)
Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

 
repr(x)
Overrides: object.__repr__
(inherited documentation)