[sage-devel] building NTL

2007-01-08 Thread Martin Albrecht


Hi there,

as you might know the current NTL spkg doesn't use two possible speed 
improvements NTL provides:


* "make setup4" is not called. William probably disabled this, because it 
   takes some time during compilation. setup4 runs a couple of tests to 
   choose the correct implementation for a couple of low level stuff to make 
   NTL faster.


* "-O2" (the recommended optimization level for NTL) is not enforced in the 
   spkg. This might be a good idea, as the user may do it himself by setting 
   CFLAGS/CXXFLAGS. However, several spkgs do enforce O3 (e.g. Givaro)


I would like to have them both enabled. But there are problems:

 * "make setup4" makes the SAGE compilation time longer, but I think the 
juice is worth the squeeze.


 * on my P4 Debian Etch system NTL's "make check" doesn't terminate (it's the 
LLL code). I don't know if it is related to some funny misconfiguration   
on this system (my other systems run fine) or a P4/Linux issue.


Thus, I wondered if anybody would like to try these two options and report 
back if "make check" terminates. To do so:


1) wget http://sage.math.washington.edu/home/malb/pkgs/ntl-5.4.1.spkg
2) tar xvfj ntl-5.4.1.spkg
3) export SAGE_ROOT=
4) source $SAGE_ROOT/local/bin/sage-env
5) cd ntl-5.4.1
6) export CFLAGS="-O2"; export CXXFLAGS="-O2"; 
6) ./spkg-install

7) Have a cup of coffee
8) cd src
9) make check

If it passes for you, you may leave this version of NTL installed as it is 
likely faster than the version as shipped with SAGE. If it doesn't pass, you 
may want to reinstall the original version


 1) rm $SAGE_ROOT/spkg/installed/ntl-5.4.1
 2) cd $SAGE_ROOT
 3) make

should do it.

Thoughts?
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Re: Your graph database

2007-01-08 Thread William Stein


On Mon, 08 Jan 2007 12:01:20 -0800, Jason Grout <[EMAIL PROTECTED]> wrote:

I have been spending the last few months updating the database to
include 9 vertex graphs and a better organization.  I've also been
developing a Python-QT application to access the database on computers
without internet access (I see that that might mesh nicely with the
Python used in the SAGE project).  I'm reorganizing the database and
converting to SQLite and/or PostgreSQL instead of MySQL.  I'm not quite
finished yet, but I should be soon (maybe a month or so).  I'd love any
input on the project, an interface, or anything else.


SAGE doesn't currently include any relational databases, but I could include
SQLite.  Your graph database very likely does make good use of relation
databases.


How do you propose that we incorporate the database into SAGE?  As a
SQLite file with the two query pages that I've written (they are in
PHP)?  Or maybe a custom interface to NetworkX?


As a SQLite file with Python commands to query the database, which will
return a list of SAGE graphs with given properties.  The SAGE graph
class is just a wrapper around networkx's graph class.  Users can then
easily plot the graphs in the SAGE notebook, and do other operations
with them.


What is the best way to
interact with the other programs?  It'd be nice to be able to query for
all graphs having a specific property and then import them into GAP or
NetworkX or Magma or something automatically.


SAGE graphs will have the ability to be transformed into GAP or Magma graphs
(I think this is implemented yet, but will be).  The actual interaction
works pretty simply from within SAGE.  E.g., in the future to get a GAP
graph from a SAGE graph G, just to gap(G).

William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] good new (graph database)

2007-01-08 Thread William Stein




--- Forwarded message ---
From: "Jason Grout" <[EMAIL PROTECTED]>
To: "William Stein" <[EMAIL PROTECTED]>
Cc:
Subject: Re: Your graph database
Date: Mon, 08 Jan 2007 12:01:20 -0800

William Stein wrote:

Dear Jason,

I am the director of the SAGE project:

http://sage.math.washington.edu/sage

SAGE is freely available software that helps with teaching and research in 
mathematics.
It incorporates NetworkX (a Python graph theory library), with a graphical user 
interface,
and has code for a wide variety of functionality beyond graph theory.

Several of the SAGE developers have surveyed a wide variety of graph database.
Yours is by far the best for our purposes, so they are curious whether you would
be interested in them including your graph database in SAGE?

