Mojo-Numerics-and-Algorithms-group / NuMojo

NuMojo is a library for numerical computing in Mojo 🔥 similar to numpy in Python.
Apache License 2.0
86 stars 15 forks source link

[lib] Make the default `dtype` of NDArray as `DType.float64` #82

Closed forFudan closed 1 month ago

forFudan commented 1 month ago

Currently, the default data type of a NDArray is DType.float32. This is somehow different from numpy which uses float64 as default type. For example, numpy.ones().

I am wondering whether it would be nice to change the default data type of NDArray from float32 to float64 also for numojo, so that it is aligned with numpy and is of higher precision.

I do not think it is a top priority but we can have an open discussion on this.

shivasankarka commented 1 month ago

@forFudan We could do that, I don't see any problem with it. Initially, I set it as DType.float32 to match PyTorch.

mmenendezg commented 1 month ago

Is there any potential performance cost on this change?

forFudan commented 1 month ago

Is there any potential performance cost on this change?

The Float64 takes double memory space for higher precision.