Skip to content

Conversation

aebrahim
Copy link
Contributor

This function will correctly serialize numpy arrays as json due to
customizations to the JSON encoder. Additionally, this function will
handle scipy sparse matrices as well.

The matlab magic now calls this function.

This commit DOES NOT add any new dependencies to numpy and scipy, and
the code should function as normal without them.

This function will correctly serialize numpy arrays as json due to
customizations to the JSON encoder. Additionally, this function will
handle scipy sparse matrices as well.

The matlab magic now calls this function.

This commit *DOES NOT* add any new dependencies to numpy and scipy, and
the code should function as normal without them.
from scipy.sparse import spmatrix
except ImportError:
class spmatrix:
pass
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep - this all seems OK to me. Hard to imagine anyone would want to use this without numpy/scipy, but it's good not to require that.

This is needed when generating temporary variables for transferring a
sparse matrix.
@aebrahim
Copy link
Contributor Author

I updated the pull request to use uuid4 instead

arokem added a commit that referenced this pull request Aug 29, 2014
_Session.set_variable for ndarray and spmatrix
@arokem arokem merged commit f71f6a6 into arokem:master Aug 29, 2014
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.

3 participants