[sage-devel] Fwd: Bookstore feature
See http://www.ams.org/bookstore where my book just appeared. It's the first published book that contains SAGE code throughout. --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: sage -upgrade keeps old doc directories
No. That should be eliminated. It is a holdover from the old days. On 2/20/07, Yi Qiang [EMAIL PROTECTED] wrote: Any reason the upgrade keeps old versions of the documentation around? They are quite big one can have quite a few hanging around after just a couple of upgrades. Yi -- William Stein Associate Professor of Mathematics University of Washington --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] slices
If one types a[4:8:2] in Python, Python creates a slice object (call it s) with s.start = 4, s.stop = 8 and s.step = 2. It then passes this slice object to a's __getitem__ method. If one of the arguments is left out, it is filled with None: so the slice [:8:2] would have start None. However, if you don't have the second colon, instead of filling it with None, it fills start with a Python int 0 and stop with a Python int 2147483647 (which some of you may recognize as maxint). So a[:4] would call __getslice__(0, 4), or if that's not defined, __getitem__(slice(0, 4)). Similarly, if I write a[-2:8] it calls __getitem__(slice(a.__len__() - 2, 8, None)). Is there any way that I can distinguish between a[0:4] and a[:4] in writing __getitem__? Or more generally, get Python to construct a new style slice object when called with just two arguments? I want to overload the slice operator for p-adic fields and this is stymieing me (yes, that is how you spell stymieing: I just looked it up). David --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Python/C API
David, I was wondering if you could help get me started here. I've been reading the Python/C API, and I've been browsing both sides of a lot of Pyrex: for argument's sake, let's say the Complex double matrices. First, I'm wondering how they're cdef-ing classes that they're then calling from Python. Also, what do .so files in site-packages have to do with specific classes in the repository? ( sage: sage.matrix.matrix_complex_double_dense.Matrix_complex_double_dense?? Type: type Base Class: type 'type' String Form:type 'sage.matrix.matrix_complex_double_dense.Matrix_complex_double_dense' Namespace: Interactive File: /Volumes/DATA/sage/local/lib/python2.5/site-packages/sage/matrix/matrix_complex_double_dense.so ) I have some questions also about reference counting, but let's start here. -- Robert L. Miller http://www.robertlmiller.com/ --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: SageX Tutorial
On 2/20/07, Robert Bradshaw [EMAIL PROTECTED] wrote: Although C implicitly coerces ints to floats in general, no (non-functional) arithmetic operations in C return a different data type then their arguments. I am leaning towards disabling the functionality altogether. If the user wants to do it one way or the other, it will be pretty easy to make it explicit. Some of the operations (e.g. bit operations) are +1 for this. Issuing a message like explicit cas to int required for pow() would also help. didier --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] My Pictures of SD3
http://www.flickr.com/photos/martinralbrecht/tags/sagedays3/ -- name: Martin Albrecht _pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x8EF0DC99 _www: http://www.informatik.uni-bremen.de/~malb _jab: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: Contributing to SAGE
Hello Pere, You could email David Joyner to coordinate. Or, if there's something you'd like to be able to do, you could dive in and add a feature, as a collection of methods or a class. For example, there was some talk of implementing codes over rings (as opposed to over fields). You could also check the sage trac for coding theory related issues, although I didn't notice any last I checked. Nick On Feb 21, 2:00 pm, Pere Urbón Bayes [EMAIL PROTECTED] wrote: Hi to every one, mi name is Pere and I was working with SAGE during my last job at the Autonomous University of Barcelona (http://www.deic.uab.es). Actually I'm with another job, but I would like to contribute to this enjoying project If I could remember I was speaking with David Joyner about the sage coding theory part ... I would like to contribute to this part or another that could be important. As a references i could tell about me that, I'm a computer science student with some expertise on math related software development. On my last job I was developing coding theory software for the UAB University and I'm really interested to continue this enjoying development effort with SAGE. How could I contribute? Regards, -- Pere Urbón Bayes [EMAIL PROTECTED] signature.asc 1KDownload --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: Python/C API
FYI this is a completely hypothetical situation here. I am not doing any developing in the Python/C API, and may never do so. But I'm experimenting with different levels of architecture, mainly just to see how things work. Right now the situation is, suppose I have some function I want to call from Python, but in the end I want to implement it in basically raw C. One approach I thought of was, okay, I'll Pyrex a really simple function, compile it and go into the c file, then write most of what I need from there. My main thought about reference counting: Python objects seem to need heavy babysitting in terms of reference counting, especially if you look at some Pyrex autogen code. But it seems like the C compiler will keep track of reference counts for C types. Just supposing (again, completely hypothetical) I decide to write something in the P/C API completely without Pyrex or SageX, but I want a Python function or two to get called at the top, and I want C to do the rest. My impression is that I need to keep track of reference counts for PyObjs but not C variables. Is this true? I have never had to worry about reference counting when writing pure C, so why do PyObjects need that extra help? On Feb 21, 10:57 am, Robert Bradshaw [EMAIL PROTECTED] wrote: I'll jump in and answer you questions. On Feb 21, 2007, at 10:18 AM, Robert Miller wrote: David, I was wondering if you could help get me started here. I've been reading the Python/C API, and I've been browsing both sides of a lot of Pyrex: for argument's sake, let's say the Complex double matrices. First, I'm wondering how they're cdef-ing classes that they're then calling from Python. cdef has two uses. The first is to declare a class as an extension type (so it can contain cdef'd property and functions), and the second is to declare a property/function as a c type. Cdef'd extension types are accessible from python, just not their cdef'd properties/functions. Also, what do .so files in site-packages have to do with specific classes in the repository? ( sage: sage.matrix.matrix_complex_double_dense.Matrix_complex_double_dense?? Type: type Base Class: type 'type' String Form:type 'sage.matrix.matrix_complex_double_dense.Matrix_complex_double_dense' Namespace: Interactive File: /Volumes/DATA/sage/local/lib/python2.5/site-packages/sage/matrix/ matrix_complex_double_dense.so ) Each .pyx file has an associated shared object library containing all the classes/methods/etc. needed. I have some questions also about reference counting, but let's start here. You shouldn't have to worry about it too much. Basically, if you malloc something manually, you have to worry about freeing it. If you call the C/Python API directly (which you probably won't need to do), you have to worry if the returned PyObject* is a borrowed or new copy. But otherwise pyrex will take care of it all for you. -- Robert L. Miller http://www.robertlmiller.com/ --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] nth_root() for mpfr reals
Allo, Here is a patch that returns the nth root of a mpfr real number: http://sage.math.washington.edu/home/dfdeshom/custom/patches/mpfr-nthroot.txt didier --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---
[sage-devel] Re: Python/C API
There is no reference counting in C because C does not do automatic garbage collection, you have to do that yourself when you write C. If you don't free memory you allocated you just get a memory leak it won't automatically notice because it has no way of knowing whether or not that memory is actual going to be used. Python's reference counting lets it figure out when to free objects. If there are no references left, nothing can access that object or its memory and it gets destroyed. This is implemented via the incref, decref macros. Remember python objects are literally just C structs, they have a fileld that is just an int that counts the number of other objects or places in code that have an active pointer to the object. Any time you get a pointer to a python object you increment its reference count. As long as the reference count is not 0, it won't be freed by the garbage collector and you can be sure the pointer will be valid. Once your done you decref. If something else still has a reference to it, then the reference count will be positve and it won't be freed. If you were the only person with a reference than the reference count becomes zero and the object is destroyed by the gargage collector. If you directly write python C/api code you have to keep track of this yourself. If this is done incorrectly you will objects never getting freed or being free prematurely (segmentation faults or memory leaks). Josh On Feb 21, 4:39 pm, Robert Miller [EMAIL PROTECTED] wrote: FYI this is a completely hypothetical situation here. I am not doing any developing in the Python/C API, and may never do so. But I'm experimenting with different levels of architecture, mainly just to see how things work. Right now the situation is, suppose I have some function I want to call from Python, but in the end I want to implement it in basically raw C. One approach I thought of was, okay, I'll Pyrex a really simple function, compile it and go into the c file, then write most of what I need from there. My main thought about reference counting: Python objects seem to need heavy babysitting in terms of reference counting, especially if you look at some Pyrex autogen code. But it seems like the C compiler will keep track of reference counts for C types. Just supposing (again, completely hypothetical) I decide to write something in the P/C API completely without Pyrex or SageX, but I want a Python function or two to get called at the top, and I want C to do the rest. My impression is that I need to keep track of reference counts for PyObjs but not C variables. Is this true? I have never had to worry about reference counting when writing pure C, so why do PyObjects need that extra help? On Feb 21, 10:57 am, Robert Bradshaw [EMAIL PROTECTED] wrote: I'll jump in and answer you questions. On Feb 21, 2007, at 10:18 AM, Robert Miller wrote: David, I was wondering if you could help get me started here. I've been reading the Python/C API, and I've been browsing both sides of a lot of Pyrex: for argument's sake, let's say the Complex double matrices. First, I'm wondering how they're cdef-ing classes that they're then calling from Python. cdef has two uses. The first is to declare a class as an extension type (so it can contain cdef'd property and functions), and the second is to declare a property/function as a c type. Cdef'd extension types are accessible from python, just not their cdef'd properties/functions. Also, what do .so files in site-packages have to do with specific classes in the repository? ( sage: sage.matrix.matrix_complex_double_dense.Matrix_complex_double_dense?? Type: type Base Class: type 'type' String Form:type 'sage.matrix.matrix_complex_double_dense.Matrix_complex_double_dense' Namespace: Interactive File: /Volumes/DATA/sage/local/lib/python2.5/site-packages/sage/matrix/ matrix_complex_double_dense.so ) Each .pyx file has an associated shared object library containing all the classes/methods/etc. needed. I have some questions also about reference counting, but let's start here. You shouldn't have to worry about it too much. Basically, if you malloc something manually, you have to worry about freeing it. If you call the C/Python API directly (which you probably won't need to do), you have to worry if the returned PyObject* is a borrowed or new copy. But otherwise pyrex will take care of it all for you. -- Robert L. Miller http://www.robertlmiller.com/ --~--~-~--~~~---~--~~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~--~~~~--~~--~--~---