[Dev] Digit exponents R²¹, R¹⁰⁰: keep the limit of 20 or read the exponent?
I maintainer di solito rispondono entro 1 giorno
@jbcaillau ci sta già lavorando.
Dal 1/11/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Written by Claude (Claude Code), at the request of ocots, from a question raised while documenting the dimensions in PR #397. The measurements are mine; the question is for the maintainers.
@jbcaillau: your opinion is asked, see the question at the end.
Context
The dimension of a state, a control or a variable can be written R^n (any expression) or with digit exponents, R², R³, … Julia reads R² as one identifier, so the parser does not read the exponent: it has a table of aliases, built by __init_aliases(; max_dim=20), that maps R² to R^2 and so on up to R²⁰. Anything above is an unknown name:
x ∈ R²⁰, state # fine
x ∈ R²¹, state # ParsingError: unknown syntax
x ∈ R¹⁰⁰, state # same
x ∈ R^21, state # fine
A related question, the automatic names of the components (x₁, x₂, … only up to 9 for a symbolic dimension), is a separate issue: #403.
Why 20? (looked into, no reason found)
- The limit is in the first commit of the parser (f8d8c69, 2025-02-19, "added onepass + ctparser_utils"); no comment or later message gives a reason.
- It is not a memory limit. The table has 20 entries (
R¹toR²⁰) and is built for every@defblock. Measured on the currentmain(a@defblock of six statements, a statex ∈ R^n):
| n | @def time |
aliases for the state |
|---|---|---|
| 10 | 0.069 s | 47 |
| 100 | 0.072 s | 227 |
| 500 | 0.080 s | 1027 |
| 1000 | 0.090 s | 2027 |
| 2000 | 0.119 s | 4027 |
- What does grow with the dimension is the number of aliases of the components (two per component,
x₁andx1), andparse!substitutes every alias in every statement, so the cost is about the number of aliases times the number of statements. It is mild for these sizes. It is not a reason to cap the digit exponents (the table), which has nothing to do with the number of components.
Options
- Keep as is.
R^nis the general spelling; the digit exponents are a convenience up to 20, documented in the page Dimensions and automatic names. Nothing to maintain. - Read the digit exponents. Recognise any identifier made of
Rfollowed by superscript digits, and turn it intoR^k(superscript digits to ASCII, then parse).R²¹andR¹⁰⁰would work, and the table goes away. A few lines and tests, no change for what works today. The result, for a dimension of 100, is a state with 100 components and 200 aliases, which is whatR^100gives already. - Raise the table (
max_dim), which keeps the arbitrary limit somewhere else.
The superscript letters (Rⁿ) are not part of this question: they are refused, on purpose, and pinned by a test in PR #397. There is no superscript q, no _ and few capitals, so a name like n_x could not be written, and a second spelling of a symbolic dimension is not wanted.
Question
For @jbcaillau: do you remember a reason for the limit of 20 (or for 9 on a symbolic dimension) that these measurements miss? If not, do you prefer option 1, 2 or 3?
Related: #60 and PR #397.
- Lingua principale
- Julia
- Stelle
- 3
- Fork
- 0
- Merge medio
- 1g 32m
- PR unite (30g)
- 18
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di control-toolbox/CTParser.jl
-
Generate every representation of each component; remove the discretization from the :exa backendForse già presa @jbcaillau l’ha presa 5 giorni fa. Aperta
control-toolbox/CTParser.jl#415 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Keep the :exa constraint handles by label and return the path/boundary multipliers by labelForse già presa @jbcaillau l’ha presa 8 giorni fa. Aperta
control-toolbox/CTParser.jl#414 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Dev] Automatic names of the components (x₁, x1, …): limit of 9 for a symbolic dimensionForse già presa @jbcaillau l’ha presa 9 giorni fa. Apertafeature
control-toolbox/CTParser.jl#403 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Design] Should a constraint bound be allowed to depend on the model? Levels of relaxationForse già presa @jbcaillau l’ha presa 9 giorni fa. Apertadev
control-toolbox/CTParser.jl#401 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
A scalar bound on a vector-valued boundary constraint is not broadcast: DimensionMismatch with :fun, silently 0 with :exaForse già presa @jbcaillau l’ha presa 9 giorni fa. Apertabug
control-toolbox/CTParser.jl#400 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di control-toolbox/CTParser.jl
Issue simili
-
documentation priority: high
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
epiforecasts/BVDOutbreakSize#1260 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
TuringLang/Turing.jl#2917 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100