mtl5.vector#
- mtl5.vector(*args, **kwargs)#
Overloaded function.
vector(a: ndarray[dtype=float32, shape=(*), order='C', device='cpu']) -> mtl5._core.DenseVector_f32
Create a zero-copy MTL5 vector view of a 1-D NumPy array.
The dtype must match a registered one exactly and the array must be C-contiguous. Anything else raises TypeError rather than converting, because a converted array is a view of a temporary: neither zero-copy nor the dtype you asked for. A float64 slice such as a[::2] used to come back as a float32 vector reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
vector(a: ndarray[dtype=float32, shape=(*), order='C', device='cpu', writable=False]) -> mtl5._core.DenseVector_f32vector(a: ndarray[dtype=float64, shape=(*), order='C', device='cpu']) -> mtl5._core.DenseVector_f64
Create a zero-copy MTL5 vector view of a 1-D NumPy array.
The dtype must match a registered one exactly and the array must be C-contiguous. Anything else raises TypeError rather than converting, because a converted array is a view of a temporary: neither zero-copy nor the dtype you asked for. A float64 slice such as a[::2] used to come back as a float32 vector reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
vector(a: ndarray[dtype=float64, shape=(*), order='C', device='cpu', writable=False]) -> mtl5._core.DenseVector_f64vector(a: ndarray[dtype=int32, shape=(*), order='C', device='cpu']) -> mtl5._core.DenseVector_i32
Create a zero-copy MTL5 vector view of a 1-D NumPy array.
The dtype must match a registered one exactly and the array must be C-contiguous. Anything else raises TypeError rather than converting, because a converted array is a view of a temporary: neither zero-copy nor the dtype you asked for. A float64 slice such as a[::2] used to come back as a float32 vector reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
vector(a: ndarray[dtype=int32, shape=(*), order='C', device='cpu', writable=False]) -> mtl5._core.DenseVector_i32vector(a: ndarray[dtype=int64, shape=(*), order='C', device='cpu']) -> mtl5._core.DenseVector_i64
Create a zero-copy MTL5 vector view of a 1-D NumPy array.
The dtype must match a registered one exactly and the array must be C-contiguous. Anything else raises TypeError rather than converting, because a converted array is a view of a temporary: neither zero-copy nor the dtype you asked for. A float64 slice such as a[::2] used to come back as a float32 vector reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
vector(a: ndarray[dtype=int64, shape=(*), order='C', device='cpu', writable=False]) -> mtl5._core.DenseVector_i64vector(a: ndarray[dtype=int8, shape=(*), order='C', device='cpu']) -> mtl5._core.DenseVector_i8
Create a zero-copy MTL5 vector view of a 1-D NumPy array.
The dtype must match a registered one exactly and the array must be C-contiguous. Anything else raises TypeError rather than converting, because a converted array is a view of a temporary: neither zero-copy nor the dtype you asked for. A float64 slice such as a[::2] used to come back as a float32 vector reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
vector(a: ndarray[dtype=int8, shape=(*), order='C', device='cpu', writable=False]) -> mtl5._core.DenseVector_i8vector(a: ndarray[dtype=int16, shape=(*), order='C', device='cpu']) -> mtl5._core.DenseVector_i16
Create a zero-copy MTL5 vector view of a 1-D NumPy array.
The dtype must match a registered one exactly and the array must be C-contiguous. Anything else raises TypeError rather than converting, because a converted array is a view of a temporary: neither zero-copy nor the dtype you asked for. A float64 slice such as a[::2] used to come back as a float32 vector reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
vector(a: ndarray[dtype=int16, shape=(*), order='C', device='cpu', writable=False]) -> mtl5._core.DenseVector_i16vector(a: ndarray[dtype=uint8, shape=(*), order='C', device='cpu']) -> mtl5._core.DenseVector_u8
Create a zero-copy MTL5 vector view of a 1-D NumPy array.
The dtype must match a registered one exactly and the array must be C-contiguous. Anything else raises TypeError rather than converting, because a converted array is a view of a temporary: neither zero-copy nor the dtype you asked for. A float64 slice such as a[::2] used to come back as a float32 vector reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
vector(a: ndarray[dtype=uint8, shape=(*), order='C', device='cpu', writable=False]) -> mtl5._core.DenseVector_u8vector(a: ndarray[dtype=uint32, shape=(*), order='C', device='cpu']) -> mtl5._core.DenseVector_u32
Create a zero-copy MTL5 vector view of a 1-D NumPy array.
The dtype must match a registered one exactly and the array must be C-contiguous. Anything else raises TypeError rather than converting, because a converted array is a view of a temporary: neither zero-copy nor the dtype you asked for. A float64 slice such as a[::2] used to come back as a float32 vector reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
vector(a: ndarray[dtype=uint32, shape=(*), order='C', device='cpu', writable=False]) -> mtl5._core.DenseVector_u32vector(a: ndarray[dtype=complex64, shape=(*), order='C', device='cpu']) -> mtl5._core.DenseVector_c64
Create a zero-copy MTL5 vector view of a 1-D complex NumPy array.
The view aliases the NumPy buffer; writes through either are visible in both. The dtype must be complex64 or complex128 exactly – whichever this overload is for – and the array must be C-contiguous. Anything else raises TypeError rather than converting: a converted array is a view of a temporary, so it is neither zero-copy nor the dtype you asked for, and a real array would silently acquire an imaginary part. Pass np.ascontiguousarray(a), or a.astype(…), to convert deliberately.
vector(a: ndarray[dtype=complex64, shape=(*), order='C', device='cpu', writable=False]) -> mtl5._core.DenseVector_c64vector(a: ndarray[dtype=complex128, shape=(*), order='C', device='cpu']) -> mtl5._core.DenseVector_c128
Create a zero-copy MTL5 vector view of a 1-D complex NumPy array.
The view aliases the NumPy buffer; writes through either are visible in both. The dtype must be complex64 or complex128 exactly – whichever this overload is for – and the array must be C-contiguous. Anything else raises TypeError rather than converting: a converted array is a view of a temporary, so it is neither zero-copy nor the dtype you asked for, and a real array would silently acquire an imaginary part. Pass np.ascontiguousarray(a), or a.astype(…), to convert deliberately.
vector(a: ndarray[dtype=complex128, shape=(*), order='C', device='cpu', writable=False]) -> mtl5._core.DenseVector_c128
Also accepts a universal_dtypes array (posit, fixpnt, lns, takum, fp16, cascades), which is copied bit for bit into the MTL5 container of the same number system rather than rounded through float64. .to_universal() is the way back.