By the way, how did your talk in New Orleans go today?   Unfortunately, I wasn't
able to go to the meeting.

Best regards,
   William Stein
   Associate Professor of Mathematics
   University of Washington


I've tried the SAGE software and I have been extremely impressed with
it.  I've looked forward to using it more and more.  Thank also for the
consideration with the graph database.  I'd be pleased to contribute the
database.  I too surveyed many databases and couldn't find anything that
fit my needs, which is why I developed the database in the first place.

I'm actually giving the talk in New Orleans on the graph database at 4pm
this afternoon.  I'm on the job market (graduating with a PhD in August
2007) and am giving the talk about how to use the database to teach
graph theory in a much more engaging and exploratory way.  I understand
that you aren't here in New Orleans, but if you have colleagues here,
they might find it interesting to come (the talk is in about two hours).
 Do you mind if I mention SAGE in my talk?

I have been spending the last few months updating the database to
include 9 vertex graphs and a better organization.  I've also been
developing a Python-QT application to access the database on computers
without internet access (I see that that might mesh nicely with the
Python used in the SAGE project).  I'm reorganizing the database and
converting to SQLite and/or PostgreSQL instead of MySQL.  I'm not quite
finished yet, but I should be soon (maybe a month or so).  I'd love any
input on the project, an interface, or anything else.

How do you propose that we incorporate the database into SAGE?  As a
SQLite file with the two query pages that I've written (they are in
PHP)?  Or maybe a custom interface to NetworkX?  What is the best way to
interact with the other programs?  It'd be nice to be able to query for
all graphs having a specific property and then import them into GAP or
NetworkX or Magma or something automatically.

Thanks for your interest,

Jason

--
Jason Grout
[EMAIL PROTECTED]



--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Re: Any other "junior dev" want to share a room at SD3?

2007-01-08 Thread Nick Alexander



Martin Albrecht wrote:

On Monday 08 January 2007 19:29, William Stein wrote:
> On Mon, 08 Jan 2007 09:39:01 -0800, Nick Alexander <[EMAIL PROTECTED]>
wrote:
> > ery good!  I'll look into getting us a room and get back to you off
> > list.  IPAM funding is all based on reimbursement, and if I read the
> > funding guidelines correctly you "apply" while you are there.  But if
> > you're flying from .de, you might want to give them a call.

Just to make sure there is no confusion (I answered Nick off-list already): I
am not flying from .de this time as I am already in Seattle during February,
yay!


Huzzah!  I'll call the hotel and get stuff settled.

Nick


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Your graph database

2007-01-08 Thread William Stein


Dear Jason,

I am the director of the SAGE project:

   http://sage.math.washington.edu/sage

SAGE is freely available software that helps with teaching and research in 
mathematics.
It incorporates NetworkX (a Python graph theory library), with a graphical user 
interface,
and has code for a wide variety of functionality beyond graph theory.

Several of the SAGE developers have surveyed a wide variety of graph database.
Yours is by far the best for our purposes, so they are curious whether you would
be interested in them including your graph database in SAGE?

By the way, how did your talk in New Orleans go today?   Unfortunately, I wasn't
able to go to the meeting.

Best regards,
  William Stein
  Associate Professor of Mathematics
  University of Washington

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Re: Any other "junior dev" want to share a room at SD3?

2007-01-08 Thread Martin Albrecht


On Monday 08 January 2007 19:29, William Stein wrote:
On Mon, 08 Jan 2007 09:39:01 -0800, Nick Alexander <[EMAIL PROTECTED]> 

wrote:

> ery good!  I'll look into getting us a room and get back to you off
> list.  IPAM funding is all based on reimbursement, and if I read the
> funding guidelines correctly you "apply" while you are there.  But if
> you're flying from .de, you might want to give them a call.


Just to make sure there is no confusion (I answered Nick off-list already): I 
am not flying from .de this time as I am already in Seattle during February, 
yay!


Martin
--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Re: Any other "junior dev" want to share a room at SD3?

2007-01-08 Thread William Stein


On Mon, 08 Jan 2007 09:39:01 -0800, Nick Alexander <[EMAIL PROTECTED]> wrote:


ery good!  I'll look into getting us a room and get back to you off
list.  IPAM funding is all based on reimbursement, and if I read the
funding guidelines correctly you "apply" while you are there.  But if
you're flying from .de, you might want to give them a call.


