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

Convert to JS Array? #36

Closed
mationai opened this issue Dec 27, 2017 · 6 comments
Closed

Convert to JS Array? #36

mationai opened this issue Dec 27, 2017 · 6 comments

Comments

@mationai
Copy link

How? Tried the suggested ndarray-unpack on a 1D ndarray, didn't work.
thanks.

@mationai
Copy link
Author

Found out NdArray has tolist() method. However, it's not in the documentation at http://scijs.net/packages/#scijs/ndarray

@rreusser
Copy link
Member

rreusser commented Dec 27, 2017

@fuzzthink Can you clarify what didn't work when using ndarray-unpack?

@mationai
Copy link
Author

The thread on issue #29 mentioned ndarray-unpack on "convert an ndarray back to a buffer/array". So I tried

nd = require('ndarray')
up = require('ndarray-unpack')
up(nd([1,2]))

and errored:

TypeError: Cannot read property 'join' of undefined
    at unpackCwise_cwise_thunk (eval at createThunk (/Users/john/dev/testnode/node_modules/cwise-compiler/lib/thunk.js:82:15), <anonymous>:6:49)
    at unpack (/Users/john/dev/testnode/node_modules/ndarray-unpack/unpack.js:19:3)

Btw, the tolist() I mentioned turns out to be from numjs, not this ndarray repo.

@rreusser
Copy link
Member

Apologies but I still don't quite follow. I created a repo that runs the above code here. I get:

[ 1, 2 ]

instead of the error. It seems like maybe a cwise transform issue. Are you using node? browserify? webpack?

@mationai
Copy link
Author

I'm very sorry @rreusser . I called up on ndarray instead of instance of it. It runs fine. Thank you for your help and I apologies for the time and effort you spent.

@rreusser
Copy link
Member

@fuzzthink No worries! There are lots of details in using these modules, so lots of subtle things can go wrong when you really get into the details. Glad you got it! Let me/someone know if you encounter other issues.

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