วันพฤหัสบดีที่ 31 มีนาคม พ.ศ. 2554

[sage-devel] Fixed: Decorators ruining documentation

Hi everyone

Can someone please review ticket #9976; its patch has been there for
~6 months now.
It fixes a problem with decorators and Sphinx: as it is now, most
decorated functions will get a generic signature in the Sphinx
documentation. Notable examples include most of the plot commands,
e.g.
http://sagemath.org/doc/reference/sage/plot/plot.html#sage.plot.plot.plot
as well as any function decorated with the "deprecated"-decorator
(used for deprecating named arguments).

The ticket introduces a new way of handling this by slightly patching
Sphinx and including extra information in the "sage_wraps" decorator.
The latter is an extension of the pure Python "wraps" decorator, which
is already mandatory to use in decorators meant to decorate top-level
callables.

Cheers,
Johan

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Difference between conversion and coercion?

Hi!

I hope sage-devel is the right place to ask a very basic question on
the coercion model.

sage.structure.parent.Parent has methods register_conversion and
register_coercion. What is the difference between conversion and
coercion? I see that there are different caches for the two. In what
situation is a coercion used, and in what situation a conversion?

BTW, I think a method that tells whether there is already a conversion
resp. a coercion from a ring R is cached, would be quite handy. I
could not find such method (returning "R in self._coerce_from_hash"
resp. "R in in self._convert_from_hash"). Is there anything, or shall
I implement it myself?

Best regards,
Simon

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] Re: Parallel builds

On Mar 31, 2011, at 21:24 , Volker Braun wrote:

> I agree that the number of make -jN threads should be a good deal larger
> than the number of physical cores. Also, make sure that you set
>
> export SAGE_PARALLEL_SPKG_BUILD=yes
>
> or you'll see mostly a slow single-threaded configure followed by a
> lightning-fast compile phase. This should be really the default by now but
> unfortunately it is not.

In my case, that environment variable was set to 'yes'.

J

--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
-----------
My wife 'n kids 'n dogs are gone,
I can't get Jesus on the phone,
But Ol' Milwaukee's Best is my best friend.
-----------


--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: sage notebook with many Jmol viewers

So I just made a fresh build of sage and the patching went smoothly.
Not sure what was causing the problem. So far, everything works
great! I also noticed that it did seem to take a long time for the
applets to load, and somehow it seems that the image resolution is not
as good as it was before I did the update. Presumably this is to save
memory, but it would be nice if this could be a global option somehow.

Thanks!
Jon

On Mar 31, 4:05 pm, jtyard <jty...@gmail.com> wrote:
> Thanks guys.  I was definitely using hg_sagenb.apply() and not
> hg_sagenb.commit(), so I am not sure why it was asking me to commit.
> The only difference from what you say Jonathan was that I was applying
> the patches from a local directory and not an http:, so I doubt that
> makes a difference.  I will play with it some more tonight and see if
> I can get somewhere.
>
> Jon
>
> On Mar 31, 3:13 pm, "Dr. David Kirkby" <david.kir...@onetel.net>
> wrote:
>
>
>
>
>
>
>
> > On 03/31/11 05:32 PM, jtyard wrote:
>
> > > Hi Jonathan,
>
> > > Thanks for your reply.  I tried last night to figure out how to patch
> > > my notebook, and I ended up giving up after several hours.  I also
> > > couldn't find any documentation for hg_sagenb.apply.  After updating
> > > jmol to 1.1.5, I tried to follow the directions at
>
> > >http://www.sagemath.org/doc/developer/walk_through.html#reviewing-a-p...
>
> > > only replacing hg_sage.apply with hg_sagenb.apply, but things seem not
> > > to be as simple as described on that page.  Running the command on a
> > > patch drops me into a vim editor that shows the text of the whole
> > > patch.  Not knowing what to do, I press "q" and I am then asked to
> > > enter a commit message.  No matter what I seem to do, when I try to
> > > quit vim it warns me that there was "no write since last change", and
> > > if I quit with :q! then it seems I am back where I started.  It
> > > doesn't help that I am next to clueless about vim, having been raised
> > > on emacs, but I really am beyond confused about why I am being dropped
> > > into the editor in the first place.
>
> > > Any pointers you could give me to get the new notebook up and running
> > > would be much appreciated.  I'll be more than happy to test it.
>
> > > Thanks,
> > > Jon
>
> > If you make changes to the code and try to commit them, then you must give a
> > message why. I must admit I can't see why that should be so with you applying a
> > patch though.
>
> > I personally never use the "hg" commands in Sage, but use a version of "hg" on
> > my system, so I can't really say too much about your issues.
>
> > If set this:
>
> > EDITOR=emacs
> > export EDITOR
>
> > then instead of firing up vim, you will get emacs. (I had the almost the
> > opposite problem to you - my system kept firing up the GUI editor "gedit", but I
> > wanted vi!)
>
> > I believe there's a variable you can use that selects the editor for Mercurial
> > (i.e. hg) only. I'm not sure what it is, but Google would find it. But I just
> > use "EDITOR" as I use vi for everything anyway.
>
> > I must admit though, I'm still puzzled why you are asked to supply a commit
> > message.
>
> > Dave

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: Parallel builds

I agree that the number of make -jN threads should be a good deal larger than the number of physical cores. Also, make sure that you set

export SAGE_PARALLEL_SPKG_BUILD=yes

or you'll see mostly a slow single-threaded configure followed by a lightning-fast compile phase. This should be really the default by now but unfortunately it is not.


--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] Spam tickets on Trac

On Fri, Apr 1, 2011 at 1:20 PM, kcrisman <kcrisman@gmail.com> wrote:
> See (or don't) #11102 and #11103. Now they're creating new tickets,
> not just comments. Hopefully someone can get rid of them.

They're closed as invalid and the corresponding accounts deleted.


> But it
> would be bad to go back to the "email William for an account" days...

We need a better recaptcha plugin. The current one seems to be broken
somehow. I have been dealing with spam accounts on a daily basis for
months now, but it was only recently that I found myself dealing with
more spam tickets than usual.

--
Regards
Minh Van Nguyen

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Parallel builds

Hi, all,

I've just upgraded my home system, to a Mac Pro (Dual 6-core Xeon, 24GB memory), and figured (hoped) I'd see 24 processes hammering away during the build & test of a Sage release.

Turns out not to happen. For the record, these new cores from Intel sport 2 "threads" each, which act almost like separate cores, capable on this system of running 24 processes at a time. However, both for the build itself, and the test, there are generally at most 12 runnable processes at any time.

Anyone have any idea why the parallelism is limited this way?

FWIW, I started with "-j24", and when I saw only half the threads active, talked with Apple about it. Their suggestion (based on their experience with kernel builds) is to request double the number of available threads. I reran the build/test with "-j48", and saw no improvement: the number of runnable threads remained at ~12.

Thoughts?

Justin

--
Justin C. Walker, Curmudgeon at Large
Director
Institute for the Enhancement of the Director's income
-----------
--
They said it couldn't be done, but sometimes,
it doesn't work out that way.
- Casey Stengel
--

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Spam tickets on Trac

See (or don't) #11102 and #11103. Now they're creating new tickets,
not just comments. Hopefully someone can get rid of them. But it
would be bad to go back to the "email William for an account" days...

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: lcalc code quality

On Thursday, March 31, 2011 3:09:38 PM UTC-4, kcrisman wrote:
 I realize that not everyone will agree on what
acronyms/cuss words are appropriate for this forum

In the context of programming, I think of WTF mostly as  http://thedailywtf.com. In its own humorous ways, it has a lot to teach about code engineering in large-scale projects...


--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Extra Readline Commands

Hi all,

This is to advertise a patch (http://trac.sagemath.org/sage_trac/
ticket/10289
) which, unfortunately, is sleeping in Trac without a
reviewer for more than four months.

This patch would be very useful for those who converted from Magma.
Please review!


------------------------------------
Extra Readline Commands

The following three extra readline commands are installed:

- ``operate-and-get-next``
- ``history-search-backward-and-save``
- ``history-search-forward-and-save``

The ``operate-and-get-next`` command accepts the input line and
fetches the next line
from the history. This is the same command with the same name in the
Bash shell.

The ``history-search-backward-and-save`` command searches backward in
the history
for the string of characters from the start of the input line to the
current cursor
position, and fetches the line found. The position of the fetched
history line is
saved internally. If the cursor is at the start of the line, the
previous line
in the history from the saved position is fetched.

The ``history-search-forward-and-save`` command does the same with the
previous command
but forward. Hence this command is useful to fetch a block of lines
from the history by
first searching the first line of the block and then issuing this
command as many times
as needed.

The previous two commands is best used in tandem. They are intended to
replace the
``history-search-backward`` command and the ``history-search-forward``
command provided by
the GNU readline library used in Sage.

To bind these commands with keys, insert the relevant lines into the
``ipython/ipythonrc``
file in the Sage root directory. For example,

::

readline_parse_and_bind "\C-o": operate-and-get-next
readline_parse_and_bind "\e[A": history-search-backward-and-save
readline_parse_and_bind "\e[B": history-search-forward-and-save

binds the three commands with the control-o key, the up arrow key, and
the down arrow key,
respectively.

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] Re: sage notebook with many Jmol viewers

On Thu, 31 Mar 2011 at 06:08AM -0700, Jonathan wrote:
> If you want to see what is coming down the pike in the next few
> weeks, take a look at the published samples on my test server:
> http:///141.233.197.45:8888. I could really use some comments on how
> it works.

I'm using Firefox 4.0 on Ubuntu 10.10 with the Sun/Oracle Java and
http://141.233.197.45:8888/home/pub/0/ is working great. I really like
the new controls -- putting it in a new window, changing the size,
turning the spin on and off. The sleeping/interactive thing is also
nice.

The only slight problem is that it did take quite a long time for all
the applets to load, but I suppose it's better to get things working
first before we worry about speed.

I tried the "lots of applets" worksheet, and tried to get every applet
interactive and spinning. I see that some will automatically sleep,
rather than have too many applets running. That's nice.

Excellent work! Thanks so much for your efforts. Jmol is absolutely
essential to me when I teach multivariable calc.

Dan

--
--- Dan Drake
----- http://mathsci.kaist.ac.kr/~drake
-------

[sage-devel] Debugging some cython code / Pynac

I've built Sage 64-bit on OpenSolaris but it crashes at startup. I've run gdb
and find the bit of code that's causing the crash is this.

./devel/sage-main/sage/symbolic/function.cpp


/* "sage/symbolic/function.pyx":109
* raise ValueError, real_fname + " parameter must be callable"
*
* if not self._is_registered(): # <<<<<<<<<<<<<<
* self._register_function()
*
*/


commenting out the next few lines of
./devel/sage-main/sage/symbolic/function.cpp

/* __pyx_t_2 = ((struct __pyx_vtabstruct_4sage_8symbolic_8function_Function
*)((struct __pyx_obj_4sage_8symbolic_8function_Function
*)__pyx_v_self)->__pyx_vtab)->_is_registered(((struct
__pyx_obj_4sage_8symbolic_8function_Function *)__pyx_v_self)); if
(unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109;
__pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0))
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto
__pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_5 = (!__pyx_t_6);
*/

allows Sage to run. It's not 100% stable, but much better than before.

This comes from:

./devel/sage-main/build/sage/symbolic/function.pyx (around line 109)

#
###### if not self._is_registered():
###### self._register_function()
######
###### global sfunction_serial_dict
###### sfunction_serial_dict[self._serial] = self
#

Can anyone see if there might be something wrong with this code, which is
causing Sage to segfault?

I've not tied it down to a specific line yet, but just removed everything under
the 'if' statement.

Why when I edit the .pyx file and type

./sage -b

does it not rebuild the C++ code? I ended up having to edit the C++ manually to
comment out the lines causing the crash.

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

Dave

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] Re: How to cope with a long method resolution order?

On Wed, Mar 30, 2011 at 12:17:06AM -0700, Simon King wrote:
> I tested, and found that cpdef'ing does not help (much):
>
> With def:
> sage: R.<x,y> = QQ['t'][]
> sage: timeit('R.base_ring')
> 625 loops, best of 3: 967 ns per loop
>
> With cpdef:
> sage: R.<x,y> = QQ['t'][]
> sage: timeit('R.base_ring')
> 625 loops, best of 3: 958 ns per loop
>
> Manually defining R.base_ring = R.base_ring:
> sage: timeit('R.base_ring')
> 625 loops, best of 3: 896 ns per loop

I expected a potential improvement not when calling base_ring from the
interpreter, but from compiled Cython code, typically in
coercion/arithmetic.

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" <nthiery@users.sf.net>
http://Nicolas.Thiery.name/

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] lcalc code quality

On Thu, Mar 31, 2011 at 3:28 PM, Francois Bissey
<francois.bissey@canterbury.ac.nz> wrote:
> I'll certainly commiserate with him being busy with his new baby (got a new
> one of my own on Monday, they are demanding little thing, let's not mention
> the students...)

Congratulations!

John

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] lcalc code quality

> On 03/31/11 05:22 PM, Volker Braun wrote:
> >As Dave Kirby remarked,
> >
> > right now it compiles on a couple of gcc releases and essentially no
> > other compiler. And thats hardly a surprise if you look at the code. At
> > the very least the endless compiler warnings need to be looked at /
> > fixed.
>
> Micheal did a while back say:
>
> "The antiquated header files and unused variables have been removed in
> L-1.3, which has not yet been released to the public. It should be
> released in the next couple of weeks"
>
Yes I had that same reply to a private message I sent him some time ago.
I had tried to fix the deprecated header warning but it broke sage's tests
in turn. They broke because with my fix lcalc couldn't take input that were
as large as before...

I'll certainly commiserate with him being busy with his new baby (got a new
one of my own on Monday, they are demanding little thing, let's not mention
the students...)

Francois

[sage-devel] Re: sage notebook with many Jmol viewers

Thanks guys. I was definitely using hg_sagenb.apply() and not
hg_sagenb.commit(), so I am not sure why it was asking me to commit.
The only difference from what you say Jonathan was that I was applying
the patches from a local directory and not an http:, so I doubt that
makes a difference. I will play with it some more tonight and see if
I can get somewhere.

Jon

On Mar 31, 3:13 pm, "Dr. David Kirkby" <david.kir...@onetel.net>
wrote:
> On 03/31/11 05:32 PM, jtyard wrote:
>
>
>
>
>
>
>
>
>
> > Hi Jonathan,
>
> > Thanks for your reply.  I tried last night to figure out how to patch
> > my notebook, and I ended up giving up after several hours.  I also
> > couldn't find any documentation for hg_sagenb.apply.  After updating
> > jmol to 1.1.5, I tried to follow the directions at
>
> >http://www.sagemath.org/doc/developer/walk_through.html#reviewing-a-p...
>
> > only replacing hg_sage.apply with hg_sagenb.apply, but things seem not
> > to be as simple as described on that page.  Running the command on a
> > patch drops me into a vim editor that shows the text of the whole
> > patch.  Not knowing what to do, I press "q" and I am then asked to
> > enter a commit message.  No matter what I seem to do, when I try to
> > quit vim it warns me that there was "no write since last change", and
> > if I quit with :q! then it seems I am back where I started.  It
> > doesn't help that I am next to clueless about vim, having been raised
> > on emacs, but I really am beyond confused about why I am being dropped
> > into the editor in the first place.
>
> > Any pointers you could give me to get the new notebook up and running
> > would be much appreciated.  I'll be more than happy to test it.
>
> > Thanks,
> > Jon
>
> If you make changes to the code and try to commit them, then you must give a
> message why. I must admit I can't see why that should be so with you applying a
> patch though.
>
> I personally never use the "hg" commands in Sage, but use a version of "hg" on
> my system, so I can't really say too much about your issues.
>
> If set this:
>
> EDITOR=emacs
> export EDITOR
>
> then instead of firing up vim, you will get emacs. (I had the almost the
> opposite problem to you - my system kept firing up the GUI editor "gedit", but I
> wanted vi!)
>
> I believe there's a variable you can use that selects the editor for Mercurial
> (i.e. hg) only. I'm not sure what it is, but Google would find it. But I just
> use "EDITOR" as I use vi for everything anyway.
>
> I must admit though, I'm still puzzled why you are asked to supply a commit
> message.
>
> Dave

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] Re: sage notebook with many Jmol viewers

On 03/31/11 05:32 PM, jtyard wrote:
> Hi Jonathan,
>
> Thanks for your reply. I tried last night to figure out how to patch
> my notebook, and I ended up giving up after several hours. I also
> couldn't find any documentation for hg_sagenb.apply. After updating
> jmol to 1.1.5, I tried to follow the directions at
>
> http://www.sagemath.org/doc/developer/walk_through.html#reviewing-a-patch
>
> only replacing hg_sage.apply with hg_sagenb.apply, but things seem not
> to be as simple as described on that page. Running the command on a
> patch drops me into a vim editor that shows the text of the whole
> patch. Not knowing what to do, I press "q" and I am then asked to
> enter a commit message. No matter what I seem to do, when I try to
> quit vim it warns me that there was "no write since last change", and
> if I quit with :q! then it seems I am back where I started. It
> doesn't help that I am next to clueless about vim, having been raised
> on emacs, but I really am beyond confused about why I am being dropped
> into the editor in the first place.
>
> Any pointers you could give me to get the new notebook up and running
> would be much appreciated. I'll be more than happy to test it.
>
> Thanks,
> Jon

If you make changes to the code and try to commit them, then you must give a
message why. I must admit I can't see why that should be so with you applying a
patch though.

I personally never use the "hg" commands in Sage, but use a version of "hg" on
my system, so I can't really say too much about your issues.

If set this:

EDITOR=emacs
export EDITOR

then instead of firing up vim, you will get emacs. (I had the almost the
opposite problem to you - my system kept firing up the GUI editor "gedit", but I
wanted vi!)

I believe there's a variable you can use that selects the editor for Mercurial
(i.e. hg) only. I'm not sure what it is, but Google would find it. But I just
use "EDITOR" as I use vi for everything anyway.

I must admit though, I'm still puzzled why you are asked to supply a commit
message.

Dave

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] lcalc code quality

Some things to take into account:

Mike is certainly very busy now. (In the last half hour I have been
receiving alternate emails from him, and from sage-devel about
lcalc!). He is (co-)running the current semester at MSRI on
Arithmetic Statistics (other organisers including me, and William).
He has a newborn baby keeping him awake at night. And he is working
hard at getting the large (and well-funded) L-functions database
project ready for release later this year, one of the important
activities currently happening at MSRI.

A lot of work on Sage and attendance at Sage Days has been funded by
Mike's FRG L-functions grant (for which William is a
co-investigator).

Just this week Rishi was demonstrating (at MSRI) his recent work on
improving the Sage interface to both lcalc and Dokchitser's L-function
code. These issues about precision came up then.

I don't think the expression "upstream author" quite captures the
relationship here. And I agree with everything Karl-Dieter said too.

John

On Thu, Mar 31, 2011 at 1:22 PM, Dr. David Kirkby
<david.kirkby@onetel.net> wrote:
> On 03/31/11 05:22 PM, Volker Braun wrote:
>
>> As Dave Kirby remarked,
>> right now it compiles on a couple of gcc releases and essentially no other
>> compiler. And thats hardly a surprise if you look at the code. At the very
>> least the endless compiler warnings need to be looked at / fixed.
>
>
> Micheal did a while back say:
>
> "The antiquated header files and unused variables have been removed in
> L-1.3,
> which has not yet been released to the public. It should be released in the
> next couple of weeks"
>
> http://groups.google.com/group/sage-support/browse_thread/thread/fab46afe7a8ac1c2/a3fe854a9fb88ed6?lnk=gst&q=lcalc+1.3#a3fe854a9fb88ed6
>
> I don't know if he has had time to address that. Are we using an old
> version? Perhaps he has released 1.3. I can't find it I must admit, but
> nearly all lcalc references on Google seem to be related to Sage.
>
> One thing that might help him improve the code is to run it though the Sun
> Studio compiler, which can be downloaded and installed on Linux, either as
> an rpm or a tar file which does not need root access to install.
>
> http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index.html
>
> That is more strict that gcc, and would pick up some of these problems.
> Perhaps he is not aware of that.
>
> Could someone install that on sage.math? If code will compile that Sun
> Studio, and compile with gcc version n, we can be pretty sure it will
> compile with gcc n+1. Clearly we are finding code which is breaking as gcc
> gets stricter, whereas the Sun compiler would never have accepted it in the
> first place.
>
> Singular, PolyBoRi and lcalc are three packages which have become broken
> when updating from gcc 4.5.x to 4.6.0
>
> I recently played with a static analysis tool, cppcheck:
>
> http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page
>
> which is might be of use too, though I was not over-impressed. I tried it on
> some of my own code, but whilst it found some issues, all were non-issues.
> It did not find any problems at all with lcalc. It also generates a seg
> fault after it has finished running
>
> Checking ./Lglobals.cc: USE_MPFR...
> 10/15 files checked 66% done
> Checking ./Lmisc.cc...
> 11/15 files checked 73% done
> Checking ./Lriemannsiegel.cc...
> 12/15 files checked 80% done
> Checking ./Lriemannsiegel_blfi.cc...
> 13/15 files checked 86% done
> Checking ./cmdline.c...
> Checking ./cmdline.c: HAVE_CONFIG_H...
> 14/15 files checked 93% done
> Checking ./example_programs/example.cc...
> 15/15 files checked 100% done
> Segmentation Fault (core dumped)
>
> which is not a good advert for a piece of code designed to check code!!
>
> There are some similar commercial tools.
>
> But really cleaning up the compiler warnings and getting standard C or C++
> would be the first step. Static code analysis tools could come later, when
> the code is cleaner.
>
> --
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing in e-mail?
>
> Dave
>
> --
> To post to this group, send an email to sage-devel@googlegroups.com
> To unsubscribe from this group, send an email to
> sage-devel+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] lcalc code quality

On 03/31/11 05:22 PM, Volker Braun wrote:

>As Dave Kirby remarked,
> right now it compiles on a couple of gcc releases and essentially no other
> compiler. And thats hardly a surprise if you look at the code. At the very
> least the endless compiler warnings need to be looked at / fixed.


Micheal did a while back say:

"The antiquated header files and unused variables have been removed in L-1.3,
which has not yet been released to the public. It should be released in the
next couple of weeks"

http://groups.google.com/group/sage-support/browse_thread/thread/fab46afe7a8ac1c2/a3fe854a9fb88ed6?lnk=gst&q=lcalc+1.3#a3fe854a9fb88ed6

I don't know if he has had time to address that. Are we using an old version?
Perhaps he has released 1.3. I can't find it I must admit, but nearly all lcalc
references on Google seem to be related to Sage.

One thing that might help him improve the code is to run it though the Sun
Studio compiler, which can be downloaded and installed on Linux, either as an
rpm or a tar file which does not need root access to install.

http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index.html

That is more strict that gcc, and would pick up some of these problems. Perhaps
he is not aware of that.

Could someone install that on sage.math? If code will compile that Sun Studio,
and compile with gcc version n, we can be pretty sure it will compile with gcc
n+1. Clearly we are finding code which is breaking as gcc gets stricter, whereas
the Sun compiler would never have accepted it in the first place.

Singular, PolyBoRi and lcalc are three packages which have become broken when
updating from gcc 4.5.x to 4.6.0

I recently played with a static analysis tool, cppcheck:

http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page

which is might be of use too, though I was not over-impressed. I tried it on
some of my own code, but whilst it found some issues, all were non-issues. It
did not find any problems at all with lcalc. It also generates a seg fault after
it has finished running

Checking ./Lglobals.cc: USE_MPFR...
10/15 files checked 66% done
Checking ./Lmisc.cc...
11/15 files checked 73% done
Checking ./Lriemannsiegel.cc...
12/15 files checked 80% done
Checking ./Lriemannsiegel_blfi.cc...
13/15 files checked 86% done
Checking ./cmdline.c...
Checking ./cmdline.c: HAVE_CONFIG_H...
14/15 files checked 93% done
Checking ./example_programs/example.cc...
15/15 files checked 100% done
Segmentation Fault (core dumped)

which is not a good advert for a piece of code designed to check code!!

There are some similar commercial tools.

But really cleaning up the compiler warnings and getting standard C or C++ would
be the first step. Static code analysis tools could come later, when the code is
cleaner.

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

Dave

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: lcalc code quality

On 3/31/11 2:09 PM, kcrisman wrote:
>
>> And I agree that we should communicate with the author politely. I was
>> addressing the Sage developers that use lcalc, and I think that its
>> allowable to use a more colloquial tone in that case.
>
> I would submit that we should be as polite as possible whenever
> discussing component pieces of Sage. We depend on them to make it
> work great. This is especially true when discussing something fairly
> technical to a large proportion of Sage developers, I would guess, and
> certainly to the many users who subscribe or visit this on the web in
> the hopes of learning something. This is a public forum, even if it
> often doesn't seem like it because we get to know one another to some
> extent at Sage Days and on the list.
>
> As a separate issue, I realize that not everyone will agree on what
> acronyms/cuss words are appropriate for this forum, so I won't push
> this too strongly. But my guess is that the public Mma lists, or
> Mapleprimes, wouldn't be too hot on this as a customer relations
> strategy.


+1 to everything you said. Also, I'd like to point out that since many
upstream developers lurk on this and other Sage lists, our "colloquial"
conversations actually are heard by many upstream developers. Even if a
particular upstream developer is not subscribed, many other upstream
developers see how we behave as a group and that will probably influence
their opinion of Sage.

Thanks,

Jason

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: lcalc code quality

> And I agree that we should communicate with the author politely. I was
> addressing the Sage developers that use lcalc, and I think that its
> allowable to use a more colloquial tone in that case.

I would submit that we should be as polite as possible whenever
discussing component pieces of Sage. We depend on them to make it
work great. This is especially true when discussing something fairly
technical to a large proportion of Sage developers, I would guess, and
certainly to the many users who subscribe or visit this on the web in
the hopes of learning something. This is a public forum, even if it
often doesn't seem like it because we get to know one another to some
extent at Sage Days and on the list.

As a separate issue, I realize that not everyone will agree on what
acronyms/cuss words are appropriate for this forum, so I won't push
this too strongly. But my guess is that the public Mma lists, or
Mapleprimes, wouldn't be too hot on this as a customer relations
strategy.

(I also realize that now someone will prove me wrong by finding a much
worse example on one of those sites!)

Colloquially yours,
- kcrisman

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] VMware image -- bug with an easy fix

On Wed, Mar 30, 2011 at 7:52 PM, William Stein <wstein@gmail.com> wrote:
> There is an easy fix though.  The problem was that the default network
> interface got renamed by udev to eth6, but the file
> /etc/network/interfaces only lists eth1-eth4.
> So whoever (?) is maintaining the vmware image should just add a bunch
> more lines to that file, say with all interfaces up to eth10 searched
> for.

Also worth looking at the persistent rules for net devices udev. E.g.
in debian, they are in

/etc/udev/rules.d/70-persistent-net.rules

Cleaning up the rules may help to keep the name of the eth interface
to eth0 or eth1.

I presume vmware is showing a device with a different MAC for each vm,
so each time the image is run in a new vm a new rule is added with a
new interface name.

HTH

Gonzalo

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: sage notebook with many Jmol viewers

Your description sounds like you are doing a hg_sagenb.commit(), not a
hg_sagenb.apply("http:/..../<patchname>.patch"). If you just copy
the link to the listed patches as shown above they should work.
That's what I do.

Jonathan
P.S. Great name!

On Mar 31, 11:32 am, jtyard <jty...@gmail.com> wrote:
> Hi Jonathan,
>
> Thanks for your reply.  I tried last night to figure out how to patch
> my notebook, and I ended up giving up after several hours.  I also
> couldn't find any documentation for hg_sagenb.apply.  After updating
> jmol to 1.1.5, I tried to follow the directions at
>
> http://www.sagemath.org/doc/developer/walk_through.html#reviewing-a-p...
>
> only replacing hg_sage.apply with hg_sagenb.apply, but things seem not
> to be as simple as described on that page.  Running the command on a
> patch drops me into a vim editor that shows the text of the whole
> patch.  Not knowing what to do, I press "q" and I am then asked to
> enter a commit message.  No matter what I seem to do, when I try to
> quit vim it warns me that there was "no write since last change", and
> if I quit with :q! then it seems I am back where I started.  It
> doesn't help that I am next to clueless about vim, having been raised
> on emacs, but I really am beyond confused about why I am being dropped
> into the editor in the first place.
>
> Any pointers you could give me to get the new notebook up and running
> would be much appreciated.  I'll be more than happy to test it.
>
> Thanks,
> Jon
>
> On Mar 31, 7:08 am, Jonathan <gu...@uwosh.edu> wrote:
>
> > Jon,
>
> > We are sorting this out.  Ticket #9238 is the one  you want.
> > The .spkg you used is out-of-date.  All the fixes are not in, but if
> > you follow the patching instructions on #9238 you should get something
> > that will work cleanly on MacOS + Chrome.  FF has been inconsistent,
> > so we are having trouble tracing the error and Safari appears to have
> > a memory leak (the latest patches have a clunky work-around for this).
>
> > If you want to see what is coming down the pike in the next few
> > weeks,  take a look at the published samples on my test server:
> > http:///141.233.197.45:8888.  I could really use some comments on how
> > it works.
>
> > Thanks,
> > Jonathan
>
> > On Mar 30, 12:02 am, jtyard <jty...@gmail.com> wrote:
>
> > > I am having issues with sage notebooks that contain more than five
> > > instances of the Jmol viewer.   In short, if I create a notebook with
> > > more than 5 Jmol viewers, save, then reload it, I get an unresponsive
> > > script error in Firefox, Safari and Chrome.  I've done some peeking
> > > around on the trac server and it seems that this is a well-documented
> > > problem for which a fix may exist, having to do with the tickets #9232
> > > and #9238.  So I apologize if this is not the correct place to ask
> > > about this, but I'm having trouble following what has been done on
> > > these tickets and, more importantly, what I would need to do in order
> > > to incorporate the fix to my sage distribution.  I'm running sage
> > > 4.6.2 on osx 10.6.7, and I upgraded to
> > > Jmol_for_SageNoteBook-1.1.4.spkg so that I could use google Chrome.
>
> > > I'm sure that if I wait long enough this will all be incorporated into
> > > an upcoming release of sage, but I'd be very happy to resolve this
> > > issue asap so that I can use my notebooks without deleting all the 3d
> > > plots. I'm also more than happy to test the changes, but any pointer
> > > to how I can incorporate the new code would be helpful.
>
> > > Thanks,
> > > Jon

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] lcalc code quality

On Thursday, March 31, 2011 1:08:35 PM UTC-4, robertwb wrote:
On Thu, Mar 31, 2011 at 9:22 AM, Volker Braun <vbraun.name@gmail.com> wrote:
> Is anybody working on either removing lcalc or getting its code up to
> reasonable quality?

Is it not giving you the right answers anymore?


In fact, it does not give the right answers any more. Actually, it does not give any results at all since it does not compile with the newest gcc.

If there is any hope of the author addressing any issues we find then I'm sure we can review the lcalc source. In many ways this would be the preferred way of improving the lcalc spkg. But from a cursory glance it seems like it would be a non-trivial task to refactor it into standard-compliant C++. 

And I agree that we should communicate with the author politely. I was addressing the Sage developers that use lcalc, and I think that its allowable to use a more colloquial tone in that case.

Volker

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] lcalc code quality

If it would help at all he (Mike R) is in the office 3 doors down from
me right now at MSRI. But I would not like to forward any emails to
him which were not a lot more polite.

John

On Thu, Mar 31, 2011 at 10:08 AM, Robert Bradshaw
<robertwb@math.washington.edu> wrote:
> On Thu, Mar 31, 2011 at 9:22 AM, Volker Braun <vbraun.name@gmail.com> wrote:
>> Is anybody working on either removing lcalc or getting its code up to
>> reasonable quality?
>
> Is it not giving you the right answers anymore?
>
>> Does anybody know the upstream author?
>
> Yes, several of us.
>
>> The lcalc spkg
>> recently broke on gcc-4.6 essentially due to this:
>> #define double(x) (double)(lcalc_to_double(x))
>>
>> I mean, WTF? Does anybody believe that you can safely include system headers
>> after redefining cast-to-double by a preprocessor macro? The lcalc code must
>> be refactored to not rely on this construction. As Dave Kirby remarked,
>> right now it compiles on a couple of gcc releases and essentially no other
>> compiler. And thats hardly a surprise if you look at the code. At the very
>> least the endless compiler warnings need to be looked at / fixed.
>
> The state of this spkg has been discussed, e.g.:
> http://groups.google.com/group/sage-devel/browse_thread/thread/b674cf0bc8e1eb70/00042695e9daf61a#00042695e9daf61a
> Yes, there's room for improvement, and Mike Rubinstein *has* spent
> time cleaning up his code. Lets fix it rather than hashing over this
> yet again.
>
> - Robert
>
> --
> To post to this group, send an email to sage-devel@googlegroups.com
> To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/sage-devel
> URL: http://www.sagemath.org
>

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] lcalc code quality

On Thu, Mar 31, 2011 at 9:22 AM, Volker Braun <vbraun.name@gmail.com> wrote:
> Is anybody working on either removing lcalc or getting its code up to
> reasonable quality?

Is it not giving you the right answers anymore?

> Does anybody know the upstream author?

Yes, several of us.

> The lcalc spkg
> recently broke on gcc-4.6 essentially due to this:
> #define double(x) (double)(lcalc_to_double(x))
>
> I mean, WTF? Does anybody believe that you can safely include system headers
> after redefining cast-to-double by a preprocessor macro? The lcalc code must
> be refactored to not rely on this construction. As Dave Kirby remarked,
> right now it compiles on a couple of gcc releases and essentially no other
> compiler. And thats hardly a surprise if you look at the code. At the very
> least the endless compiler warnings need to be looked at / fixed.

The state of this spkg has been discussed, e.g.:
http://groups.google.com/group/sage-devel/browse_thread/thread/b674cf0bc8e1eb70/00042695e9daf61a#00042695e9daf61a
Yes, there's room for improvement, and Mike Rubinstein *has* spent
time cleaning up his code. Lets fix it rather than hashing over this
yet again.

- Robert

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: sage notebook with many Jmol viewers

Hi Jonathan,

Thanks for your reply. I tried last night to figure out how to patch
my notebook, and I ended up giving up after several hours. I also
couldn't find any documentation for hg_sagenb.apply. After updating
jmol to 1.1.5, I tried to follow the directions at

http://www.sagemath.org/doc/developer/walk_through.html#reviewing-a-patch

only replacing hg_sage.apply with hg_sagenb.apply, but things seem not
to be as simple as described on that page. Running the command on a
patch drops me into a vim editor that shows the text of the whole
patch. Not knowing what to do, I press "q" and I am then asked to
enter a commit message. No matter what I seem to do, when I try to
quit vim it warns me that there was "no write since last change", and
if I quit with :q! then it seems I am back where I started. It
doesn't help that I am next to clueless about vim, having been raised
on emacs, but I really am beyond confused about why I am being dropped
into the editor in the first place.

Any pointers you could give me to get the new notebook up and running
would be much appreciated. I'll be more than happy to test it.

Thanks,
Jon

On Mar 31, 7:08 am, Jonathan <gu...@uwosh.edu> wrote:
> Jon,
>
> We are sorting this out.  Ticket #9238 is the one  you want.
> The .spkg you used is out-of-date.  All the fixes are not in, but if
> you follow the patching instructions on #9238 you should get something
> that will work cleanly on MacOS + Chrome.  FF has been inconsistent,
> so we are having trouble tracing the error and Safari appears to have
> a memory leak (the latest patches have a clunky work-around for this).
>
> If you want to see what is coming down the pike in the next few
> weeks,  take a look at the published samples on my test server:
> http:///141.233.197.45:8888.  I could really use some comments on how
> it works.
>
> Thanks,
> Jonathan
>
> On Mar 30, 12:02 am, jtyard <jty...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I am having issues with sage notebooks that contain more than five
> > instances of the Jmol viewer.   In short, if I create a notebook with
> > more than 5 Jmol viewers, save, then reload it, I get an unresponsive
> > script error in Firefox, Safari and Chrome.  I've done some peeking
> > around on the trac server and it seems that this is a well-documented
> > problem for which a fix may exist, having to do with the tickets #9232
> > and #9238.  So I apologize if this is not the correct place to ask
> > about this, but I'm having trouble following what has been done on
> > these tickets and, more importantly, what I would need to do in order
> > to incorporate the fix to my sage distribution.  I'm running sage
> > 4.6.2 on osx 10.6.7, and I upgraded to
> > Jmol_for_SageNoteBook-1.1.4.spkg so that I could use google Chrome.
>
> > I'm sure that if I wait long enough this will all be incorporated into
> > an upcoming release of sage, but I'd be very happy to resolve this
> > issue asap so that I can use my notebooks without deleting all the 3d
> > plots. I'm also more than happy to test the changes, but any pointer
> > to how I can incorporate the new code would be helpful.
>
> > Thanks,
> > Jon

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] lcalc code quality

On 2011-03-31 18:22, Volker Braun wrote:
> Is anybody working on either removing lcalc or getting its code up to
> reasonable quality? Does anybody know the upstream author? The lcalc
> spkg recently broke on gcc-4.6 essentially due to this:
>
> #define double(x) (double)(lcalc_to_double(x))
>
> I mean, WTF?

I agree with the WTF...

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] lcalc code quality

Is anybody working on either removing lcalc or getting its code up to reasonable quality? Does anybody know the upstream author? The lcalc spkg recently broke on gcc-4.6 essentially due to this:

#define double(x) (double)(lcalc_to_double(x)) 

I mean, WTF? Does anybody believe that you can safely include system headers after redefining cast-to-double by a preprocessor macro? The lcalc code must be refactored to not rely on this construction. As Dave Kirby remarked, right now it compiles on a couple of gcc releases and essentially no other compiler. And thats hardly a surprise if you look at the code. At the very least the endless compiler warnings need to be looked at / fixed. 

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: sage notebook with many Jmol viewers

Jon,

We are sorting this out. Ticket #9238 is the one you want.
The .spkg you used is out-of-date. All the fixes are not in, but if
you follow the patching instructions on #9238 you should get something
that will work cleanly on MacOS + Chrome. FF has been inconsistent,
so we are having trouble tracing the error and Safari appears to have
a memory leak (the latest patches have a clunky work-around for this).

If you want to see what is coming down the pike in the next few
weeks, take a look at the published samples on my test server:
http:///141.233.197.45:8888. I could really use some comments on how
it works.

Thanks,
Jonathan

