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

Support saving/loading sym objects from files #376

Closed
cbm755 opened this issue Mar 10, 2016 · 10 comments
Closed

Support saving/loading sym objects from files #376

cbm755 opened this issue Mar 10, 2016 · 10 comments

Comments

@cbm755
Copy link
Collaborator

cbm755 commented Mar 10, 2016

I've been meaning to look at saving sym objects to disk. They are really just a structure with a few fields. Only x.pickle (currently char(x) but #375 might change that) is actually important as far as SymPy is concerned.

  1. I've never promised API stability of that structure, might need to stabilize the structure a bit too. Or at least read about loading/saving @ classes.
  2. Should we rename x.pickle to x.srepr? It was originally a pickle but has not been for a long time. See also Expressions with more than 255 terms cause communication failures #269.
@cbm755
Copy link
Collaborator Author

cbm755 commented Mar 24, 2016

How to start: look at "saveobj" and "loadobj" methods.

@genuinelucifer
Copy link
Contributor

@cbm755 Should I develop 2 new functions saveobj and loadobj which would save the object (passed as argument) using python code?
else,
To let users save it using inbuilt save and load, I'll have to implement saveobj function in the sym class. How do I do that?

@cbm755
Copy link
Collaborator Author

cbm755 commented Mar 27, 2016

I'll have to implement saveobj function in the sym class. How do I do that?

Create a inst/@sym/saveobj.m file. And inst/@sym/loadobj.m.

(See the GNU Octave documentation for what they are supposed to do.)

A sym objection is basically a struct.

For loadobj, there is a special "magic" form of calling @sym/sym.m
which activates the constructor (see the source of that file).

@genuinelucifer
Copy link
Contributor

Hi @cbm755
I almost completed the functions.
I also installed octave on my linux machine so as to test the files before submitting a PR. I get the following error when I try to use any command (for any file in inst/@sym/)

error: sq_string cannot be indexed with .
error: called from:
error:   /home/lucifer/GSoC/octsympy/inst/@sym/size.m at line 71, column 5
error:   /home/lucifer/GSoC/octsympy/inst/@sym/isempty.m at line 44, column 5
error:   /home/lucifer/GSoC/octsympy/inst/@sym/sym.m at line 169, column 3
error: evaluating argument list element number 1
error:   /home/lucifer/GSoC/octsympy/inst/@sym/ismember.m at line 65, column 5
error:   /usr/share/octave/3.8.1/m/help/__unimplemented__.m at line -1, column -1

@cbm755
Copy link
Collaborator Author

cbm755 commented Mar 30, 2016

Are you saying you cannot run tests on some other OS? If so, please file a separate issue for that.

@cbm755
Copy link
Collaborator Author

cbm755 commented Mar 30, 2016

This error looks familiar... Where are you running octave from? should be inst (not inst/@sym). Does that help?

@genuinelucifer
Copy link
Contributor

genuinelucifer commented Mar 30, 2016 via email

@cbm755
Copy link
Collaborator Author

cbm755 commented Mar 30, 2016

what about tests on Windows? Can you run them or not?

@genuinelucifer
Copy link
Contributor

genuinelucifer commented Mar 30, 2016 via email

@cbm755
Copy link
Collaborator Author

cbm755 commented Apr 3, 2016

Closing

@cbm755 cbm755 closed this as completed Apr 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants