Re: [sage-devel] drop python2 compatibility in 9.1 ?

2020-01-05 Thread TAU
On Sun, 5 Jan 2020, Frédéric Chapoton wrote:

> Do you agree that sage release 9.1 (and most of the 9.1.betas) will not be
> kept compatible with Python 2 ?

I agree.

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/alpine.DEB.2.21..2001060825510.81373%40shell.sis.uta.fi.


Re: [sage-devel] Re: SageNB broken because of stmp???

2019-11-23 Thread TAU
On Sat, 23 Nov 2019, Frédéric Chapoton wrote:

> The current stumbling point is that sagenb uses twisted and twisted is not
> py3 compatible, despite pretending to be so.

OK. I opened #28792 for better error message. Also I suppose we must 
change documentation.

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/alpine.DEB.2.21..1911231939530.105900%40shell.sis.uta.fi.


[sage-devel] SageNB broken because of stmp???

2019-11-23 Thread TAU
I did a fresh install, i.e. start from git clone 
git://github.com/sagemath/sage.git and so on. Sage starts and I can start 
jupyter also. However ./sage --notebook=sagenb says

DeprecationWarning: the imp module is deprecated in favour of importlib; 
see the module's documentation for alternative uses
   import imp
Traceback (most recent call last):
  . . .
 from twisted.mail import smtp, relaymanager  # problematic with python 3
ImportError: cannot import name 'smtp' from 'twisted.mail' (unknown 
location)

So have we broken sagenb totally when moving to Python 3?

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/alpine.DEB.2.21..1911231609500.101837%40shell.sis.uta.fi.


[sage-devel] Sphinx and links

2019-10-07 Thread TAU
I opened https://trac.sagemath.org/ticket/28569 thinking it is something 
easy. Is not for me. Someone understanding Sphinx should take a look.

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/alpine.DEB.2.21..1910080818230.75723%40shell.sis.uta.fi.


[sage-devel] refering, recommented, registred and other typos

2019-08-08 Thread TAU
Might be of interest to someone painting a bikeshed. I played a little 
with Levenshtein module.

$ egrep --no-filename -R -o -w '[a-z]{4,15}' src/sage > /tmp/all
$ cat /tmp/all | sort | uniq -c | fgrep -w 1 | colrm 1 8 > /tmp/singles
$ cat /tmp/all | sort | uniq -c | fgrep -v -w 1 | colrm 1 8 > /tmp/nonsingles

And now

#!/bin/python

from Levenshtein import distance

f = open('/tmp/singles', 'r')
singles = f.readlines()
f.close()

f = open('/tmp/nonsingles', 'r')
nonsingles = f.readlines()
f.close()

for s in singles:
 for w in nonsingles:
 if distance(s, w) == 1:
 print(s+" "+w)
 break

This can be used to spot at few typos.

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/alpine.DEB.2.21..1908081049080.46669%40shell.sis.uta.fi.


Re: [sage-devel] Re: how does the res/mod in "geng" work?

2019-03-25 Thread TAU
Btw, what is most simple way in SageMath to run parallel independent jobs 
without dependencies?

For example, let G() be a generator outputting 1000 objects and let there 
be four cpu cores available. Now it would be nice if we could just fork 
four processes, each basically saying for example "Get an object o from 
G(), compute f(o), and if it is 42, save o to the list F." This needs an 
atomic way to call G(), and an atomic way to append a list.

This seems so common form of computation that I suppose there is some nice 
way for this.

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: how does the res/mod in "geng" work?

2019-03-24 Thread TAU
On Sun, 24 Mar 2019, Nico Van Cleemput wrote:

> If you use the normal splitting with geng, it might become more even if you 
> go to a higher number of
> parts. However, it will never be completely even.

We could also use geng to split output to for example 100 parts and then 
combine parts so that we get 10 almost equal sized part.

But then, it may be that in following computation almost all time is used 
for only few graphs. As an example: take all posets on 10 elements and 
compute the dimension. Now exactly one poset, the standard example of 2 × 
5 elements, will take very long time. Of course similar does not always 
occur, it depends on what we are computing.

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Suggestion to speed up nauty_geng()?

2019-03-22 Thread TAU
On Fri, 22 Mar 2019, Ai Bo wrote:

> With 12, I can't write to a file, it is at least 1500G. I can write to a 
> file up to around 300G at most.

> That is why I am thinking how to divide the output of "geng 12".   So 
> far, I don't have any idea. Any suggestion?

You can (and should) use A/B -notation to geng:

$ ./local/bin/geng 9 > /dev/null
>A ./local/bin/geng -d0D8 n=9 e=0-36
>Z 274668 graphs generated in 0.15 sec

$ ./local/bin/geng 9 0/10 > /dev/null
>A ./local/bin/geng -X0x200d0D8 n=9 e=0-36 class=0/10
>Z 30682 graphs generated in 0.02 sec

$ ./local/bin/geng 9 1/10 > /dev/null
>A ./local/bin/geng -X0x200d0D8 n=9 e=0-36 class=1/10
>Z 26300 graphs generated in 0.02 sec

and to verify this:

./local/bin/geng 9 | wc -l

outputs 274668, just like

for x in $(seq 0 9); do ./local/bin/geng 9 $x/10; done | wc -l

(But I guess you must use splitting number bigger than 10, maybe ~100.)

I think that you can run this in parallel and get you computation done in 
a day or two. But n=13 might need a supercomputer.

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Suggestion to speed up nauty_geng()?

2019-03-22 Thread TAU
On Thu, 21 Mar 2019, Simon King wrote:

> Does either of you plan to open a ticket and make the functionality
> available, that according to Jori is present in nauty but according
> to Ai isn't wrapped in Sage?

