Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make top-level functions non-specific to a particular primitive type. #75

Open
kyonifer opened this issue Oct 17, 2018 · 2 comments
Open

Comments

@kyonifer
Copy link
Owner

Right now the top-level koma functions often assume that we are dealing with double-valued matrices. For some cases this is a reasonable default, for example zeros(3,3) creates a double-valued matrix in numpy as it does in koma. However, other methods such as cos(someMatrix) in matrixfuncs.kt could easily be overloaded to handle different matrix primitive types. The top-level functions should probably be reworked to not be tied to Double as much as possible.

@peastman
Copy link
Contributor

for example zeros(3,3) creates a double-valued matrix in numpy as it does in koma

Numpy also makes it easy to create arrays of other types. np.zeros((3, 3), dtype=np.float). Creating double arrays is just a default that you can override with one extra argument.

@kyonifer
Copy link
Owner Author

Koma also does this. You can write

zeros(3, 3, MatrixTypes.FloatType)

See here. The goal was to mimic the behavior of numpy but remain safely typed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants