def _aligned_zeros(shape, dtype=float, order='C', align=None):
 dtype = np.dtype(dtype)
 if (align is None):
  align = dtype.alignment
 if (not hasattr(shape, '__len__')):
  shape = (shape,)
 size = (functools.reduce(operator.mul, shape) * dtype.itemsize)
 buf = np.empty(((size + align) + 1), np.uint8)
 offset = (buf.__array_interface__['data'][0] % align)
 if (offset != 0):
  offset = (align - offset)
 buf = buf[offset:((offset + size) + 1)][:(-1)]
 data = np.ndarray(shape, dtype, buf, order=order)
 data.fill(0)
 return data

def _aligned_zeros ( shape , dtype = float , order = 'C' , align = None ) : dtype = np . dtype ( dtype ) if ( align is None ) : align = dtype . alignment if ( not hasattr ( shape , '__len__' ) ) : shape = ( shape , ) size = ( functools . reduce ( operator . mul , shape ) * dtype . itemsize ) buf = np . empty ( ( ( size + align ) + 1 ) , np . uint8 ) offset = ( buf . __array_interface__ [ 'data' ] [ 0 ] % align ) if ( offset != 0 ) : offset = ( align - offset ) buf = buf [ offset : ( ( offset + size ) + 1 ) ] [ : ( - 1 ) ] data = np . ndarray ( shape , dtype , buf , order = order ) data . fill ( 0 ) return data
allocate a new ndarray with aligned memory .