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

Allow plain 'array' dtype #4 #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rreusser
Copy link
Member

@rreusser rreusser commented Jan 3, 2016

This PR bypasses pool.malloc if the dtype is array and returns simply new Array(sz). Some modules require (optional) allocation of output. This makes it consistent and less surprising to allocate storage of the same dtype without extra gymnastics.

@rreusser
Copy link
Member Author

rreusser commented Jan 3, 2016

Rejection of this PR is fine, but then we should document the expectation that, in general, for scijs modules that allocate new storage, the dtype of the output may not match that of the input.

@mikolalysenko
Copy link
Member

Hmm.. There is no way to do pooled allocation for generic ndarrays. However, I think it should be ok to do something like allocating a regular array using new Array(size) for both generic and array dtypes. free on a generic array could be a no-op.

@rreusser
Copy link
Member Author

rreusser commented Jan 3, 2016

Yeah. That makes sense. The use case is mainly avoiding an awkward if statement when generating an array identity matrix vs a typed array identity, for example. Maybe that should be a separate module, but this seems fairly harmless and somewhat simpler.

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

Successfully merging this pull request may close these issues.

2 participants