At least I do not.

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Suggestion to speed up nauty_geng()?

2019-03-22 Thread TAU
OK, more explanation.

  * * *

First I compare time for generating graphs in Nauty and in Sage. As plain 
graphs(n) uses nauty, I have test.sage containing

print(sum(1 for _ in graphs(9)))

It takes about 11½ seconds to run. I tested this with

time ./sage test.sage

Then,

./local/bin/geng 9 > /dev/null

says "274668 graphs generated in 0.12 sec". So, if we just want to sample 
few graphs, we can get the speedup of ~50x. In other words, it is slow to 
convert data to Python internal format.

OTOH number of many finite structures up to isomorphism grows very fast. 
So you can for example test some hypothesis to n=10 on a mobile phone, 
n=11 on a desktop computer and n=13 on a supercomputer. Same happens when 
you optimize code.

  * * *

Next, does geng use multiple cpu cores? No. There is no difference between

time taskset -c 1 ./local/bin/geng 9 > /dev/null
time taskset -c 1-4 ./local/bin/geng 9 > /dev/null

(You could also use "top" to see cpu usage.)

  * * *

Now, how to use geng, make a sample, and then get them to Sage? First I 
generated all graphs (here to n=9 for speed):

$ ./local/bin/geng 9 > g9
>A ./local/bin/geng -d0D8 n=9 e=0-36
>Z 274668 graphs generated in 0.12 sec

OK, now I have a big list of strings:

$ head -3 g9 ; tail -3 g9
H??
HA?
HB?
H]~
H^~
H~~

Every line is an encoded graph. I want to make a sample, lets say every 
1000:th line. Every line is (HERE, not when n=12) 8 bytes long. So,

$ i=0; while [[ i -lt 274668 ]]; do dd if=g9 bs=8 skip=$i count=1 >> g9sample 
2> /dev/null; i=$((i+1000)); done

will give you a file of 275 lines:

$ wc -l g9sample
275 g9sample

And now I did a test2.sage -file:

with open('g9sample', 'r') as fp:
 c = 0
 n = 0
 for line in fp:
 g = Graph(line, format='graph6')
 n += 1
 if g.is_connected():
 c += 1
print("About %s percent are connected" % round(100.0*c/n))

and

$ ./sage test2.sage
About 95 percent are connected

Of course there are many other ways for this. For example you could read 
the whole file with Python and just skip 99,9% of lines, or skip every 
line with propability of 0.999 etc. Hopefully you get the idea from this.

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Suggestion to speed up nauty_geng()?

2019-03-21 Thread TAU
On Thu, 21 Mar 2019, Ai Bo wrote:

> Is there a way to "random access"? For example, access the nth element 
> in the "generator", instead of one by one?

Kind of. As a most time is propably spent by creating Python data 
structures for SageMath, you can use nautygen directly to generate huge 
number of graphs.

As an example, it takes below 5 seconds to generate all biconnected graphs 
on 10 vertices, and I took third last one:

$ nauty26r7/geng 10 -C | tail -3 | head -1
>A /home/jm58660/lat-koe/nauty26r7/geng -Cd2D9 n=10 e=10-45
>Z 9743542 graphs generated in 4.59 sec
I]~~w

and now

sage: g = Graph('I]~~w', format='graph6')
sage: g.is_biconnected()
True


-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] short python3 report (March of the last python2 year)

2019-03-03 Thread TAU
On Sun, 3 Mar 2019, Frédéric Chapoton wrote:

> In sage 8.7.b6 built with python3, there are now 464 failing doctests, in a
> total of 137 files.

You forgot to say that this is great progress -- and we should thank you 
for a big part of this!

It also seems that in py3 the testing framework does not initialize random
seed -- i.e. I got errors randomly from a .random_element().

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Py2 vs. Py3 and random functions

2019-02-26 Thread TAU
Is this a known feature?

...~/sage$ ./sage -c 'set_random_seed(0); print(randint(1, 10^6))'
111440

...~/sage3$ ./sage -c 'set_random_seed(0); print(randint(1, 10^6))'
116853

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: Counting integer compositions with restrictions

2019-02-21 Thread TAU
On Tue, 19 Feb 2019, TB wrote:

> There is the cardinality method of IntegerVectors. Note that the default for 
> min_part is 0.

So this could be used for...?

I do not know the area. I was just playing with numbers (original question 
was "In how many ways you can arrange a queue of 9 men and 7 women such 
that no two women are next to each other?"), and noticed that 
.cardinality() in sage/combinat/partition.py even has algorithm-parameter. 
So I think there might be existing code just waiting for interface.

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Counting integer compositions with restrictions

2019-02-19 Thread TAU
Is there a fast way to compute for example

Compositions(15, min_length=10, max_length=10).cardinality()

in some package already integrated to SageMath? For Partitions(...) that 
seems to be the case, but Compositions(...) uses just brute enumeration.

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] SageNB and Firefox

2019-02-06 Thread TAU
(I know, I know... SageNB is deprecated.)

In the newest firefox in Linux pressing backspace in an empty cell does 
not delete the input cell. It works in Chromium. Why that, any workaround 
on the server side?

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] different graph canonical labels bliss vs Sage (was: doctest failures in databases/sql_db.py)

2019-01-02 Thread TAU
On Wed, 2 Jan 2019, Vincent Delecroix wrote:

> I thought that the definition of the canonical labels was the
> order on vertices that minimize the adjacency matrix in
> lexicographic order...

?? Any function that translates isomorphism to equality is a canonical 
labeling.

-- 
Jori Mäntysalo

Tampereen korkeakoulut ovat yhdistyneet 1.1.2019 alkaen. Huomaa uusi,
@tuni.fi -loppuinen sähköpostiosoitteeni.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.