[sage-devel] Re: Toric varieties - design discussion

2010-05-27 Thread Andrey Novoseltsev
Hi Volker, I put a new version of toric lattices patch. Now it should work nicely with plain vectors and matrices, in particular homomorphisms seem to do what they should (there is a simple example in the end of "module level" documentation). I don't think anymore that there is any need for a sepa

[sage-devel] Re: Toric varieties - design discussion

2010-05-26 Thread Andrey Novoseltsev
Hi Volker, The first version (already documented and doctested) of toric lattices is on trac: http://trac.sagemath.org/sage_trac/ticket/9062 so you can take a look and comment if something is very bad. It is not quite ready for review yet, but I don't anticipate changing existing code - only addin

[sage-devel] Re: Toric varieties - design discussion

2010-05-21 Thread Andrey Novoseltsev
Hi Volker, On May 21, 11:24 am, Volker Braun wrote: > Ok, I agree that it would be nice for all derived cones to share the > base cached data. How about Cone() just stores all of its cached data > in a hash self.shared_cache (or so) instead of in self. For the > computer thats essentially the sam

[sage-devel] Re: Toric varieties - design discussion

2010-05-21 Thread Volker Braun
Ok, I agree that it would be nice for all derived cones to share the base cached data. How about Cone() just stores all of its cached data in a hash self.shared_cache (or so) instead of in self. For the computer thats essentially the same as what you are suggesting, but in the implementation you wo

[sage-devel] Re: Toric varieties - design discussion

2010-05-21 Thread Andrey Novoseltsev
On May 21, 5:24 am, Volker Braun wrote: > Hi Andrey, > > Just to clarify, I only wanted to subclass Cones, but not Fans. The > fan is a container class for cones and that doesn't change. In > particular, I never felt the need to add any functionality at that > level in my code. > > As for sharing

[sage-devel] Re: Toric varieties - design discussion

2010-05-21 Thread Volker Braun
Hi Andrey, Just to clarify, I only wanted to subclass Cones, but not Fans. The fan is a container class for cones and that doesn't change. In particular, I never felt the need to add any functionality at that level in my code. As for sharing of cached data, I think a clearer way would be to defin

[sage-devel] Re: Toric varieties - design discussion

2010-05-20 Thread Andrey Novoseltsev
Hi Volker, Fine, I am now convinced that you are right - we do need more subclasses of cones ;-) And probably the same for fans? Since I am still a bit paranoid about speed and memory consumption, what do you think of the following scheme: Make classes EnhancedFan and Enhanced Cone (not exposed

[sage-devel] Re: Toric varieties - design discussion

2010-05-20 Thread Volker Braun
To summarize: Plain python cannot pickle inner classes or functions: >>> class outer(object): ... class inner(object): ... pass >>> o = outer() >>> pickle.dumps(o) (works) >>> i = o.inner() >>> pickle.dumps(i) (ERROR) The work-around is to make the cone factory a top-level class (or functio

[sage-devel] Re: Toric varieties - design discussion

2010-05-20 Thread Jason Grout
On 5/20/10 9:30 AM, Andrey Novoseltsev wrote: You cannot pickle functions According to http://docs.python.org/library/pickle.html#what-can-be-pickled-and-unpickled you can pickle certain types of functions. I don't know if that helps at all, but your statement about pickling functions in

[sage-devel] Re: Toric varieties - design discussion

2010-05-20 Thread Andrey Novoseltsev
Hi Volker, That definitely makes sense, let me think a bit about it and then post the comments/agreements. You cannot pickle functions, so you cannot pass a factory to construct cones (because you may need to have more cones later, so you need to store it). If you apply my cone patch and remove _