Skip to content

Make dimension of an ndarray a parameter and known at compile time #58

@forfudan

Description

@forfudan

Current situation

Currently, the dimension of the ndarray is inferred from the shape at the run time. This would lead to extra cost.

Proposal

As the dimension is known at initialisation, it might be nice to make ndim a parameter and known at compile time. Example:

var NDArray[2, DType.float64](1000, 1000, random=True)  # Creating a 1000x1000 2-D array (matrix)

Additional benefits

Making dimension a parameter at compile time may have additional benefits. For example, we can define alias to NDArrays more easily.

alias Vector = NDArray[1, _]
alias Matrix = NDArray[2, _]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Long-termThis issue will not be considered in the near-termenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions