Ask Your Question
0

Object Persistence

asked 2012-10-24 20:29:13 +0100

SLOtoSF gravatar image

Is Object Persistence faster than just recreating the object? Why? And how do I do it, what are the steps? I read this: http://www.sagemath.org/doc/reference..., but am unclear about the parameters and how it works. Does this object only get associated with me as a user of the notebook, or can I share this object with other users (like if want to explore the properties of a clique graph on 20 nodes, which took 20 minutes to construct, how can I make that available to others?)

Sorry for all the questions, primarily I'm interested in how I can user Object Persistence to make my life easier.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-10-25 23:16:35 +0100

benjaminfjones gravatar image

Yes, you can save and restore computed objects easily. This will be faster if the time to load the object from disk is lower than the time to compute it. Certainly, an object that takes 20 minutes to compute is going to be faster to load from a saved state on disk than it is to recompute. The saved state is just a file that Sage can restore to an object in memory, so you can certainly share such saved objects with others.

Have a look at the save and load functions. Here's an example of their use:

sage: E = EllipticCurve([-1,0])
sage: save(E, 'elliptic')
sage: quit

....

>sage
sage: E = load('elliptic.sobj')
sage: E
Elliptic Curve defined by y^2 = x^3 - x over Rational Field

If you are working in the Sage notebook, saved object files will be stores in the DATA directory. If you want to share the object with someone else, I think you need to download the worksheet from the server and send that (it will contain the saved object file).

edit flag offensive delete link more

Comments

Thanks @benjaminfjones, What if the object has other custom objects as attributes to it, will those get carried over too? I'm just wondering about the dependencies....

SLOtoSF gravatar imageSLOtoSF ( 2012-10-26 20:33:05 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-10-24 20:29:13 +0100

Seen: 702 times

Last updated: Oct 25 '12