mtl5.matrix#
- mtl5.matrix(*args, **kwargs)#
Overloaded function.
matrix(a: ndarray[dtype=float32, shape=(*, *), order='C', device='cpu']) -> mtl5._core.DenseMatrix_f32
Create a zero-copy MTL5 matrix view of a 2-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 matrix reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
matrix(a: ndarray[dtype=float32, shape=(*, *), order='C', device='cpu', writable=False]) -> mtl5._core.DenseMatrix_f32matrix(a: ndarray[dtype=float64, shape=(*, *), order='C', device='cpu']) -> mtl5._core.DenseMatrix_f64
Create a zero-copy MTL5 matrix view of a 2-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 matrix reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
matrix(a: ndarray[dtype=float64, shape=(*, *), order='C', device='cpu', writable=False]) -> mtl5._core.DenseMatrix_f64matrix(a: ndarray[dtype=int32, shape=(*, *), order='C', device='cpu']) -> mtl5._core.DenseMatrix_i32
Create a zero-copy MTL5 matrix view of a 2-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 matrix reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
matrix(a: ndarray[dtype=int32, shape=(*, *), order='C', device='cpu', writable=False]) -> mtl5._core.DenseMatrix_i32matrix(a: ndarray[dtype=int64, shape=(*, *), order='C', device='cpu']) -> mtl5._core.DenseMatrix_i64
Create a zero-copy MTL5 matrix view of a 2-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 matrix reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
matrix(a: ndarray[dtype=int64, shape=(*, *), order='C', device='cpu', writable=False]) -> mtl5._core.DenseMatrix_i64matrix(a: ndarray[dtype=int8, shape=(*, *), order='C', device='cpu']) -> mtl5._core.DenseMatrix_i8
Create a zero-copy MTL5 matrix view of a 2-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 matrix reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
matrix(a: ndarray[dtype=int8, shape=(*, *), order='C', device='cpu', writable=False]) -> mtl5._core.DenseMatrix_i8matrix(a: ndarray[dtype=int16, shape=(*, *), order='C', device='cpu']) -> mtl5._core.DenseMatrix_i16
Create a zero-copy MTL5 matrix view of a 2-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 matrix reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
matrix(a: ndarray[dtype=int16, shape=(*, *), order='C', device='cpu', writable=False]) -> mtl5._core.DenseMatrix_i16matrix(a: ndarray[dtype=uint8, shape=(*, *), order='C', device='cpu']) -> mtl5._core.DenseMatrix_u8
Create a zero-copy MTL5 matrix view of a 2-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 matrix reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
matrix(a: ndarray[dtype=uint8, shape=(*, *), order='C', device='cpu', writable=False]) -> mtl5._core.DenseMatrix_u8matrix(a: ndarray[dtype=uint32, shape=(*, *), order='C', device='cpu']) -> mtl5._core.DenseMatrix_u32
Create a zero-copy MTL5 matrix view of a 2-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 matrix reporting is_view=True. Pass np.ascontiguousarray(a), or a.astype(…), to say so deliberately.
matrix(a: ndarray[dtype=uint32, shape=(*, *), order='C', device='cpu', writable=False]) -> mtl5._core.DenseMatrix_u32matrix(a: ndarray[dtype=complex64, shape=(*, *), order='C', device='cpu']) -> mtl5._core.DenseMatrix_c64
Create a zero-copy MTL5 matrix view of a 2-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.
matrix(a: ndarray[dtype=complex64, shape=(*, *), order='C', device='cpu', writable=False]) -> mtl5._core.DenseMatrix_c64matrix(a: ndarray[dtype=complex128, shape=(*, *), order='C', device='cpu']) -> mtl5._core.DenseMatrix_c128
Create a zero-copy MTL5 matrix view of a 2-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.
matrix(a: ndarray[dtype=complex128, shape=(*, *), order='C', device='cpu', writable=False]) -> mtl5._core.DenseMatrix_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.