On Mar 30, 12:02 am, jtyard <jty...@gmail.com> wrote:
> I am having issues with sage notebooks that contain more than five
> instances of the Jmol viewer.   In short, if I create a notebook with
> more than 5 Jmol viewers, save, then reload it, I get an unresponsive
> script error in Firefox, Safari and Chrome.  I've done some peeking
> around on the trac server and it seems that this is a well-documented
> problem for which a fix may exist, having to do with the tickets #9232
> and #9238.  So I apologize if this is not the correct place to ask
> about this, but I'm having trouble following what has been done on
> these tickets and, more importantly, what I would need to do in order
> to incorporate the fix to my sage distribution.  I'm running sage
> 4.6.2 on osx 10.6.7, and I upgraded to
> Jmol_for_SageNoteBook-1.1.4.spkg so that I could use google Chrome.
>
> I'm sure that if I wait long enough this will all be incorporated into
> an upcoming release of sage, but I'd be very happy to resolve this
> issue asap so that I can use my notebooks without deleting all the 3d
> plots. I'm also more than happy to test the changes, but any pointer
> to how I can incorporate the new code would be helpful.
>
> Thanks,
> Jon

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] Patch submitting procedures

On Mar 28, 2011, at 11:36 AM, Jeroen Demeyer wrote:

> 2) Patches should be made using *hg export tip*, and not hg diff.

Don't forget that you need to use --git if you have touched any binary files. It may be best to add this to your .hgrc (I think this was mentioned in another thread recently).

-Ivan

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: No user input in Sage Notebook?

Thank you. Do you have any idea how a Javascript variable could be
passed to Python? Setting a prompt (using html()) is easy enough, as
well as outputting the result using document.write, but of course for
it to be of any use it has to be interpreted by Python.

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

วันพุธที่ 30 มีนาคม พ.ศ. 2554

[sage-devel] VMware image -- bug with an easy fix

Hi,

I just talked to a student in my Sage course [1] who could not get the
network to work after tons of frustration.

There is an easy fix though. The problem was that the default network
interface got renamed by udev to eth6, but the file
/etc/network/interfaces only lists eth1-eth4.
So whoever (?) is maintaining the vmware image should just add a bunch
more lines to that file, say with all interfaces up to eth10 searched
for.


[1] http://wiki.wstein.org/11/480a

--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] multivariate gcd and giac interface

Hello,
I have done minor updates for the giac interface. (trac 10940)

I got the following bench with it:
On a: model name : Intel(R) Core(TM)2 Duo CPU E4700 @ 2.60GHz
with sage 4.6.2 compiled from sources and the giac spkg:
http://www-fourier.ujf-grenoble.fr/~parisse/giac/giac-0_9_1.spkg
(this spkg was installed without cocoa nor hevea nor extra tex)

I got the following bench for the interface for some multivariate gcd
Is there anotherway to compute gcd in sage?

best
Frederic
---------------------------------------------------------------------

sage: R.<x,y>=QQ[]
sage:
l=[R.random_element(15,30),R.random_element(10,50),R.random_element(30,50),R.random_element(20,50)]
sage: gl=giac(l)
sage:
wt=walltime();t=giac.cputime();gf1=(gl[0]*gl[1]).normal();giac.cputime(t);walltime(wt)
-1.1368683772200001e-13
0.010113000869750977
sage: wt=walltime();t=cputime(); f1=l[0]*l[1] ;
cputime(t);walltime(wt)
0.0
0.0010118484497070312
sage: giac(f1).nops;gf1.nops();
sage:
wt=walltime();t=giac.cputime();gf2=(gl[3]*gl[1]).normal();giac.cputime(t);walltime(wt)
0.0099999999998800007
0.019656896591186523
sage: wt=walltime();t=cputime(); f2=l[3]*l[1] ;
cputime(t);walltime(wt)
0.0040010000002439483
0.0025229454040527344
sage:
sage:
wt=walltime();t=giac.cputime();gf12=gf1.gcd(gf2);giac.cputime(t);walltime(wt)
0.02
0.028865814208984375
sage: gf12.degree()-gl[1].degree()
0
sage: wt=walltime();t=cputime(); f12=gcd(f1,f2) ;
cputime(t);walltime(wt)
1.5840990000001511
1.5869238376617432
sage: (f12/gf12).normal()
1
sage:

###################################
#rapport >700 (3 essais)
sage: R.<x,y,z>=QQ[]
sage:
l=[R.random_element(7,30),R.random_element(10,15),R.random_element(10,30),R.random_element(10,30)]
sage: gl=giac(l)
sage:
wt=walltime();t=giac.cputime();gf1=(gl[0]*gl[1]).normal();giac.cputime(t);walltime(wt)
0.0099999999999899995
0.014853954315185547
sage: wt=walltime();t=cputime(); f1=l[0]*l[1] ;
cputime(t);walltime(wt)
0.0
0.00037312507629394531
sage: giac(f1).nops;gf1.nops();
sage:
wt=walltime();t=giac.cputime();gf2=(gl[3]*gl[1]).normal();giac.cputime(t);walltime(wt)
0.0
0.010710954666137695
sage: wt=walltime();t=cputime(); f2=l[3]*l[1] ;
cputime(t);walltime(wt)
0.0
0.00046610832214355469
sage:
wt=walltime();t=giac.cputime();gf12=gf1.gcd(gf2);giac.cputime(t);walltime(wt)
0.02
0.025274991989135742
sage: wt=walltime();t=cputime(); f12=gcd(f1,f2) ;
cputime(t);walltime(wt)
57.295579999999518
58.063894987106323
sage: (f12/gf12).normal()
-1

####################################
#Un exemple limite pour sage: rapport >40000
sage: A.<x,y,z,t>=QQ[]
sage: R.<x,y,z,t>=ZZ[]
sage:
l=[A(R.random_element(7,10)),A(R.random_element(10,15)),A(R.random_element(10,20))]
sage: gl=giac(l)
sage:
wt=walltime();t=giac.cputime();gf1=(gl[0]*gl[1]).normal();giac.cputime(t);walltime(wt)
0.0
0.0075490474700927734
sage: wt=walltime();t=cputime(); f1=l[0]*l[1] ;
cputime(t);walltime(wt)
0.0
0.00021696090698242188
sage: giac(f1).nops;gf1.nops();
sage:
wt=walltime();t=giac.cputime();gf2=(gl[2]*gl[1]).normal();giac.cputime(t);walltime(wt)
0.0
0.0078761577606201172
sage: wt=walltime();t=cputime(); f2=l[2]*l[1] ;
cputime(t);walltime(wt)
0.0
0.00025606155395507812
sage:
wt=walltime();t=giac.cputime();gf12=gf1.gcd(gf2);giac.cputime(t);walltime(wt)
0.02
0.038819789886474609
sage: wt=walltime();t=cputime(); f12=gcd(f1,f2) ;
cputime(t);walltime(wt)
1635.1781920000003
1637.7164239883423
sage: (f12/gf12).normal()
-1


----------------------------------------------------------------------
| Sage Version 4.6.2, Release Date: 2011-02-25 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: x,y,z=tuple(giac('x,y,z'))
sage: f=(x+y+z+1)^33+1
sage: time p=(f*(f+1)).normal()
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.52 s
sage: p.nops()
52394
sage: time p.factor().nops()
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 7.85 s
5

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] Re: Valgrind package very old

>>> I also noticed that the valgrind package is old; In particular it doesn't
>>> even compile on Fedora 14. But then its such a commonly-used tool that its
>>> already on every machine that is used for software development. The fact
>>> that nobody every complained about the outdated valgrind spkg should
>>> probably be taken as a sign that nobody needs it.
>>>
>> In that case is there an argument for not having the package at all - i.e.
>> simply remove it as an optional package?
>
> I use that Valgrind package all the time. It works for me, so I don't
> complain. You're saying that's a good reason to make it unavailable
> for me to use???
>
> By the way, I've seen Ivan's work on #7766 and I'm going to review
> that ticket soon if someone doesn't beat me to it. It looks very
> good-- e.g., it includes better suppression files specific to Sage.

