Matrix type (2D array) with initialization and basic manipulation.
Auxilliary types, e.g., MatrixIter.
Functioon to construct matrix from other data objects,
e.g., List, NDArray, String, and numpy array.
Because the number of dimension is known at the compile time,
the Matrix type gains advantages in the running speed compared to
the NDArray type when the users only want to deal with the matrices
manipulation, and it can also be more consistent with numpy.
For example:
For __getitem__, inputting two Int returns a scalar,
inputting one Int returns a vector, and inputting no Int
returns a Matrix.
For row-major and column-major matrices, it is easier to get the
values by the indices, as strides are only two numbers.
We do not need auxillary types NDArrayShape and NDArrayStrides
as the shape and strides information is fixed in length Tuple[Int,Int].
TODO: In future, we can also make use of the trait ArrayLike to align
the behavior of NDArray type and the Matrix type.
numojo.core.matrix
module provides:Because the number of dimension is known at the compile time, the Matrix type gains advantages in the running speed compared to the NDArray type when the users only want to deal with the matrices manipulation, and it can also be more consistent with numpy. For example:
__getitem__
, inputting twoInt
returns a scalar, inputting oneInt
returns a vector, and inputting noInt
returns a Matrix.NDArrayShape
andNDArrayStrides
as the shape and strides information is fixed in lengthTuple[Int,Int]
.TODO: In future, we can also make use of the trait
ArrayLike
to align the behavior ofNDArray
type and theMatrix
type.