Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compute DOL languages #26307

Closed
videlec opened this issue Sep 18, 2018 · 16 comments
Closed

compute DOL languages #26307

videlec opened this issue Sep 18, 2018 · 16 comments

Comments

@videlec
Copy link
Contributor

videlec commented Sep 18, 2018

With the patch

sage: s = WordMorphism({0: [0,1], 1:[0]})
sage: %time L = s.language(10000)
CPU times: user 221 ms, sys: 10.3 ms, total: 231 ms
Wall time: 221 ms
sage: len(L)
10001

CC: @staroste @seblabbe

Component: combinatorics

Author: Vincent Delecroix

Branch/Commit: 431bee7

Reviewer: Sébastien Labbé

Issue created by migration from https://trac.sagemath.org/ticket/26307

@videlec videlec added this to the sage-8.4 milestone Sep 18, 2018
@videlec
Copy link
Contributor Author

videlec commented Sep 18, 2018

Branch: u/vdelecroix/26307

@videlec
Copy link
Contributor Author

videlec commented Sep 18, 2018

Commit: 4036c1c

@videlec
Copy link
Contributor Author

videlec commented Sep 18, 2018

New commits:

f144c0226307: DOL languages
4036c1c26307: more naive (and faster) powering of morphisms

@seblabbe
Copy link
Contributor

comment:2

This is great! I remember almost 10 years ago, I suggested to write such a function and I remember you said it was not a good idea :P

I would ask that you add an INPUT block for both language and _language_naive methods that explains both inputs n and u and also what happens when u=None. After this is done, it will be good to go for me (if all tests pass which I didn't check yet).

@seblabbe
Copy link
Contributor

comment:3

I obtain two failing doctests (also reported by the patchbot report) :

sage -t --long src/sage/combinat/words/morphism.py  # 2 doctests failed

@videlec
Copy link
Contributor Author

videlec commented Sep 20, 2018

comment:4

I am not 100% convinced that this patch is a good idea. The problem is that you might expect sigma.language() to return an object for the set of factors, because for example you want to access the words of length {100, 101, 102, 103} and for that purpose it make no sense to call three times s.language(n) four times. We can still make that happen in the future without breaking backward compatibility.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 20, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

eddab4726307: fix doctests
1c7bc6226307: INPUT sections

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 20, 2018

Changed commit from 4036c1c to 1c7bc62

@seblabbe
Copy link
Contributor

comment:7

I will be pickky, but can you use double -- where needed please to conform with the developer manual:

- - ``n`` - non-negative inte
+ - ``n`` -- non-negative inte

@seblabbe
Copy link
Contributor

comment:8

One other comment, I think language should return a set instead of a list. It is better to let the translation from set to list be done by the user if he needs to.

- return list(L)
+ return L

Often, one wants to test containment and it will be stupid that the user have to do set(m.language(1000)).

@seblabbe
Copy link
Contributor

Reviewer: Sébastien Labbé

@videlec
Copy link
Contributor Author

videlec commented Sep 20, 2018

comment:10

Replying to @seblabbe:

One other comment, I think language should return a set instead of a list. It is better to let the translation from set to list be done by the user if he needs to.

- return list(L)
+ return L

Often, one wants to test containment and it will be stupid that the user have to do set(m.language(1000)).

Agreed. Though w.factor_set() returns a "Sage set" and not a Python set... this is not so nice.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 20, 2018

Branch pushed to git repo; I updated commit sha1. New commits:

a4f0cd426307: conform docstring
431bee726307: return set

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 20, 2018

Changed commit from 1c7bc62 to 431bee7

@videlec
Copy link
Contributor Author

videlec commented Sep 20, 2018

comment:14

Thanks Sebastien!

@vbraun
Copy link
Member

vbraun commented Sep 22, 2018

Changed branch from u/vdelecroix/26307 to 431bee7

@vbraun vbraun closed this as completed in 938e96b Sep 22, 2018
vbraun pushed a commit that referenced this issue Apr 6, 2023
    
<!-- Please provide a concise, informative and self-explanatory title.
-->
<!-- Don't put issue numbers in the title. Put it in the Description
below. -->
<!-- For example, instead of "Fixes #12345", use "Add a new method to
multiply two integers" -->

### 📚 Description

Remove the deprecated `datatype` argument in word morphisms introduced
in #26307

<!-- Describe your changes here in detail. -->
<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes #12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x
]`. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [x] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- #12345: short description why this is a dependency
- #34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: #35421
Reported by: Frédéric Chapoton
Reviewer(s): Sébastien Labbé, Travis Scrimshaw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants