[sage-combinat-devel] Re: [sage-devel] bug with DisjointUnionEnumeratedSet?

2010-05-31 Thread Florent Hivert
  Hi John,

> One of the examples in the docstring for DisjointUnionEnumeratedSet
> goes something like this:
> 
> sage: U = DisjointUnionEnumeratedSets(Family(NonNegativeIntegers(),
> Permutations))
> sage: it = iter(U)
> sage: it.next()
> []
> 
> If I try the same thing, replacing "Permutations" with "Partitions",
> it doesn't work:
> 
> sage: U = DisjointUnionEnumeratedSets(Family(NonNegativeIntegers(),
> Partitions))
> sage: it = iter(U)
> sage: it.next()
> ---
> ValueErrorTraceback (most recent call
> [...]
> Is this expected?

I can't reproduce the problem with sage 4.4.2:

tomahawk-~ $ sage
--
| Sage Version 4.4.2, Release Date: 2010-05-19   |
| Type notebook() for the GUI, and license() for information.|
--
sage: U = DisjointUnionEnumeratedSets(Family(NonNegativeIntegers(), Partitions))
sage: it = iter(U)
sage: it.next()
[]
sage: it.next()
[1]
sage: it.next()
[2]
sage: it.next()
[1, 1]
sage: it.next()
[3]
sage: it.next()
[2, 1]
sage: it.next()
[1, 1, 1]
sage: quit
Exiting Sage (CPU time 0m0.12s, Wall time 0m13.00s).

Which version of sage are you using ?

Cheers,

Florent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] bug with DisjointUnionEnumeratedSet?

2010-05-31 Thread John H Palmieri
(also posted to sage-devel)


One of the examples in the docstring for DisjointUnionEnumeratedSet
goes something like this:

sage: U = DisjointUnionEnumeratedSets(Family(NonNegativeIntegers(),
Permutations))
sage: it = iter(U)
sage: it.next()
[]

If I try the same thing, replacing "Permutations" with "Partitions",
it doesn't work:

sage: U = DisjointUnionEnumeratedSets(Family(NonNegativeIntegers(),
Partitions))
sage: it = iter(U)
sage: it.next()
---
ValueError                                Traceback (most recent call
last)

/Users/palmieri/ in ()

/Applications/sage/local/lib/python2.6/site-packages/sage/sets/
disjoint_union_enumerated_sets.pyc in __iter__(self)
    398         """
    399         for k in self._family.keys():
--> 400             for el in self._family[k]:
    401                 if self._keepkey:
    402                     el = (k, el)

/Applications/sage/local/lib/python2.6/site-packages/sage/sets/
family.pyc in __getitem__(self, i)
    939             10
    940         """
--> 941         return self.function(i)
    942
    943     def __getstate__(self):

/Applications/sage/local/lib/python2.6/site-packages/sage/combinat/
combinat.pyc in __call__(self, x)
   1013             return self._element_constructor_(x)
   1014         else:
-> 1015             raise ValueError, "%s not in %s"%(x, self)
   1016
   1017     Element = CombinatorialObject # mostly for backward
compatibility

ValueError: 0 not in Partitions

Is this expected?

--
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] semistandard tableaux

2010-05-31 Thread Hugh Thomas

Hi!

Eric Webster and I want to make some changes to
SemistandardTableaux(p,mu).  This is the first change I've tried to
make to Sage, so I'm not totally sure of the protocol, but it was
suggested to me that I should describe here what we plan to do (as
well as opening a trac ticket, which I will do shortly).

Mostly, we want to make a change to add a feature, so that one can
specify an additional keyword argument max_entry=k so as to get the
Semistandard Tableaux(p,mu) with entries in 1..k, or max_entry=-1 so
there is no maximum.  (Currently, the entries are in 1..|p| unless mu
is specified, and I would keep that as the default.)  So our proposed
change is just an enhancement and presumably won't screw anything up
if done right.  I do also want to change __repr__ so it always
explicitly says what the maximum entry is.

While looking at the code, though, I noticed something a bit wierd
about the way SemistandardTableaux(p,mu) operates.  As it stands, p
can be an integer, a partition, or None, and mu is an integer vector
describing content.  If p is an integer, it returns all tableaux of
size p (and with content mu if mu is specified).  If p is a partition,
it returns all tableaux of shape p (and with content mu if mu is
specified).  If p is None, it ignores mu.  This seems wrong: surely it
ought to give you all tableaux of content mu and size |mu|.  So I
wanted to change that.  But it's not because I really need it, it's
just tidy-mindedness.  If anyone suggests it's a bad idea to do this
part, I won't.

cheers

Hugh

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Finalize Breadth first search improvement for search forest

2010-05-31 Thread Nicolas Borie
Hello all!

This topic deal with ticket #8288.

We (Florent, Nicolas^2) discussed a few about search forest improvements
in Marne. Let's me try to recall main points of the discussion :

- Search Forest deserve to stay very simple to use (arguments are simple
functions).
- We currently have no specific use-case which motivate the integration
of father and next_brother function. We also have no use-case where the
combination of father and next_brother make a breadth first search more
efficient.
- We have use-cases and interest in a post_process function as optional
argument.

We accorded together on the following specifications :

INPUT:

- ``roots``: a list (or iterable)
- ``children``: a function returning a iterator (or iterable)
- ``post_process``: a function well defined over the nodes of
``self`` returning your favorite output or None if you don't want the
node appearing in iterators. (default to None)
- ``category``: a category (default to None)

OUTPUT:

- a Parent of category EnumeratedSets().or_subcategory(category)

In the same time, Minh proposed a reviewer patch for this ticket
(#8288). He didn't know conclusions of our discussion. His work is not a
loss of time (firstly because his long comment was a very good source of
informations for beginner developer like me).

Here comes the questions :
- Is everybody still ok with main points and spec ?
- Any comment, suggestion of improvement ?

I will try to finalise this ticket using the contribution of everybody
shortly.

Cheers,
Nicolas (The little.)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



Re: [sage-combinat-devel] Re: IntegerRange output...

2010-05-31 Thread Florent Hivert
> >> Thanks to Florent's work (trac_8704-integer_range_print-fh.patch), the
> >> output of IntegerRange is much nicer now. I was about to put a
> >> positive review, when I had a last doubt about the consistency between:
> >>
> >>  sage: I = IntegerRange(2,100,5); I
> >>  {2, 7 .. 97}
> >>  sage: I = IntegerRange(54,Infinity,3); I
> >>  {54, 57, ..}
> >>
> >> Should there be a comma in both cases, in none, or is it good as is?
> >
> > I would say {2, 7 .. 97} should be replaced by {2, 7, .., 97} for
> > consistency.

Done, pushed and submitted... Please Review.

Florent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



Re: [sage-combinat-devel] Semigroupe on 64 bits

2010-05-31 Thread Anne Schilling

Dear Nicolas,


While investigating Anne's issues with semigroupe, I discovered that
semigroupe was actually silently broken for everybody since a couple
days due to an import loop which was triggered by a completely
independent patch. I have fixed this loop, and also fixed the
semigroupe patch to issue a warning in case semigroupe cannot be
loaded properly.

Please try and report:

sage -f 
http://trac.sagemath.org/sage_trac/raw-attachment/ticket/8360/semigroupe-2.0-2.spkg
sage -combinat update
sage -br

sage: S = semigroupe.TransformationSemigroup(3)
sage: S.cardinality()
27


This works now! Thank you for fixing it.

But now there is still the same problem I had before this problem:

d145:/Applications/sage-4.4.2/devel/sage/sage/libs anne$ sage -t semigroupe
sage -t  "4.4.2/devel/sage-combinat/sage/libs/semigroupe/__init__.py"
 [0.2 s]
sage -t  "4.4.2/devel/sage-combinat/sage/libs/semigroupe/all.py"
 [0.2 s]
sage -t  "4.4.2/devel/sage-combinat/sage/libs/semigroupe/semigroupe.pyx"
 [16.4 s]
sage -t  "4.4.2/devel/sage-combinat/sage/libs/semigroupe/tutorial.py"
**
File 
"/Applications/sage-4.4.2/devel/sage-combinat/sage/libs/semigroupe/tutorial.py",
 line 12:
sage: W._gap_group
Exception raised:
Traceback (most recent call last):
  File "/Applications/sage/local/bin/ncadoctest.py", line 1231, in 
run_one_test
self.run_one_example(test, example, filename, compileflags)
  File "/Applications/sage/local/bin/sagedoctest.py", line 38, in 
run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, 
compileflags)
  File "/Applications/sage/local/bin/ncadoctest.py", line 1172, in 
run_one_example
compileflags, 1) in test.globs
  File "", line 1, in 
W._gap_group###line 12:
sage: W._gap_group
  File "parent.pyx", line 680, in sage.structure.parent.Parent.__getattr__ 
(sage/structure/parent.c:5311)
  File "parent.pyx", line 264, in 
sage.structure.parent.getattr_from_other_class (sage/structure/parent.c:2757)
  File "parent.pyx", line 172, in 
sage.structure.parent.raise_attribute_error (sage/structure/parent.c:2629)
AttributeError: 'CoxeterGroup_with_category' object has no attribute 
'_gap_group'
**
File 
"/Applications/sage-4.4.2/devel/sage-combinat/sage/libs/semigroupe/tutorial.py",
 line 14:
sage: (W._gap_group).parent()
Exception raised:
Traceback (most recent call last):
  File "/Applications/sage/local/bin/ncadoctest.py", line 1231, in 
run_one_test
self.run_one_example(test, example, filename, compileflags)
  File "/Applications/sage/local/bin/sagedoctest.py", line 38, in 
run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, 
compileflags)
  File "/Applications/sage/local/bin/ncadoctest.py", line 1172, in 
run_one_example
compileflags, 1) in test.globs
  File "", line 1, in 
(W._gap_group).parent()###line 14:
sage: (W._gap_group).parent()
  File "parent.pyx", line 680, in sage.structure.parent.Parent.__getattr__ 
(sage/structure/parent.c:5311)
  File "parent.pyx", line 264, in 
sage.structure.parent.getattr_from_other_class (sage/structure/parent.c:2757)
  File "parent.pyx", line 172, in 
sage.structure.parent.raise_attribute_error (sage/structure/parent.c:2629)
AttributeError: 'CoxeterGroup_with_category' object has no attribute 
'_gap_group'
**
File 
"/Applications/sage-4.4.2/devel/sage-combinat/sage/libs/semigroupe/tutorial.py",
 line 19:
sage: W.an_element()^3
Expected:

(1,5)(2,62)(3,7)(6,9)(8,12)(11,15)(13,17)(16,20)(18,22)(21,25)(26,29)(28,31)(30,33)(32,35)(34,37)(36,39)(38,41)(42,45)(46,48)(47,49)(50,52)(55,56)(57,58)(61,65)(63,67)(66,69)(68,72)(71,75)(73,77)(76,80)(78,82)(81,85)(86,89)(88,91)(90,93)(92,95)(94,97)(96,99)(98,101)(102,105)(106,108)(107,109)(110,112)(115,116)(117,118)
Got:
[]
**
File 
"/Applications/sage-4.4.2/devel/sage-combinat/sage/libs/semigroupe/tutorial.py",
 line 24:
sage: len(W.conjugacy_classes_representatives())
Exception raised:
Traceback (most recent call last):
  File "/Applications/sage/local/bin/ncadoctest.py", line 1231, in 
run_one_test
self.run_one_example(test, example, filename, compileflags)
  File "/Applications/sage/local/bin/sagedoctest.py", line 38, in 
run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename, 
compileflags)
  File "/Applications/sage/local/bin/ncadoctest.py", line 1172, in 
run_one_example
python(5361) malloc: *** vm_allocate(size=262144) failed (error code=3)
python(5361) malloc: *** error: can't allocate region
python(5361) malloc:

Re: [sage-combinat-devel] Semigroupe on 64 bits

2010-05-31 Thread Nicolas M. Thiery
Dear Anne, dear semigroup folks,

While investigating Anne's issues with semigroupe, I discovered that
semigroupe was actually silently broken for everybody since a couple
days due to an import loop which was triggered by a completely
independent patch. I have fixed this loop, and also fixed the
semigroupe patch to issue a warning in case semigroupe cannot be
loaded properly.

Please try and report:

sage -f 
http://trac.sagemath.org/sage_trac/raw-attachment/ticket/8360/semigroupe-2.0-2.spkg
sage -combinat update
sage -br

sage: S = semigroupe.TransformationSemigroup(3)
sage: S.cardinality()
27

Thanks!

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.