[sage-support] Re: coercion question
On Jul 5, 8:39 pm, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > On Jul 5, 2008, at 7:16 PM, John H Palmieri wrote: > > > > > > >>> would be good enough? (That is, assuming I've defined a reasonable > >>> __eq__ method for the parents, the SteenrodAlgebra class.) > > >> Yes, though that will mean something like A5.P(2) - A5.P(2) == 0 will > >> return False. This is why you are better off using _cmp_ instead of > >> __eq__, __ne__, __le__, __gt__, ... (also, the latter are deprecated > >> in Python). The _cmp_ method will always be called with two things of > >> the same parent, invoking coercion if necessary. > > > I think I understand this, but I have one more problem. I think you're > > saying that I'm supposed to get rid of __eq__ and define __cmp__ > > instead, with no error checking -- assume that the two arguments have > > the same parent. I have done this, and __cmp__ just checks whether > > the difference x-y is the zero element of the algebra. > > > Now I get the following, which is good: > > > sage: A5.P(2) == A7.P(2) > > False > > sage: A5.P(2) - A5.P(2) == 0 > > True > > sage: 2 * A5.P(2) > > 2 P(2) > > sage: 10 * A7.P(2) # working mod 7 > > 3 P(2) > > > On the other hand, > > > sage: cmp(A5.P(2), A7.P(2)) > > > gives an error message: "unsupported operand parent(s) for '-': 'mod 5 > > Steenrod algebra' and 'mod 7 Steenrod algebra' " > > > (Same thing happens with 'A5.P(2).__cmp__(A7.P(2))', but cmp(A5(3), > > 3) returns 0, as it should.) > > > Why doesn't cmp() work, or is this what's supposed to happen? (I can > > add type-checking to the definition of __cmp__, in which case the > > above command returns -1, but it sounded like you were saying that I > > shouldn't have to.) > > > Thanks for taking the time to answer all of my silly questions, by the > > way. I think this might be the last one for now. > > What does A5 == A7 give you? Can you do A5.P(2) == A7.P(2)? I'm not > sure exactly what's going on here, but as long as the above is > working well enough for now it's probably worth holding off debugging > too much until the new coercion is in place (which is more likely > than not to resolve this). Both of those things, A5 == A7 and A5.P(2) == A7.P(2), return False. So I'll leave it as is. Thanks. > > - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: coercion question
On Jul 5, 2008, at 7:16 PM, John H Palmieri wrote: >> >>> would be good enough? (That is, assuming I've defined a reasonable >>> __eq__ method for the parents, the SteenrodAlgebra class.) >> >> Yes, though that will mean something like A5.P(2) - A5.P(2) == 0 will >> return False. This is why you are better off using _cmp_ instead of >> __eq__, __ne__, __le__, __gt__, ... (also, the latter are deprecated >> in Python). The _cmp_ method will always be called with two things of >> the same parent, invoking coercion if necessary. >> > > I think I understand this, but I have one more problem. I think you're > saying that I'm supposed to get rid of __eq__ and define __cmp__ > instead, with no error checking -- assume that the two arguments have > the same parent. I have done this, and __cmp__ just checks whether > the difference x-y is the zero element of the algebra. > > Now I get the following, which is good: > > sage: A5.P(2) == A7.P(2) > False > sage: A5.P(2) - A5.P(2) == 0 > True > sage: 2 * A5.P(2) > 2 P(2) > sage: 10 * A7.P(2) # working mod 7 > 3 P(2) > > On the other hand, > > sage: cmp(A5.P(2), A7.P(2)) > > gives an error message: "unsupported operand parent(s) for '-': 'mod 5 > Steenrod algebra' and 'mod 7 Steenrod algebra' " > > (Same thing happens with 'A5.P(2).__cmp__(A7.P(2))', but cmp(A5(3), > 3) returns 0, as it should.) > > Why doesn't cmp() work, or is this what's supposed to happen? (I can > add type-checking to the definition of __cmp__, in which case the > above command returns -1, but it sounded like you were saying that I > shouldn't have to.) > > Thanks for taking the time to answer all of my silly questions, by the > way. I think this might be the last one for now. What does A5 == A7 give you? Can you do A5.P(2) == A7.P(2)? I'm not sure exactly what's going on here, but as long as the above is working well enough for now it's probably worth holding off debugging too much until the new coercion is in place (which is more likely than not to resolve this). - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: coercion question
On Jul 5, 5:48 pm, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > On Jul 5, 2008, at 12:42 PM, John H Palmieri wrote: > > > > > > Ah, it looks like your __eq__ method is assuming that self and > other > are elements of the steenrod algebra. There are two solutions to > this: > > 1) Use __cmp__ which (in Sage) will ensure that self and other have > the same parent before it's called > 2) Fix your __eq__ (and any other comparison methods you might > have) > to make sure self-other makes sense (or, as a quick fix, catch the > type error here). > > >>> I still don't understand two things: why the gen method is being > >>> used, > >>> and why if I multiply an element of SteenrodAlgebra(7) by 3, somehow > >>> elements of SteenrodAlgebra(5) are getting involved. > > >> I'm not seeing where the gen method is being used--it's probably to > >> get a "generic" element to see if multiplication is a viable option. > >> As for elements of SteenrodAlgebra(7) and SteenrodAlgebra(5) getting > >> compared, that's because it's looking up something in a (global-ish) > >> lookup table that happens to have SteenrodAlgebra(5) in it as well. > >> Obviously equality here should return False. > > > So, for example, for the definition of the __eq__ method for > > SteenrodAlgebraElement, replacing > > > difference = self - other > > return len(difference._raw['milnor']) == 0 > > > with > > > if self.parent() == other.parent(): > > difference = self - other > > return len(difference._raw['milnor']) == 0 > > else: > > return False > > > would be good enough? (That is, assuming I've defined a reasonable > > __eq__ method for the parents, the SteenrodAlgebra class.) > > Yes, though that will mean something like A5.P(2) - A5.P(2) == 0 will > return False. This is why you are better off using _cmp_ instead of > __eq__, __ne__, __le__, __gt__, ... (also, the latter are deprecated > in Python). The _cmp_ method will always be called with two things of > the same parent, invoking coercion if necessary. > I think I understand this, but I have one more problem. I think you're saying that I'm supposed to get rid of __eq__ and define __cmp__ instead, with no error checking -- assume that the two arguments have the same parent. I have done this, and __cmp__ just checks whether the difference x-y is the zero element of the algebra. Now I get the following, which is good: sage: A5.P(2) == A7.P(2) False sage: A5.P(2) - A5.P(2) == 0 True sage: 2 * A5.P(2) 2 P(2) sage: 10 * A7.P(2) # working mod 7 3 P(2) On the other hand, sage: cmp(A5.P(2), A7.P(2)) gives an error message: "unsupported operand parent(s) for '-': 'mod 5 Steenrod algebra' and 'mod 7 Steenrod algebra' " (Same thing happens with 'A5.P(2).__cmp__(A7.P(2))', but cmp(A5(3), 3) returns 0, as it should.) Why doesn't cmp() work, or is this what's supposed to happen? (I can add type-checking to the definition of __cmp__, in which case the above command returns -1, but it sounded like you were saying that I shouldn't have to.) Thanks for taking the time to answer all of my silly questions, by the way. I think this might be the last one for now. John > - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] online sage and vista.
I don't know if this problem is common one: I was working in vista. It logged in into sage via the sage website. I had two 3d graphs of a sphere. Then java correctly showed me the one I was looking. But the second jmol appeared black. And it said: "script terminated". Any ideas? Has the issue of jmol in ubuntu-hardy resolved by the way? Thanks a lot. -Adrian. --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: coercion question
On Jul 5, 2008, at 12:42 PM, John H Palmieri wrote: >> >> Ah, it looks like your __eq__ method is assuming that self and other are elements of the steenrod algebra. There are two solutions to this: >> 1) Use __cmp__ which (in Sage) will ensure that self and other have the same parent before it's called 2) Fix your __eq__ (and any other comparison methods you might have) to make sure self-other makes sense (or, as a quick fix, catch the type error here). >> >>> I still don't understand two things: why the gen method is being >>> used, >>> and why if I multiply an element of SteenrodAlgebra(7) by 3, somehow >>> elements of SteenrodAlgebra(5) are getting involved. >> >> I'm not seeing where the gen method is being used--it's probably to >> get a "generic" element to see if multiplication is a viable option. >> As for elements of SteenrodAlgebra(7) and SteenrodAlgebra(5) getting >> compared, that's because it's looking up something in a (global-ish) >> lookup table that happens to have SteenrodAlgebra(5) in it as well. >> Obviously equality here should return False. >> > > So, for example, for the definition of the __eq__ method for > SteenrodAlgebraElement, replacing > > difference = self - other > return len(difference._raw['milnor']) == 0 > > with > > if self.parent() == other.parent(): > difference = self - other > return len(difference._raw['milnor']) == 0 > else: > return False > > would be good enough? (That is, assuming I've defined a reasonable > __eq__ method for the parents, the SteenrodAlgebra class.) Yes, though that will mean something like A5.P(2) - A5.P(2) == 0 will return False. This is why you are better off using _cmp_ instead of __eq__, __ne__, __le__, __gt__, ... (also, the latter are deprecated in Python). The _cmp_ method will always be called with two things of the same parent, invoking coercion if necessary. - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: coercion question
On Jul 5, 2008, at 12:50 PM, John H Palmieri wrote: > On Jul 5, 10:08 am, Robert Bradshaw <[EMAIL PROTECTED]> > wrote: >> On Jul 4, 2008, at 1:52 PM, John H Palmieri wrote: >> >>> >>> I still don't understand two things: why the gen method is being >>> used, >>> and why if I multiply an element of SteenrodAlgebra(7) by 3, somehow >>> elements of SteenrodAlgebra(5) are getting involved. >> >> I'm not seeing where the gen method is being used--it's probably to >> get a "generic" element to see if multiplication is a viable option. > > It's not apparent where it's used from the traceback, but if I put in > some print statements, e.g., print "gen" at the start of the gen > method, and similarly for _coerce_impl, and for _init_ and _mul_ for > the element class, then when I evaluate 3 * A5.P(2,1,4), gen gets used > before anything else. There is a call to gen(0) in the method > _an_element_c_impl for Parent in parent.pyx; maybe that's where it's > coming from. But mathematically, I still don't understand it... Here is what happens. When it's trying to figure out how to do arithmetic between to sets, say ZZ and A5, it wants to know if ZZ acts on A5 (or, conversely, if A5 acts on ZZ). To do this it needs to get elements of A5 and ZZ to see if they have _rmul_ and/or _lmul_ methods, so it calls _an_element_c_impl whose generic code tries calling gen. (Note, this is in the current model, names have changed a bit, but the general idea is still there). This only happens once, from then on the action (or non-existence of the action) is cached for lookup every time two elements of that kind are encountered. There is much more documentation and introspection in the new model, so hopefully things will be a lot less confusing. - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: coercion question
On Jul 5, 10:08 am, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > On Jul 4, 2008, at 1:52 PM, John H Palmieri wrote: > > > > > > > On Jul 4, 10:53 am, Robert Bradshaw <[EMAIL PROTECTED]> > > wrote: > >> On Jul 4, 2008, at 10:44 AM, John H Palmieri wrote: > > > So I'm very confused. Any ideas what I should look at to try > > to fix > > this? > > Yes, Sage caches some information so it doesn't have to do the > logic > anew on each arithmetic operation. One thing to check is if A5 > == A7 > succeeds. If you could post the traceback I could see if anything > stands out to me. > > >>> Here's an example. > > >>> sage: A5 = SteenrodAlgebra(5); A7 = SteenrodAlgebra(7) > >>> sage: A5 == A7 > >>> False > >>> sage: v = A5.P(2) > >>> sage: w = A7.P(2,1) > >>> sage: 2 * v > >>> 2 P(2) > >>> sage: 3 * w > >>> > >>> -- > >>> - > >>> TypeError Traceback (most recent > >>> call > >>> last) > > >>> /Users/palmieri/ in () > > >>> /Users/palmieri/element.pyx in > >>> sage.structure.element.RingElement.__mul__ (sage/structure/ > >>> element.c: > >>> 8545)() > > >>> /Users/palmieri/coerce.pyx in > >>> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/ > >>> structure/coerce.c:5039)() > > >>> /Users/palmieri/coerce.pyx in > >>> sage.structure.coerce.CoercionModel_cache_maps.get_action_c (sage/ > >>> structure/coerce.c:7864)() > > >>> /Users/palmieri/coerce.pyx in > >>> sage.structure.coerce.CoercionModel_cache_maps.discover_action_c > >>> (sage/ > >>> structure/coerce.c:8522)() > > >>> /Users/palmieri/parent.pyx in > >>> sage.structure.parent.Parent.get_action_c (sage/structure/parent.c: > >>> 1843)() > > >>> /Users/palmieri/parent.pyx in > >>> sage.structure.parent.Parent.get_action_impl (sage/structure/ > >>> parent.c: > >>> 2005)() > > >>> /Users/palmieri/parent.pyx in > >>> sage.structure.parent.Parent.get_action_c_impl (sage/structure/ > >>> parent.c:2672)() > > >>> /Users/palmieri/parent.pyx in sage.structure.parent._register_pair > >>> (sage/structure/parent.c:6360)() > > >>> /Users/palmieri/parent.pyx in sage.structure.parent.EltPair.__eq__ > >>> (sage/structure/parent.c:6183)() > > >>> /Applications/sage/local/lib/python2.5/site-packages/sage/algebras/ > >>> steenrod_algebra.py in __eq__(self, other) > >>> 1528 Two elements are equal if their difference is zero. > >>> 1529 """ > >>> -> 1530 difference = self - other > >>> 1531 return len(difference._raw['milnor']) == 0 > >>> 1532 > > >>> /Users/palmieri/element.pyx in > >>> sage.structure.element.ModuleElement.__sub__ (sage/structure/ > >>> element.c: > >>> 5421)() > > >>> /Users/palmieri/coerce.pyx in > >>> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/ > >>> structure/coerce.c:5338)() > > >>> TypeError: unsupported operand parent(s) for '-': 'mod 7 Steenrod > >>> algebra' and 'mod 5 Steenrod algebra' > > >> Ah, it looks like your __eq__ method is assuming that self and other > >> are elements of the steenrod algebra. There are two solutions to > >> this: > > >> 1) Use __cmp__ which (in Sage) will ensure that self and other have > >> the same parent before it's called > >> 2) Fix your __eq__ (and any other comparison methods you might have) > >> to make sure self-other makes sense (or, as a quick fix, catch the > >> type error here). > > > I still don't understand two things: why the gen method is being used, > > and why if I multiply an element of SteenrodAlgebra(7) by 3, somehow > > elements of SteenrodAlgebra(5) are getting involved. > > I'm not seeing where the gen method is being used--it's probably to > get a "generic" element to see if multiplication is a viable option. It's not apparent where it's used from the traceback, but if I put in some print statements, e.g., print "gen" at the start of the gen method, and similarly for _coerce_impl, and for _init_ and _mul_ for the element class, then when I evaluate 3 * A5.P(2,1,4), gen gets used before anything else. There is a call to gen(0) in the method _an_element_c_impl for Parent in parent.pyx; maybe that's where it's coming from. But mathematically, I still don't understand it... > As for elements of SteenrodAlgebra(7) and SteenrodAlgebra(5) getting > compared, that's because it's looking up something in a (global-ish) > lookup table that happens to have SteenrodAlgebra(5) in it as well. > Obviously equality here should return False. > > - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: coercion question
On Jul 5, 10:08 am, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > On Jul 4, 2008, at 1:52 PM, John H Palmieri wrote: > > > > > > > On Jul 4, 10:53 am, Robert Bradshaw <[EMAIL PROTECTED]> > > wrote: > >> On Jul 4, 2008, at 10:44 AM, John H Palmieri wrote: > > > So I'm very confused. Any ideas what I should look at to try > > to fix > > this? > > Yes, Sage caches some information so it doesn't have to do the > logic > anew on each arithmetic operation. One thing to check is if A5 > == A7 > succeeds. If you could post the traceback I could see if anything > stands out to me. > > >>> Here's an example. > > >>> sage: A5 = SteenrodAlgebra(5); A7 = SteenrodAlgebra(7) > >>> sage: A5 == A7 > >>> False > >>> sage: v = A5.P(2) > >>> sage: w = A7.P(2,1) > >>> sage: 2 * v > >>> 2 P(2) > >>> sage: 3 * w > >>> > >>> -- > >>> - > >>> TypeError Traceback (most recent > >>> call > >>> last) > > >>> /Users/palmieri/ in () > > >>> /Users/palmieri/element.pyx in > >>> sage.structure.element.RingElement.__mul__ (sage/structure/ > >>> element.c: > >>> 8545)() > > >>> /Users/palmieri/coerce.pyx in > >>> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/ > >>> structure/coerce.c:5039)() > > >>> /Users/palmieri/coerce.pyx in > >>> sage.structure.coerce.CoercionModel_cache_maps.get_action_c (sage/ > >>> structure/coerce.c:7864)() > > >>> /Users/palmieri/coerce.pyx in > >>> sage.structure.coerce.CoercionModel_cache_maps.discover_action_c > >>> (sage/ > >>> structure/coerce.c:8522)() > > >>> /Users/palmieri/parent.pyx in > >>> sage.structure.parent.Parent.get_action_c (sage/structure/parent.c: > >>> 1843)() > > >>> /Users/palmieri/parent.pyx in > >>> sage.structure.parent.Parent.get_action_impl (sage/structure/ > >>> parent.c: > >>> 2005)() > > >>> /Users/palmieri/parent.pyx in > >>> sage.structure.parent.Parent.get_action_c_impl (sage/structure/ > >>> parent.c:2672)() > > >>> /Users/palmieri/parent.pyx in sage.structure.parent._register_pair > >>> (sage/structure/parent.c:6360)() > > >>> /Users/palmieri/parent.pyx in sage.structure.parent.EltPair.__eq__ > >>> (sage/structure/parent.c:6183)() > > >>> /Applications/sage/local/lib/python2.5/site-packages/sage/algebras/ > >>> steenrod_algebra.py in __eq__(self, other) > >>> 1528 Two elements are equal if their difference is zero. > >>> 1529 """ > >>> -> 1530 difference = self - other > >>> 1531 return len(difference._raw['milnor']) == 0 > >>> 1532 > > >>> /Users/palmieri/element.pyx in > >>> sage.structure.element.ModuleElement.__sub__ (sage/structure/ > >>> element.c: > >>> 5421)() > > >>> /Users/palmieri/coerce.pyx in > >>> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/ > >>> structure/coerce.c:5338)() > > >>> TypeError: unsupported operand parent(s) for '-': 'mod 7 Steenrod > >>> algebra' and 'mod 5 Steenrod algebra' > > >> Ah, it looks like your __eq__ method is assuming that self and other > >> are elements of the steenrod algebra. There are two solutions to > >> this: > > >> 1) Use __cmp__ which (in Sage) will ensure that self and other have > >> the same parent before it's called > >> 2) Fix your __eq__ (and any other comparison methods you might have) > >> to make sure self-other makes sense (or, as a quick fix, catch the > >> type error here). > > > I still don't understand two things: why the gen method is being used, > > and why if I multiply an element of SteenrodAlgebra(7) by 3, somehow > > elements of SteenrodAlgebra(5) are getting involved. > > I'm not seeing where the gen method is being used--it's probably to > get a "generic" element to see if multiplication is a viable option. > As for elements of SteenrodAlgebra(7) and SteenrodAlgebra(5) getting > compared, that's because it's looking up something in a (global-ish) > lookup table that happens to have SteenrodAlgebra(5) in it as well. > Obviously equality here should return False. > So, for example, for the definition of the __eq__ method for SteenrodAlgebraElement, replacing difference = self - other return len(difference._raw['milnor']) == 0 with if self.parent() == other.parent(): difference = self - other return len(difference._raw['milnor']) == 0 else: return False would be good enough? (That is, assuming I've defined a reasonable __eq__ method for the parents, the SteenrodAlgebra class.) > - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: graphviz installation problem
On Sat, Jul 5, 2008 at 6:01 AM, iSAGE <[EMAIL PROTECTED]> wrote: > > I just installed the ubuntu package libfreetype6-dev, and verified > that it has put several header files in /usr/include/freetype2/ > freetype > But I still get the compilation errors. > In my sage installation in the directory > /usr/local/sage-3.0.2-ubuntu32-intel-i686-Linux/local/include/ > freetype2/freetype/config > I do have the ftheader.h file. So I do not understand the first line > of the error that says: > > /usr/local/sage-3.0.2-ubuntu32-intel-i686-Linux/local/include/ > ft2build.h:56:38: error: freetype/config/ftheader.h: No such file or > directory. > > Thank you, > Bhalchandra graphviz is also a standard Ubuntu package: graphviz - rich set of graph drawing tools So just install it using apt-get install graphviz instead of doing build-from-source in sage. William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: coercion question
On Jul 4, 2008, at 1:52 PM, John H Palmieri wrote: > > > > On Jul 4, 10:53 am, Robert Bradshaw <[EMAIL PROTECTED]> > wrote: >> On Jul 4, 2008, at 10:44 AM, John H Palmieri wrote: >> >> >> >> >> > So I'm very confused. Any ideas what I should look at to try > to fix > this? >> Yes, Sage caches some information so it doesn't have to do the logic anew on each arithmetic operation. One thing to check is if A5 == A7 succeeds. If you could post the traceback I could see if anything stands out to me. >> >>> Here's an example. >> >>> sage: A5 = SteenrodAlgebra(5); A7 = SteenrodAlgebra(7) >>> sage: A5 == A7 >>> False >>> sage: v = A5.P(2) >>> sage: w = A7.P(2,1) >>> sage: 2 * v >>> 2 P(2) >>> sage: 3 * w >>> >>> -- >>> - >>> TypeError Traceback (most recent >>> call >>> last) >> >>> /Users/palmieri/ in () >> >>> /Users/palmieri/element.pyx in >>> sage.structure.element.RingElement.__mul__ (sage/structure/ >>> element.c: >>> 8545)() >> >>> /Users/palmieri/coerce.pyx in >>> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/ >>> structure/coerce.c:5039)() >> >>> /Users/palmieri/coerce.pyx in >>> sage.structure.coerce.CoercionModel_cache_maps.get_action_c (sage/ >>> structure/coerce.c:7864)() >> >>> /Users/palmieri/coerce.pyx in >>> sage.structure.coerce.CoercionModel_cache_maps.discover_action_c >>> (sage/ >>> structure/coerce.c:8522)() >> >>> /Users/palmieri/parent.pyx in >>> sage.structure.parent.Parent.get_action_c (sage/structure/parent.c: >>> 1843)() >> >>> /Users/palmieri/parent.pyx in >>> sage.structure.parent.Parent.get_action_impl (sage/structure/ >>> parent.c: >>> 2005)() >> >>> /Users/palmieri/parent.pyx in >>> sage.structure.parent.Parent.get_action_c_impl (sage/structure/ >>> parent.c:2672)() >> >>> /Users/palmieri/parent.pyx in sage.structure.parent._register_pair >>> (sage/structure/parent.c:6360)() >> >>> /Users/palmieri/parent.pyx in sage.structure.parent.EltPair.__eq__ >>> (sage/structure/parent.c:6183)() >> >>> /Applications/sage/local/lib/python2.5/site-packages/sage/algebras/ >>> steenrod_algebra.py in __eq__(self, other) >>>1528 Two elements are equal if their difference is zero. >>>1529 """ >>> -> 1530 difference = self - other >>>1531 return len(difference._raw['milnor']) == 0 >>>1532 >> >>> /Users/palmieri/element.pyx in >>> sage.structure.element.ModuleElement.__sub__ (sage/structure/ >>> element.c: >>> 5421)() >> >>> /Users/palmieri/coerce.pyx in >>> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/ >>> structure/coerce.c:5338)() >> >>> TypeError: unsupported operand parent(s) for '-': 'mod 7 Steenrod >>> algebra' and 'mod 5 Steenrod algebra' >> >> Ah, it looks like your __eq__ method is assuming that self and other >> are elements of the steenrod algebra. There are two solutions to >> this: >> >> 1) Use __cmp__ which (in Sage) will ensure that self and other have >> the same parent before it's called >> 2) Fix your __eq__ (and any other comparison methods you might have) >> to make sure self-other makes sense (or, as a quick fix, catch the >> type error here). >> > > I still don't understand two things: why the gen method is being used, > and why if I multiply an element of SteenrodAlgebra(7) by 3, somehow > elements of SteenrodAlgebra(5) are getting involved. I'm not seeing where the gen method is being used--it's probably to get a "generic" element to see if multiplication is a viable option. As for elements of SteenrodAlgebra(7) and SteenrodAlgebra(5) getting compared, that's because it's looking up something in a (global-ish) lookup table that happens to have SteenrodAlgebra(5) in it as well. Obviously equality here should return False. - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: C/ Fortran/ .... code generation ?
Yes, there will definitely be code to do this. I've got a lot of ideas but haven't gotten around to it because most of my sage development efforts been spent on coercion. - Robert On Jul 5, 2008, at 12:16 AM, Thierry Dumont wrote: > Hello, > > My question is: is there / will there be some tool for code > generation > in Sage ? > > Many people involved (like me) in "scientific > computing" (implementation > of numerical methods) use computer algebra tools for the generation > of C > (or Fortran, or matlab, or...) code. > For example, if you code finite elemenet method, you will need to > integrate (on a triangle or on a tetrahedron) a lot of polynomials, > derivate them, multiply them and so on... This is a totally trivial > task > (mathematicaly), but actually a boring and error prone job (suppose > you > have 48 polynomials of 3 variables, you have to make the gradients of > all, products of all the pairs gradients and integrate them) (I know: > there are symetries :-) ). At the end, you have to write all the > results > in C, Fortran or in an other language. > > > This is very easy to do this with a computer algebra tool if it can > generate C or Fortran code; I know large industrial societies wich > use, > say, Maple only to do this. > > So, this will be great to have this sort of feature in Sage. > > yours > > > Thierry Dumont > Math. Dpt, Lyon, France. > > > > begin:vcard > fn:Thierry Dumont > n:Dumont;Thierry > org;quoted-printable;quoted-printable:Universit=C3=A9 Lyon 1 & > CNRS.;Institut Camille Jordan -- Math=C3=A9matiques / Mathematics. > adr:;;43 Bd du 11 Novembre.;Villeurbanne;;69621;France > email;internet:[EMAIL PROTECTED] > title;quoted-printable:Ing=C3=A9nieur de Recherche / Research > Engineer. > tel;work:04 72 44 85 23. > tel;fax:04 72 44 80 53 > x-mozilla-html:FALSE > url:http://math.univ-lyon1.fr/~tdumont > version:2.1 > end:vcard > --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: C/ Fortran/ .... code generation ?
mabshoff a écrit : > > > Nope, I think Harald misunderstood you. The goal is to specify say > some finite element and then have logic to produce C or Fortran code > that can be dumped to file and then copy and pasted into someones C or > Fortran code without the need to depend on Sage. I have seen similar > code in Matlab and Maple and had the pleasure to debug autogenerated > code, so I can certainly understand why one would prefer to delegate > such a tedious job of creating that code to a CAS :) > Exactly... yours t.d. --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~--- begin:vcard fn:Thierry Dumont n:Dumont;Thierry org;quoted-printable;quoted-printable:Universit=C3=A9 Lyon 1 & CNRS.;Institut Camille Jordan -- Math=C3=A9matiques / Mathematics. adr:;;43 Bd du 11 Novembre.;Villeurbanne;;69621;France email;internet:[EMAIL PROTECTED] title;quoted-printable:Ing=C3=A9nieur de Recherche / Research Engineer. tel;work:04 72 44 85 23. tel;fax:04 72 44 80 53 x-mozilla-html:FALSE url:http://math.univ-lyon1.fr/~tdumont version:2.1 end:vcard
[sage-support] Re: Performance problem in sage-3.0.2 and sage-3.0.3
On Jul 5, 2008, at 3:27 AM, Daryl Hammond wrote: > Finally I spent several hours trying to reduce the SAGE code down to > the > smallest number of lines that would still present the problem. I > believe I've > done that with the following: > > cat /home/daryl/UserData/sage/add.sage > # 2008-07-04 DWH Created to test out integer arithmetic > > from time import * > > y = range(10 * 1000 * 1000) > > #-- > tbeg = time() > for _ in y: > x = 1 > #-- > tmid = time() > for _ in y: > x = 1 + 1 > #-- > tend = time() > > elapsed = tmid - tbeg > print '10M x=1: ', round(elapsed,2) > elapsed = tend - tmid > print '10M x=1+1:', round(elapsed,2) > > > /home/daryl/sage-3.0.1/sage /home/daryl/UserData/sage/add.sage > 10M x=1: 6.17 > 10M x=1+1: 12.92 > /home/daryl/sage-3.0.2/sage /home/daryl/UserData/sage/add.sage > 10M x=1: 6.22 > 10M x=1+1: 19.78 Alright. Now some debugging by mailing list :-) (1) try the x = 1+1 loop *without* the x = 1, and check you still get the discrepancy between 3.0.1 and 3.0.2. If so, let's ignore the x = 1 code from here on, and concentrate on the x = 1+1. (2) in between each invocation, delete the autogenerated sieve.py file, and check that both 3.0.1 and 3.0.2 are generating essentially the same sieve.py file (it should be something like x = Integer(1) + Integer(1)) (3) increase the loop count to 100 million, and run "top" while the program is running, and keep an eye on the memory usage (for both 3.0.1 and 3.0.2). I want to see if there are any memory leaks. Also check that there aren't any other processes (especially "lisp.run") hogging cpu during the loop. (4) Assuming we haven't found anything interesting yet, now I want to try a few variants of the main loop. Try each of these in a separate program, for both 3.0.1 and 3.0.2, and let me know if any of them slow down: y = range(10^7) for _ in y: x = 1 + 2 y = range(10^7) one = Integer(1) for _ in y: x = one + one y = range(10^7) one = Integer(1) for _ in y: x = one + 1 y = range(7) one = int(1) for _ in y: x = one + one y = range(7) one = Integer(1) for _ in y: x = one.__add__(one) david --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: graphviz installation problem
I just installed the ubuntu package libfreetype6-dev, and verified that it has put several header files in /usr/include/freetype2/ freetype But I still get the compilation errors. In my sage installation in the directory /usr/local/sage-3.0.2-ubuntu32-intel-i686-Linux/local/include/ freetype2/freetype/config I do have the ftheader.h file. So I do not understand the first line of the error that says: /usr/local/sage-3.0.2-ubuntu32-intel-i686-Linux/local/include/ ft2build.h:56:38: error: freetype/config/ftheader.h: No such file or directory. Thank you, Bhalchandra --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: C/ Fortran/ .... code generation ?
On Jul 5, 3:02 am, Harald Schilly <[EMAIL PROTECTED]> wrote: > On Jul 5, 9:16 am, Thierry Dumont <[EMAIL PROTECTED]> wrote: > > > Hello, > > > My question is: is there / will there be some tool for code generation > > in Sage ? It has been discussed of doing something like that recently at Sage Dev1. > Hi, I understand what you want to do, but as far as I understand, this > is only needed, because of the performance? There are already tools > ins Sage to create near native C code out of python (called cython, > but you need to know what to do) and you can optimize symbolic > expressions for fast evaluation. Others might give you more details on > that. In the end, Sage tries to be as good as C/Fortran, but not by > working in two different "worlds". Nope, I think Harald misunderstood you. The goal is to specify say some finite element and then have logic to produce C or Fortran code that can be dumped to file and then copy and pasted into someones C or Fortran code without the need to depend on Sage. I have seen similar code in Matlab and Maple and had the pleasure to debug autogenerated code, so I can certainly understand why one would prefer to delegate such a tedious job of creating that code to a CAS :) > H Cheers, Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: graphviz installation problem
On Jul 5, 3:54 am, iSAGE <[EMAIL PROTECTED]> wrote: Hi, > Sorry, a little correction: > I issued the command sage -i graphviz-2.16.1.p0 which gave errors, but > nauty could be installed without trouble. Yep, I would only install one spkg at a time. > On Jul 5, 11:33 am, iSAGE <[EMAIL PROTECTED]> wrote: > > > I get the following errors while trying to install graphviz. > > I am using ubuntu 8.04 and sage-3.0.2-ubuntu32-intel-i686-Linux > > I issued the command sage -i nauty-24b7 -i graphviz-2.16.1.p0 > > > This is the first time I have tried to install any package, so I am > > unsure if I am doing anything wrong, but nauty installed without any > > errors or warnings. One thing that is not clear to me is: are the > > optional packages not pre-compiled? > > > Thank you for help. > > > Bhalchandra Thatte > > Alfréd Rényi Institute of Mathematics > > Hungarian Academy of Sciences > > > - error messages --- > > > In file included from gdft.c:107: > > /usr/local/sage-3.0.2-ubuntu32-intel-i686-Linux/local/include/ > > ft2build.h:56:38: error: freetype/config/ftheader.h: No such file or > > directory The freetype headers are missing. On ubuntu 8.04 they seem to be in freetype-devel-0-2.0.3-10, so you might want to check your package manager to install them. Installing the headers might cause additional software to be installed. Cheers, Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: graphviz installation problem
Sorry, a little correction: I issued the command sage -i graphviz-2.16.1.p0 which gave errors, but nauty could be installed without trouble. On Jul 5, 11:33 am, iSAGE <[EMAIL PROTECTED]> wrote: > I get the following errors while trying to install graphviz. > I am using ubuntu 8.04 and sage-3.0.2-ubuntu32-intel-i686-Linux > I issued the command sage -i nauty-24b7 -i graphviz-2.16.1.p0 > > This is the first time I have tried to install any package, so I am > unsure if I am doing anything wrong, but nauty installed without any > errors or warnings. One thing that is not clear to me is: are the > optional packages not pre-compiled? > > Thank you for help. > > Bhalchandra Thatte > Alfréd Rényi Institute of Mathematics > Hungarian Academy of Sciences > > - error messages --- > > In file included from gdft.c:107: > /usr/local/sage-3.0.2-ubuntu32-intel-i686-Linux/local/include/ > ft2build.h:56:38: error: freetype/config/ftheader.h: No such file or > directory > gdft.c:108:10: error: #include expects "FILENAME" or > gdft.c:109:10: error: #include expects "FILENAME" or > gdft.c:110:10: error: #include expects "FILENAME" or > gdft.c:130: error: expected specifier-qualifier-list before > 'FT_Library' > gdft.c:139: error: expected specifier-qualifier-list before > 'FT_Library' > gdft.c:222: error: expected '=', ',', ';', 'asm' or '__attribute__' > before 'library' > gdft.c: In function 'fontFetch': > gdft.c:441: error: 'FT_Error' undeclared (first use in this function) > gdft.c:441: error: (Each undeclared identifier is reported only once > gdft.c:441: error: for each function it appears in.) > gdft.c:441: error: expected ';' before 'err' > gdft.c:452: error: 'font_t' has no member named 'library' > gdft.c:452: error: 'fontkey_t' has no member named 'library' > gdft.c:481: error: 'err' undeclared (first use in this function) > gdft.c:481: warning: implicit declaration of function 'FT_New_Face' > gdft.c:481: error: 'fontkey_t' has no member named 'library' > gdft.c:481: error: 'font_t' has no member named 'face' > gdft.c:490: warning: implicit declaration of function 'FT_Attach_File' > gdft.c:490: error: 'font_t' has no member named 'face' > gdft.c: In function 'fontRelease': > gdft.c:511: warning: implicit declaration of function 'FT_Done_Face' > gdft.c:511: error: 'font_t' has no member named 'face' > gdft.c: At top level: > gdft.c:609: error: expected declaration specifiers or '...' before > 'FT_Bitmap' > gdft.c: In function 'gdft_draw_bitmap': > gdft.c:625: error: 'bitmap' undeclared (first use in this function) > gdft.c:637: error: 'ft_pixel_mode_grays' undeclared (first use in this > function) > gdft.c:646: error: 'ft_pixel_mode_mono' undeclared (first use in this > function) > gdft.c: In function 'gdFontCacheShutdown': > gdft.c:797: warning: implicit declaration of function > 'FT_Done_FreeType' > gdft.c:797: error: 'library' undeclared (first use in this function) > gdft.c: In function 'gdFontCacheSetup': > gdft.c:819: warning: implicit declaration of function > 'FT_Init_FreeType' > gdft.c:819: error: 'library' undeclared (first use in this function) > gdft.c: In function 'gdImageStringFTEx': > gdft.c:839: error: 'FT_Matrix' undeclared (first use in this function) > gdft.c:839: error: expected ';' before 'matrix' > gdft.c:840: error: 'FT_Vector' undeclared (first use in this function) > gdft.c:840: error: expected ';' before 'penf' > gdft.c:841: error: 'FT_Face' undeclared (first use in this function) > gdft.c:841: error: expected ';' before 'face' > gdft.c:842: error: 'FT_CharMap' undeclared (first use in this > function) > gdft.c:842: error: expected ';' before 'charmap' > gdft.c:843: error: 'FT_Glyph' undeclared (first use in this function) > gdft.c:843: error: expected ';' before 'image' > gdft.c:844: error: 'FT_GlyphSlot' undeclared (first use in this > function) > gdft.c:844: error: expected ';' before 'slot' > gdft.c:845: error: 'FT_Error' undeclared (first use in this function) > gdft.c:845: error: expected ';' before 'err' > gdft.c:846: error: 'FT_UInt' undeclared (first use in this function) > gdft.c:846: error: expected ';' before 'glyph_index' > gdft.c:855: error: 'FT_BitmapGlyph' undeclared (first use in this > function) > gdft.c:855: error: expected ';' before 'bm' > gdft.c:858: error: 'FT_LOAD_DEFAULT' undeclared (first use in this > function) > gdft.c:873: error: 'FT_Size' undeclared (first use in this function) > gdft.c:873: error: expected ';' before 'platform_specific' > gdft.c:904: error: 'fontkey_t' has no member named 'library' > gdft.c:904: error: 'library' undeclared (first use in this function) > gdft.c:912: error: 'face' undeclared (first use in this function) > gdft.c:912: error: 'font_t' has no member named 'face' > gdft.c:913: error: 'slot' undeclared (first use in this function) > gdft.c:917: error: 'total_min' undeclared (first use in this function) > gdft.c:918: error: 'total_max' undeclared (first use in this function) > gdft.c:953
[sage-support] Re: C/ Fortran/ .... code generation ?
On Jul 5, 9:16 am, Thierry Dumont <[EMAIL PROTECTED]> wrote: > Hello, > > My question is: is there / will there be some tool for code generation > in Sage ? Hi, I understand what you want to do, but as far as I understand, this is only needed, because of the performance? There are already tools ins Sage to create near native C code out of python (called cython, but you need to know what to do) and you can optimize symbolic expressions for fast evaluation. Others might give you more details on that. In the end, Sage tries to be as good as C/Fortran, but not by working in two different "worlds". H --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] graphviz installation problem
I get the following errors while trying to install graphviz. I am using ubuntu 8.04 and sage-3.0.2-ubuntu32-intel-i686-Linux I issued the command sage -i nauty-24b7 -i graphviz-2.16.1.p0 This is the first time I have tried to install any package, so I am unsure if I am doing anything wrong, but nauty installed without any errors or warnings. One thing that is not clear to me is: are the optional packages not pre-compiled? Thank you for help. Bhalchandra Thatte Alfréd Rényi Institute of Mathematics Hungarian Academy of Sciences - error messages --- In file included from gdft.c:107: /usr/local/sage-3.0.2-ubuntu32-intel-i686-Linux/local/include/ ft2build.h:56:38: error: freetype/config/ftheader.h: No such file or directory gdft.c:108:10: error: #include expects "FILENAME" or gdft.c:109:10: error: #include expects "FILENAME" or gdft.c:110:10: error: #include expects "FILENAME" or gdft.c:130: error: expected specifier-qualifier-list before 'FT_Library' gdft.c:139: error: expected specifier-qualifier-list before 'FT_Library' gdft.c:222: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'library' gdft.c: In function 'fontFetch': gdft.c:441: error: 'FT_Error' undeclared (first use in this function) gdft.c:441: error: (Each undeclared identifier is reported only once gdft.c:441: error: for each function it appears in.) gdft.c:441: error: expected ';' before 'err' gdft.c:452: error: 'font_t' has no member named 'library' gdft.c:452: error: 'fontkey_t' has no member named 'library' gdft.c:481: error: 'err' undeclared (first use in this function) gdft.c:481: warning: implicit declaration of function 'FT_New_Face' gdft.c:481: error: 'fontkey_t' has no member named 'library' gdft.c:481: error: 'font_t' has no member named 'face' gdft.c:490: warning: implicit declaration of function 'FT_Attach_File' gdft.c:490: error: 'font_t' has no member named 'face' gdft.c: In function 'fontRelease': gdft.c:511: warning: implicit declaration of function 'FT_Done_Face' gdft.c:511: error: 'font_t' has no member named 'face' gdft.c: At top level: gdft.c:609: error: expected declaration specifiers or '...' before 'FT_Bitmap' gdft.c: In function 'gdft_draw_bitmap': gdft.c:625: error: 'bitmap' undeclared (first use in this function) gdft.c:637: error: 'ft_pixel_mode_grays' undeclared (first use in this function) gdft.c:646: error: 'ft_pixel_mode_mono' undeclared (first use in this function) gdft.c: In function 'gdFontCacheShutdown': gdft.c:797: warning: implicit declaration of function 'FT_Done_FreeType' gdft.c:797: error: 'library' undeclared (first use in this function) gdft.c: In function 'gdFontCacheSetup': gdft.c:819: warning: implicit declaration of function 'FT_Init_FreeType' gdft.c:819: error: 'library' undeclared (first use in this function) gdft.c: In function 'gdImageStringFTEx': gdft.c:839: error: 'FT_Matrix' undeclared (first use in this function) gdft.c:839: error: expected ';' before 'matrix' gdft.c:840: error: 'FT_Vector' undeclared (first use in this function) gdft.c:840: error: expected ';' before 'penf' gdft.c:841: error: 'FT_Face' undeclared (first use in this function) gdft.c:841: error: expected ';' before 'face' gdft.c:842: error: 'FT_CharMap' undeclared (first use in this function) gdft.c:842: error: expected ';' before 'charmap' gdft.c:843: error: 'FT_Glyph' undeclared (first use in this function) gdft.c:843: error: expected ';' before 'image' gdft.c:844: error: 'FT_GlyphSlot' undeclared (first use in this function) gdft.c:844: error: expected ';' before 'slot' gdft.c:845: error: 'FT_Error' undeclared (first use in this function) gdft.c:845: error: expected ';' before 'err' gdft.c:846: error: 'FT_UInt' undeclared (first use in this function) gdft.c:846: error: expected ';' before 'glyph_index' gdft.c:855: error: 'FT_BitmapGlyph' undeclared (first use in this function) gdft.c:855: error: expected ';' before 'bm' gdft.c:858: error: 'FT_LOAD_DEFAULT' undeclared (first use in this function) gdft.c:873: error: 'FT_Size' undeclared (first use in this function) gdft.c:873: error: expected ';' before 'platform_specific' gdft.c:904: error: 'fontkey_t' has no member named 'library' gdft.c:904: error: 'library' undeclared (first use in this function) gdft.c:912: error: 'face' undeclared (first use in this function) gdft.c:912: error: 'font_t' has no member named 'face' gdft.c:913: error: 'slot' undeclared (first use in this function) gdft.c:917: error: 'total_min' undeclared (first use in this function) gdft.c:918: error: 'total_max' undeclared (first use in this function) gdft.c:953: error: 'matrix' undeclared (first use in this function) gdft.c:953: error: 'FT_Fixed' undeclared (first use in this function) gdft.c:959: warning: implicit declaration of function 'FT_Set_Transform' gdft.c:961: warning: implicit declaration of function 'FT_New_Size' gdft.c:961: error: 'platform_independent' undeclared (first use in this function) gdft.c:962: warning: implicit decl
[sage-support] Re: Performance problem in sage-3.0.2 and sage-3.0.3
David, I re-installed sage-3.0.2 from source and then ran your test against sage-3.0.1 and sage-3.0.2. The run times were comparable. [EMAIL PROTECTED] sage]$ /home/daryl/sage-3.0.1/sage -- | SAGE Version 3.0.1, Release Date: 2008-05-05 | | Type notebook() for the GUI, and license() for information.| -- sage: x = ZZ.random_element(2^400) sage: y = ZZ.random_element(2^400) sage: time z = x.xgcd(y) CPU times: user 12.84 s, sys: 0.11 s, total: 12.94 s Wall time: 13.02 sage: quit Exiting SAGE (CPU time 0m12.98s, Wall time 1m9.88s). [EMAIL PROTECTED] sage]$ /home/daryl/sage-3.0.2/sage -- | SAGE Version 3.0.2, Release Date: 2008-05-24 | | Type notebook() for the GUI, and license() for information.| -- sage: x = ZZ.random_element(2^400) sage: y = ZZ.random_element(2^400) sage: time z = x.xgcd(y) CPU times: user 12.92 s, sys: 0.12 s, total: 13.04 s Wall time: 13.10 s sage: quit Exiting SAGE (CPU time 0m13.07s, Wall time 0m51.21s). I then ran my sieve program against both sage-3.0.1 and sage-3.0.2 and my results still show increased elapsed/cpu times for sage-3.0.2: /home/daryl/sage-3.0.1/sage /home/daryl/UserData/sage/sieve.sage SAGE Version 3.0.1, Release Date: 2008-05-05 Start time: Fri Jul 4 19:18:47 2008 Array size: 1000 Create array: Fri Jul 4 19:19:04 2008 Create seconds: 16.99 Mark primes: Fri Jul 4 19:19:42 2008 Mark seconds: 38.28 Count primes: Fri Jul 4 19:20:00 2008 Count seconds:17.65 Number of primes: 664579 End time: Fri Jul 4 19:20:00 2008 Elapsed seconds: 72.92 /home/daryl/sage-3.0.2/sage /home/daryl/UserData/sage/sieve.sage SAGE Version 3.0.2, Release Date: 2008-05-24 Start time: Fri Jul 4 19:20:06 2008 Array size: 1000 Create array: Fri Jul 4 19:20:31 2008 Create seconds: 25.36 Mark primes: Fri Jul 4 19:21:43 2008 Mark seconds: 71.26 Count primes: Fri Jul 4 19:22:11 2008 Count seconds:28.95 Number of primes: 664579 End time: Fri Jul 4 19:22:11 2008 Elapsed seconds: 125.57 It appears that you are correct that the testing and changing I did on Thursday to the sage-3.0.2 gmp code somehow corrupted/regressed it. Finally I spent several hours trying to reduce the SAGE code down to the smallest number of lines that would still present the problem. I believe I've done that with the following: cat /home/daryl/UserData/sage/add.sage # 2008-07-04 DWH Created to test out integer arithmetic from time import * y = range(10 * 1000 * 1000) #-- tbeg = time() for _ in y: x = 1 #-- tmid = time() for _ in y: x = 1 + 1 #-- tend = time() elapsed = tmid - tbeg print '10M x=1: ', round(elapsed,2) elapsed = tend - tmid print '10M x=1+1:', round(elapsed,2) /home/daryl/sage-3.0.1/sage /home/daryl/UserData/sage/add.sage 10M x=1: 6.17 10M x=1+1: 12.92 /home/daryl/sage-3.0.2/sage /home/daryl/UserData/sage/add.sage 10M x=1: 6.22 10M x=1+1: 19.78 The two sections of code differ by a single line: x = 1 vs. x = 1 + 1. Running on a 2.8 Ghz P4: for x = 1 the times are the same; for x = 1 + 1 the times differ by 6.86 seconds (a 53% increase). However, when that 6.86 seconds is divided by 10,000,000 a single x = 1 + 1 is only taking .686 micro seconds longer. Depending on how you use SAGE/ gmp, the observable results will differ. Adding or multiplying a couple of really big numbers won't show a perceptible difference. Adding or multiplying tens of millions of numbers will cause the difference to add up. In the case of my sieve program, loop control (adding 1) made up a substantial portion of the total code. I'll let someone else decide whether this result in sage-3.0.2 is a bug or a feature (a feature being a bug in a tuxedo). -Daryl --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] C/ Fortran/ .... code generation ?
Hello, My question is: is there / will there be some tool for code generation in Sage ? Many people involved (like me) in "scientific computing" (implementation of numerical methods) use computer algebra tools for the generation of C (or Fortran, or matlab, or...) code. For example, if you code finite elemenet method, you will need to integrate (on a triangle or on a tetrahedron) a lot of polynomials, derivate them, multiply them and so on... This is a totally trivial task (mathematicaly), but actually a boring and error prone job (suppose you have 48 polynomials of 3 variables, you have to make the gradients of all, products of all the pairs gradients and integrate them) (I know: there are symetries :-) ). At the end, you have to write all the results in C, Fortran or in an other language. This is very easy to do this with a computer algebra tool if it can generate C or Fortran code; I know large industrial societies wich use, say, Maple only to do this. So, this will be great to have this sort of feature in Sage. yours Thierry Dumont Math. Dpt, Lyon, France. --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@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-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~--- begin:vcard fn:Thierry Dumont n:Dumont;Thierry org;quoted-printable;quoted-printable:Universit=C3=A9 Lyon 1 & CNRS.;Institut Camille Jordan -- Math=C3=A9matiques / Mathematics. adr:;;43 Bd du 11 Novembre.;Villeurbanne;;69621;France email;internet:[EMAIL PROTECTED] title;quoted-printable:Ing=C3=A9nieur de Recherche / Research Engineer. tel;work:04 72 44 85 23. tel;fax:04 72 44 80 53 x-mozilla-html:FALSE url:http://math.univ-lyon1.fr/~tdumont version:2.1 end:vcard