Also, I will be able to provide some limited additional funding from
my personal NSF grant, if the IPAM funding falls short.

William



--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Re: Sloane's tables functions

2007-01-08 Thread Jaap Spies


William Stein wrote:

Hello,

I've implemented the infrastructure for adding tons of functions to SAGE for 
computing
the sequences in Sloane's tables.   Here's an example of how it works:


 sage: d = sloane.A05; d
 The integer sequence tau(n), which is the number of divisors of n.
 sage: d(1)
 1
 sage: d(6)
 4
 sage: d(51)
 4
 sage: d(100)
 9
 sage: d(0)
 Traceback (most recent call last):
 ...
 ValueError: input n (=0) must be a positive integer
 sage: d.list(10)
 [1, 2, 2, 3, 2, 4, 2, 4, 3, 4]

The actual code is in

SAGE_ROOT/devel/sage/sage/databases/sloane_functions.py

which is in the latest version of SAGE (which you get by typing hg_sage.pull()).
There are also extensive instructions about how to add new sequences in the
comments for that file.

  -- William




I will look into it. Thanks.

Jaap



--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Sloane's tables functions

2007-01-08 Thread William Stein


Hello,

I've implemented the infrastructure for adding tons of functions to SAGE for 
computing
the sequences in Sloane's tables.   Here's an example of how it works:


sage: d = sloane.A05; d
The integer sequence tau(n), which is the number of divisors of n.
sage: d(1)
1
sage: d(6)
4
sage: d(51)
4
sage: d(100)
9
sage: d(0)
Traceback (most recent call last):
...
ValueError: input n (=0) must be a positive integer
sage: d.list(10)
[1, 2, 2, 3, 2, 4, 2, 4, 3, 4]

The actual code is in

   SAGE_ROOT/devel/sage/sage/databases/sloane_functions.py

which is in the latest version of SAGE (which you get by typing hg_sage.pull()).
There are also extensive instructions about how to add new sequences in the
comments for that file.

 -- William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Re: Any other "junior dev" want to share a room at SD3?

2007-01-08 Thread Nick Alexander


Very good!  I'll look into getting us a room and get back to you off
list.  IPAM funding is all based on reimbursement, and if I read the
funding guidelines correctly you "apply" while you are there.  But if
you're flying from .de, you might want to give them a call :)

Nick

Martin Albrecht wrote:

On Sunday 07 January 2007 09:02, Nick Alexander wrote:
> Hi all,
>
> I'm aware this is rather late and probably in the wrong place, but I
> couldn't find a better place :)  Having read the IPAM funding rules for
> SD3, I think I need to split a room in LA.  So does anyone need a
> roommate?

Sure. Though, I don't know if I qualify for funding (do I need to apply
somewhere?), but it is cheaper anyway.

Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]



--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Re: complex number pyrexification

2007-01-08 Thread William Stein


On Mon, 08 Jan 2007 07:09:17 -0800, David Harvey <[EMAIL PROTECTED]> wrote:




On Jan 8, 2007, at 10:04 AM, William Stein wrote:


It would be easy to change the current complex_number.pyx to use


(a+bi)(c+di) = (a+b)(c+d)i - (ac+bd)i + (ac-bd)


especially if the precision issue isn't an issue if the real
and imaginary parts have the same precision (??).


I think the issue is more with the magnitude than the precision. When
you say "in SAGE both real and imaginary have the same precision", do
you mean they are both represented to the same number of "decimal
places" or "significant figures"? I assume you probably mean the
latter, in which case the numerical issues are still a problem.


I mean significant figures, so it's still a problem.   We'll probaly
have to use MPC to use the above trick then.

Unfortunately, as you might guess, the actual arithmetic with the
complex numbers doesn't dominate right now unless the precision
is high at present.  This is, of course, only the case for specific
arithmetic with the ComplexNumber class -- as soon as one starts
coding vector operations (matrix vector multiplies, etc.), then
the arithmetic dominates, so it will be better to have mpc working
under the hood.

William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Re: complex number pyrexification

2007-01-08 Thread David Harvey



On Jan 8, 2007, at 10:04 AM, William Stein wrote:


It would be easy to change the current complex_number.pyx to use