Excellent. There are still many suppressions that could be created, and some of those that I created are probably masking real bugs, but I figure it's a start at least.

-Ivan

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] Re: How to cope with a long method resolution order?

Hi there,

> I think, the question is (at least on the short run), how one can work
> around.
>
> Taking your example:
> class End(SageObject):
> def toto(self):
> return 1
> sage: c_long = long_mro(500)
> sage: obj_long = c_long()
> sage: obj_end = End()
> sage: timeit("obj_end.toto()")
> 625 loops, best of 3: 963 ns per loop
> sage: timeit("obj_long.toto()")
> 625 loops, best of 3: 22.8 盜 per loop
>
> So, as you confirmed, a long mro matters, at least if Cython is
> involved.

I don't have to investigate further but, according to Stefan Behnel on
cython-users it seems to be solved in cython 0.14 !

Cheers,

Florent

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Short summary post on Sage Days visit

Hi folks,

a quick summary of last week's Sage Days work from my perspective:

http://blog.fperez.org/2011/03/ipython-and-scientific-python-go-to.html

Thanks again to William for the workshop!

Cheers,

f

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: How to cope with a long method resolution order?

Hi Nicolas,

On 30 Mrz., 09:44, Simon King <simon.k...@uni-jena.de> wrote:
> When is that called? I provided a __init_extra__ for
> Rings.ParentMethods, but it is not called when I create R.<x,y> =
> QQ['t'][], even though (with the patches from #9944 and #9138 at
> least) it belongs to a subcategory of the category of rings, and
> R._is_category_initialized() yields True.

It turns out that one needs to change Parent._init_category_: The idea
is to consider all super-categories. If the ParentMethods of a super-
category provide a __init_extra__, then it shall be called.

I provided a short path for several methods of rings that are
frequently used in arithmetic (base, base_ring, has_coerce_map_from
and coerce_map_from).
I obtain:

sage: R.<x,y> = QQ['t'][]
sage: timeit('(2*x-1)^2+5')
625 loops, best of 3: 152 µs per loop

That is a lot (157%) faster than in an unpatched Sage!

So, I guess I will submit it on a new ticket, and make #9944 depend on
it (because, as it is, #9944 slows arithmetic down). If everything
works, then the new patch + #9944 + #9138 will yield a considerable
speedup.

Cheers
Simon

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: How to cope with a long method resolution order?

Hi Nicolas,

On 30 Mrz., 08:32, "Nicolas M. Thiery" <Nicolas.Thi...@u-psud.fr>
wrote:
> Another trick to try would be add in Modules.ParentMethods:
>
>         def __init_extra__(self):
>             self.basis_ring = self.base_ring
>

When is that called? I provided a __init_extra__ for
Rings.ParentMethods, but it is not called when I create R.<x,y> =
QQ['t'][], even though (with the patches from #9944 and #9138 at
least) it belongs to a subcategory of the category of rings, and
R._is_category_initialized() yields True.

Best regards,
Simon

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: How to cope with a long method resolution order?

Hi,

On 30 Mrz., 09:04, Simon King <simon.k...@uni-jena.de> wrote:
> So, apparently it *was* thought of making these things cpdef!!
>
> Was there a reason to not make base and base_ring cpdef?

I tested, and found that cpdef'ing does not help (much):

With def:
sage: R.<x,y> = QQ['t'][]
sage: timeit('R.base_ring')
625 loops, best of 3: 967 ns per loop

With cpdef:
sage: R.<x,y> = QQ['t'][]
sage: timeit('R.base_ring')
625 loops, best of 3: 958 ns per loop

Manually defining R.base_ring = R.base_ring:
sage: timeit('R.base_ring')
625 loops, best of 3: 896 ns per loop

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: How to cope with a long method resolution order?

On 30 Mrz., 09:06, Simon King <simon.k...@uni-jena.de> wrote:
> Would that work for objects that don't allow attribute assignment?

Well, there's always try-except, I suppose...

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: How to cope with a long method resolution order?

On 30 Mrz., 08:32, "Nicolas M. Thiery" <Nicolas.Thi...@u-psud.fr>
wrote:
> Another trick to try would be add in Modules.ParentMethods:
>
>         def __init_extra__(self):
>             self.basis_ring = self.base_ring

Would that work for objects that don't allow attribute assignment?

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: How to cope with a long method resolution order?

Hi Nicolas,

On 30 Mrz., 08:32, "Nicolas M. Thiery" <Nicolas.Thi...@u-psud.fr>
wrote:
> On Wed, Mar 30, 2011 at 02:00:22AM -0400, David Roe wrote:
> >    I think that base_ring and parent are cpdef'd methods (I don't want to
> >    look it up at the moment).
>
> Not at this point apparently: category_object.pyx, line 479:
>
>     def base_ring(self): # This should be in a category or elsewhere, but not here
>         return self._base
>
>     def base(self):
>         return self._base
>
> Maybe making them such would solve Simon's problem? And actually
> accelerate things, since Cython could optimize (inline?) their call in
> the coercion/arithmetic code.

I was just starting to try that, and found in category_object.pxd:
cdef class CategoryObject(sage_object.SageObject):

cdef _generators
cdef _category
cdef public _base
cdef public _cdata
cdef public _names # will be _printer
cdef public _factory_data
cdef object __weakref__

# cpdef Generators gens(self, category = *)
# cpdef gen(self, index = *, category = *)
# cpdef ngens(self, category = *)
# cpdef base(self, category = *)
# cpdef base_extend(self, other, category = *)

So, apparently it *was* thought of making these things cpdef!!

Was there a reasong to not make base and base_ring cpdef?

> Another trick to try would be add in Modules.ParentMethods:
>
>         def __init_extra__(self):
>             self.basis_ring = self.base_ring
>
> therefore adding a short path for base_ring in all parents in Modules.
> This should be rather safe (I don't expect the base_ring method to
> change over time).

You mean, the category framework would be used to speed things up?
That would be nice!

Cheers,
Simon

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

[sage-devel] Re: Teaching Sage at AIMS

Based on my experience last October, teaching Sage at AIMS is highly
recommended. Feel free to email me off-list if you have questions.

Rob

On Mar 29, 11:55 am, Jan Groenewald <j...@aims.ac.za> wrote:
> Hi
>
> The deadline has been extended. The website will be updated shortly.
> We are still looking for a SAGE (problem solving type course, experimental
> mathematics using SAGE) course around September/October 2011.
>
> Feel free to mail me off list for queries.
>
> Regards,
> Jan
>
>
>
> On Thu, Jan 20, 2011 at 02:14:10PM +0200, jan.groenew...@gmail.com wrote:
> > Hi
>
> > Forwarded mail from AIMS-announce:
>
> >    CALL FOR AIMS POSTGRADUATE DIPLOMA PROGRAMME COURSE PROPOSALS
> >    AIMS is now accepting proposals for courses which form part of
> >    he AIMS Postgraduate Diploma Programme commencing September 2011.
> >    For more information and to apply please visit
> >    http://www.aims.ac.za/en/apply/diploma-course-proposals
> >    _______________________________________________
> >    AIMS-announce mailing list
> >    AIMS-annou...@aims.ac.za
> >    http://mailman.aims.ac.za/cgi-bin/mailman/listinfo/aims-announce
>
> > One thing we will need is a course on SAGE such as Rob Beezer presented
> > this year, seehttp://users.aims.ac.za/~beezer, for general exploration
> > of mathematical problems using SAGE. Rob focussed on Linear Algebra
> > but this is a bit flexible.
>
> > This course will be preferred in the slot 19 September - 7 October 2011
> > but at a stretch is possible in the slot before, or even the one after.
>
> > Regards,
> > Jan
> > AIMS IT Manager
>
> > --
> >    .~.
> >    /V\     Jan Groenewald
> >   /( )\    www.aims.ac.za
> >   ^^-^^
>
> --
>    .~.
>    /V\     Jan Groenewald
>   /( )\    www.aims.ac.za
>   ^^-^^

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

