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

Type stuff and testing #83

Closed MadAlex1997 closed 1 month ago

MadAlex1997 commented 1 month ago

This update replaces in_dtype and out_dtype in functions where they were used with dtype. This was done because having two dtype options was confusing and the desired result was preventing Integer types from being used when those types are unsuitable. Additionally, I added constraints to the functions that cannot return ints (usually because the ability to represent values is exceeded) such that a compile-time error will occur if integral types are used in those functions.

This pull request also adds some basic tests and provides a basic framework to test correctness by comparing our results with numpy.

As a side note, this led me to discover that only the parallel version of matmul is correct.

forFudan commented 1 month ago

There is an existing "/tests" directory. Shall we directly use that directory instead of creating a new "/new_tests" folder?

MadAlex1997 commented 1 month ago

There is an existing "/tests" directory. Shall we directly use that directory instead of creating a new "/new_tests" folder?

Before we push to main for v0.2 we need to delete or convert the existing tests and bring all of it into one folder. I made them separate for now because we have a lot of test files, and they might be useful but we need to move to a standard that allows automatic tests of correctness. I think it is easier to clear out the old folder by rewriting tests for the new folder then delete the old folder and rename the new folder.