(a+bi)(c+di) = (a+b)(c+d)i - (ac+bd)i + (ac-bd)


especially if the precision issue isn't an issue if the real
and imaginary parts have the same precision (??).


I think the issue is more with the magnitude than the precision. When 
you say "in SAGE both real and imaginary have the same precision", do 
you mean they are both represented to the same number of "decimal 
places" or "significant figures"? I assume you probably mean the 
latter, in which case the numerical issues are still a problem.


David


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Re: complex number pyrexification

2007-01-08 Thread William Stein


On Mon, 08 Jan 2007 05:43:27 -0800, David Harvey <[EMAIL PROTECTED]> wrote:



On Jan 8, 2007, at 6:13 AM, Joel B. Mohler wrote:


I didn't get around to looking at Williams re-coding of my
pyrexification, but
I think this is probably what he wrote.   I just had 2 cdef'ed real
number
objects.  I guess the python overhead was significant.  It makes
sense and
just now that I'm doing some more timings on my code, I realize
that it
really was pretty bad.  I'm not sure what I was thinking ... I
guess I was
far more in a hurry that I realized.


I should have added that I think Joel did the right thing for the first
step of Pyrexing complex numbers:

  1. Write in Python and write doctests
  2. Change the Python to Pyrex
  3. Make the Pyrex fast

Joel did 2 very well, which made it fairly easy for me to do 3 (it only
took me 2 hours total).


Actually that wasn't what I was focused on.

For arbitrary precision complex number multiplication, there *is* a
"magical way to multiply complex numbers faster than real numbers".

Well sort of. It's kind of like karatsuba multiplication of polynomials:

(a+bi)(c+di) = (a+b)(c+d)i - (ac+bd)i + (ac-bd)

You only need three multiplications instead of four.

In arbitrary-precision arithmetic, multiplication is way more
expensive than addition/subtraction, so this would save you 25% of
the actual arithmetic time.

The only sticky issue is numerical stability, in the case that the
real and imaginary parts of the input have wildly different
magnitudes/precisions. Like I'm not sure what happens with inputs
like 2.5 + 0.0346i. But I wouldn't expect this to happen
all that often.


For SAGE complex numbers, the real and imaginary parts always have
exactly the same precision, so that's not an issue.


I just had a quick peek at the MPC source code. They indeed use this
trick. And they totally deal with the numerical stability issue. The
code for multiplication alone is 400 lines. I don't suppose anyone
has considered wrapping MPC directly, as they have already done this
kind of hard work already?


I wrapped MPC once before long ago; this was disappointing > 1 year ago,
since mpc had very little functionality when it was version 0.2; probably the
current 0.4.5 is better.
There is a file mpc.pyx which is in SAGE, which is only half done
(and probably doesn't build).

It would be easy to change the current complex_number.pyx to use


(a+bi)(c+di) = (a+b)(c+d)i - (ac+bd)i + (ac-bd)


especially if the precision issue isn't an issue if the real
and imaginary parts have the same precision (??).

William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Re: Permutation groups

2007-01-08 Thread David Kohel


Hi William,

Oops, I forgot to post my reply to my own message.  This is the
solution I found,
using the same GAP manual entry for PermList.

def gap_format_cycles(x):
   """
   Put a permutation in Gap format, as a string.
   """
   x = str(x).replace(' ','')
   return x.replace('),(',')(').replace('[','').replace(']','')

def gap_format_images(x):
   """
   Put a permutation in Gap format, as a string.
   """
   return "PermList(" + str(x) + ")"

I hadn't yet sorted out how to preserve the "correct" cycle printing,
as the __gap is used
also for printing.

This will be useful for creating transposition ciphers.

--David


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---



[sage-devel] Re: Any other "junior dev" want to share a room at SD3?

2007-01-08 Thread Martin Albrecht


On Sunday 07 January 2007 09:02, Nick Alexander wrote:

Hi all,

I'm aware this is rather late and probably in the wrong place, but I
couldn't find a better place :)  Having read the IPAM funding rules for
SD3, I think I need to split a room in LA.  So does anyone need a
roommate?


Sure. Though, I don't know if I qualify for funding (do I need to apply 
somewhere?), but it is cheaper anyway.


Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~--~~~~--~~--~--~---