วันอังคารที่ 29 มีนาคม พ.ศ. 2554

[sage-devel] 4.6.2 build on Ubuntu 11.04 alpha 3 fails on crypt.so

Hi

Ubuntu 11.04 is still alpha 3, but in the meantime I've had to install
it for graphics/wireless/sound driver reasons.

jan@mamadou-laptop:/usr/local/src/sage-4.6.2$ lsb_release -d
Description: Ubuntu Natty (development branch)
jan@mamadou-laptop:/usr/local/src/sage-4.6.2$ uname -a
Linux mamadou-laptop 2.6.38-5-generic #32-Ubuntu SMP Tue Feb 22 16:10:15 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
jan@mamadou-laptop:/usr/local/src/sage-4.6.2$ python --version
Python 2.7.1+
jan@mamadou-laptop:/usr/local/src/sage-4.6.2$ gcc --version
gcc (Ubuntu/Linaro 4.5.2-7ubuntu1) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
jan@mamadou-laptop:/usr/local/src/sage-4.6.2$

Sage mostly builds, but

jan@mamadou-laptop:/usr/local/src/sage-4.6.2$ grep enaming install.log
*** WARNING: renaming "crypt" since importing it failed: build/lib.linux-x86_64-2.6/crypt.so: undefined symbol: crypt
*** WARNING: renaming "nis" since importing it failed: build/lib.linux-x86_64-2.6/nis.so: undefined symbol: yp_get_default_domain
*** WARNING: renaming "crypt" since importing it failed: build/lib.linux-x86_64-2.6/crypt.so: undefined symbol: crypt
*** WARNING: renaming "nis" since importing it failed: build/lib.linux-x86_64-2.6/nis.so: undefined symbol: yp_get_default_domain
*** WARNING: renaming "crypt" since importing it failed: build/lib.linux-x86_64-2.6/crypt.so: undefined symbol: crypt
*** WARNING: renaming "nis" since importing it failed: build/lib.linux-x86_64-2.6/nis.so: undefined symbol: yp_get_default_domain
jan@mamadou-laptop:/usr/local/src/sage-4.6.2$ ldd /usr/local/src/sage-4.6.2/local/lib/python2.6/lib-dynload/crypt_failed.so
linux-vdso.so.1 => (0x00007fffb07e9000)
libpython2.6.so.1.0 => not found
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f909e29a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f909def4000)
/lib64/ld-linux-x86-64.so.2 (0x00007f909e6d4000)
jan@mamadou-laptop:/usr/local/src/sage-4.6.2$ sage
----------------------------------------------------------------------
| Sage Version 4.6.2, Release Date: 2011-02-25 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)

/usr/local/src/sage-4.6.2/local/lib/python2.6/site-packages/IPython/ipmaker.pyc in force_import(modname)
64 reload(sys.modules[modname])
65 else:
---> 66 __import__(modname)
67
68

/usr/local/src/sage-4.6.2/local/bin/ipy_profile_sage.py in <module>()
5 preparser(True)
6
----> 7 import sage.all_cmdline
8 sage.all_cmdline._init_cmdline(globals())
9

/usr/local/src/sage-4.6.2/local/lib/python2.6/site-packages/sage/all_cmdline.py in <module>()
12 try:
13
---> 14 from sage.all import *
15 from sage.calculus.predefined import x
16 preparser(on=True)

/usr/local/src/sage-4.6.2/local/lib/python2.6/site-packages/sage/all.py in <module>()
97 from sage.calculus.all import *
98
---> 99 from sage.server.all import *
100 import sage.tests.all as tests
101

/usr/local/src/sage-4.6.2/local/lib/python2.6/site-packages/sage/server/all.py in <module>()
1
----> 2 #from server1.all import *

3 from notebook.all import *
4 from wiki.all import *
5 from trac.all import *
6

/usr/local/src/sage-4.6.2/local/lib/python2.6/site-packages/sage/server/notebook/all.py in <module>()
20
21 # Import the new separated Sage notebook.

---> 22 from sagenb.notebook.all import *
23
24

/usr/local/src/sage-4.6.2/devel/sagenb/sagenb/notebook/all.py in <module>()
14 from sage_email import email
15
---> 16 from notebook_object import notebook, inotebook
17
18 from interact import interact, input_box, slider, range_slider, selector, checkbox, input_grid, text_control, color_selector

/usr/local/src/sage-4.6.2/devel/sagenb/sagenb/notebook/notebook_object.py in <module>()
15 import time, os, shutil, signal, tempfile
16
---> 17 import notebook as _notebook
18
19 import run_notebook

/usr/local/src/sage-4.6.2/devel/sagenb/sagenb/notebook/notebook.pyc in <module>()
44 import server_conf # server configuration
45 import user_conf # user configuration
---> 46 import user # users
47 from template import template, prettify_time_ago
48

/usr/local/src/sage-4.6.2/devel/sagenb/sagenb/notebook/user.py in <module>()
1 # -*- coding: utf-8 -*

2 import copy
----> 3 import crypt
4 import cPickle
5 import os

ImportError: No module named crypt
Error importing ipy_profile_sage - perhaps you should run %upgrade?
WARNING: Loading of ipy_profile_sage failed.

sage:

The install.log is here:
http://users.aims.ac.za/~jan/sage/install.log.bz2

I will update in a few days when Ubuntu 11.04 beta 1 is out.

Regards,
Jan
--
.~.
/V\ Jan Groenewald
/( )\ www.aims.ac.za
^^-^^

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] Re: How to cope with a long method resolution order?

On Wed, Mar 30, 2011 at 02:00:22AM -0400, David Roe wrote:
> I think that base_ring and parent are cpdef'd methods (I don't want to
> look it up at the moment).

Not at this point apparently: category_object.pyx, line 479:

def base_ring(self): # This should be in a category or elsewhere, but not here
return self._base

def base(self):
return self._base

Maybe making them such would solve Simon's problem? And actually
accelerate things, since Cython could optimize (inline?) their call in
the coercion/arithmetic code.

> You want to be a little careful overriding such methods with
> Python functions living in the dictionary, because then the
> functions called by Cython code that knows the type of your
> object, and the code called by Python code will be different.

Another trick to try would be add in Modules.ParentMethods:

def __init_extra__(self):
self.basis_ring = self.base_ring

therefore adding a short path for base_ring in all parents in Modules.
This should be rather safe (I don't expect the base_ring method to
change over time).

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" <nthiery@users.sf.net>
http://Nicolas.Thiery.name/

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Re: [sage-devel] How to cope with a long method resolution order?

On Tue, Mar 29, 2011 at 12:07:15PM -0700, Simon King wrote:
> Tickets #9944 and #9138 provide some nice features, but slow things
> down. It seems to me that the reason of the performance loss is that
> the patches from these tickets make the method resolution order of
> polynomial rings much longer - in some cases the length doubles (15
> versus 39 steps until <type 'object'> is reached).
>
> As much as I understand: If the mro is longer than Python needs more
> time to look up a method that is defined for a very basic class (such
> as sage.structure.category_object.CategoryObject or
> sage.structure.parent.Parent).

Note: for good or bad, the Cython classes come before categories in
the mro:

sage: sage: C = CombinatorialFreeModule(ZZ, ZZ)
sage: C.__class__.mro()
[<class 'sage.combinat.free_module.CombinatorialFreeModule_with_category'>,
<class 'sage.combinat.free_module.CombinatorialFreeModule'>,
<class 'sage.structure.unique_representation.UniqueRepresentation'>,
<type 'sage.modules.module.Module'>,
<type 'sage.structure.parent.Parent'>,
<type 'sage.structure.category_object.CategoryObject'>,
<type 'sage.structure.sage_object.SageObject'>,
<class 'sage.categories.modules_with_basis.ModulesWithBasis.parent_class'>, ... <type 'object'>]

So the number of classes to walk through to find base_ring only
increases by 1 (due to the _with_category).

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" <nthiery@users.sf.net>
http://Nicolas.Thiery.name/

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org