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

Integrating JuLie into Oscar #1935

Merged
merged 62 commits into from
Mar 12, 2023
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
d551e3c
first julie test
ClaudiaHeYun Feb 2, 2023
b1e5acb
Add testset wrappers.
HechtiDerLachs Feb 2, 2023
73c8aa5
Merge pull request #1 from HechtiDerLachs/julie_yun
ClaudiaHeYun Feb 2, 2023
47d100f
excluding Partition from Hecke; including partitions from JuLie
ClaudiaHeYun Feb 2, 2023
40800e9
passed partitions test
ClaudiaHeYun Feb 2, 2023
e546118
Turn lambda and mu to non-greek letters.
HechtiDerLachs Feb 4, 2023
8cfd689
Add Markdown statements.
HechtiDerLachs Feb 4, 2023
434f2e5
Export references.
HechtiDerLachs Feb 4, 2023
46d368f
Merge pull request #2 from HechtiDerLachs/julie_yun
ClaudiaHeYun Feb 4, 2023
d04b2b3
add schur polynomials and test file
ClaudiaHeYun Feb 4, 2023
d9aa891
Merge branch 'julie_yun' of github.com:ClaudiaHeYun/Oscar.jl into jul…
ClaudiaHeYun Feb 4, 2023
6323ad8
fix bug in schur_polynomials.jl; re-structure module
ClaudiaHeYun Feb 4, 2023
72e0499
Add section on optional arguments for parents of return values.
HechtiDerLachs Feb 4, 2023
cb18012
Merge pull request #3 from HechtiDerLachs/julie_yun
ClaudiaHeYun Feb 4, 2023
f388280
add tableaux and tests; tests passed
ClaudiaHeYun Feb 4, 2023
caa6abe
Merge branch 'julie_yun' of github.com:ClaudiaHeYun/Oscar.jl into jul…
ClaudiaHeYun Feb 4, 2023
e7e6270
Add first file for documentation.
HechtiDerLachs Feb 4, 2023
d283f71
Rename file.
HechtiDerLachs Feb 4, 2023
cdf832a
Clarify origins and modifications.
HechtiDerLachs Feb 4, 2023
a6375f5
add doc string; export more functions from partitions.jl
ClaudiaHeYun Feb 4, 2023
d780ff6
Add further documentation for JuLie.
HechtiDerLachs Feb 4, 2023
eee0bc5
Merge pull request #4 from HechtiDerLachs/julie_yun
ClaudiaHeYun Feb 4, 2023
daceaad
Adjust indentation.
HechtiDerLachs Feb 4, 2023
004c27d
change doc strings
ClaudiaHeYun Feb 4, 2023
8fb8525
Merge branch 'julie_yun' of https://github.com/ClaudiaHeYun/Oscar.jl …
HechtiDerLachs Feb 4, 2023
949b308
Merge pull request #5 from HechtiDerLachs/julie_yun
ClaudiaHeYun Feb 14, 2023
b1f919a
Overhaul docstrings.
HechtiDerLachs Feb 14, 2023
59fbf75
Adjust indentation.
HechtiDerLachs Feb 14, 2023
7c24e21
Adjust references.
HechtiDerLachs Feb 14, 2023
d8ba513
Minor fix in the Markdown macro.
HechtiDerLachs Feb 14, 2023
606bf7e
Adjust passing rings as extra arguments for return values.
HechtiDerLachs Feb 14, 2023
2c4eeea
Merge pull request #6 from HechtiDerLachs/julie_yun
ClaudiaHeYun Feb 14, 2023
d956d45
Fix tests for schur polynomials.
HechtiDerLachs Feb 14, 2023
15f5c9b
Merge pull request #7 from HechtiDerLachs/julie_yun
ClaudiaHeYun Feb 14, 2023
d60fce9
fixing docstrings
ClaudiaHeYun Feb 14, 2023
9eebe66
fixing docstrings
ClaudiaHeYun Feb 14, 2023
7771cba
Fix tests.
HechtiDerLachs Feb 14, 2023
b134e27
Merge pull request #8 from HechtiDerLachs/julie_yun
ClaudiaHeYun Feb 15, 2023
d860db8
Update test/runtests.jl
HechtiDerLachs Feb 15, 2023
c85323d
added credits
ClaudiaHeYun Feb 15, 2023
9a5b502
Merge branch 'julie_yun' of github.com:ClaudiaHeYun/Oscar.jl into jul…
ClaudiaHeYun Feb 15, 2023
25037aa
Fix imports.
HechtiDerLachs Feb 16, 2023
df6d179
Merge branch 'master' into julie_yun
HechtiDerLachs Feb 17, 2023
d7602e1
Merge branch 'master' into julie_yun
micjoswig Feb 25, 2023
8347cd2
addressing comments from @fingolfin
ClaudiaHeYun Mar 1, 2023
e584a33
Merge branch 'master' into julie_yun
ClaudiaHeYun Mar 1, 2023
40e9ad9
every function in partitions.jl now accepts IntegerUnion
ClaudiaHeYun Mar 7, 2023
855bd3c
Remove .DS_Store files
fingolfin Mar 9, 2023
96dcaa0
Remove extra whitespace
fingolfin Mar 9, 2023
b730860
Access libflint consistently
fingolfin Mar 9, 2023
1e6302a
Follow file name conventions
fingolfin Mar 9, 2023
70bc9e3
Change examples to use jldoctest, fix them
fingolfin Mar 9, 2023
0747f7d
Limit exports to one per line, sort alphabetically
fingolfin Mar 9, 2023
1117ee3
Tweak docstrings, avoid overly long lines
fingolfin Mar 9, 2023
be5494a
Fix misplaced argument type specifications
fingolfin Mar 9, 2023
f3779da
Fix docs
fingolfin Mar 11, 2023
be8ae24
Undo random whitespace insertion
fingolfin Mar 11, 2023
71b0fb5
Typo
fingolfin Mar 11, 2023
873f33a
Revise partitions with 4 integer arguments
fingolfin Mar 12, 2023
7cecf18
Revert dev docs changes
fingolfin Mar 12, 2023
9c14de8
Merge branch 'master' into julie_yun
fingolfin Mar 12, 2023
76fff7a
Use @req
fingolfin Mar 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/doc.main
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@
"Combinatorics/graphs.md",
"Combinatorics/matroids.md",
"Combinatorics/simplicialcomplexes.md",
"Combinatorics/partitions.md",
"Combinatorics/tableaux.md",
"Combinatorics/schur_polynomials.md",
],

"Straight Line Programs" => [
Expand Down
40 changes: 40 additions & 0 deletions docs/oscar_references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,13 @@ @InProceedings{KLT20
url = {https://doi.org/10.1007/978-3-030-52200-1_37}
}

@Misc{KO14,
author = {Kelleher, J. and O'Sullivan, B.},
title = {Generating All Partitions: A Comparison Of Two Encodings},
year = {2014},
url = {https://arxiv.org/abs/0909.2331}
}

@Book{KR05,
author = {Kreuzer, Martin and Robbiano, Lorenzo},
title = {Computational commutative algebra. II},
Expand Down Expand Up @@ -1066,6 +1073,17 @@ @Book{Mar18
url = {https://doi.org/10.1007/978-3-319-90233-3}
}

@Article{Mer12,
author = {Merca, M},
title = {Fast algorithm for generating ascending compositions},
journal = {J. Math. Model. Algorithms},
volume = {11},
number = {(1)},
pages = {89--104},
year = {2012},
url = {https://doi.org/10.1007/s10852-011-9168-y}
}

@Article{Nik79,
author = {Nikulin, V. V.},
title = {Integer symmetric bilinear forms and some of their
Expand Down Expand Up @@ -1154,6 +1172,17 @@ @Article{Pos18
doi = {10.1007/s00013-018-1183-z}
}

@Article{RJ76,
author = {Riha, W. and James, K. R.},
title = {Algorithm 29 efficient algorithms for doubly and multiply
restricted partitions},
journal = {Computing},
volume = {16},
pages = {163--168},
year = {1976},
url = {https://link.springer.com/article/10.1007/BF02241987}
}

@Article{RR10,
author = {Roschy, Helmut and Rahn, Thorsten},
title = {Cohomology of line bundles: Proof of the algorithm},
Expand Down Expand Up @@ -1345,6 +1374,17 @@ @Article{Wit88
reportnumber = {IASSNS-HEP-88/7}
}

@Article{ZS98,
author = {Zoghbi, A. and Stojmenovic, I.},
title = {Fast algorithms for generating integer partitions},
journal = {Int. J. Comput. Math.},
volume = {70},
number = {(2)},
pages = {319--332},
year = {1998},
url = {https://doi.org/10.1080/00207169808804755}
}

@Book{Zie95,
author = {Ziegler, Günter M.},
title = {Lectures on polytopes},
Expand Down
36 changes: 36 additions & 0 deletions docs/src/Combinatorics/partitions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Partitions

```@docs
Partition
```

## Unrestricted partitions

```@docs
partitions(::Integer)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meta-question: what is Integer here? The Julia type Base.Integer?

Can one also pass the OSCAR integer type fmpz to these functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's Base.Integer. Passing fmpz results in an error. Should we do something about this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if IntegerUnion was accepted, i.e. both fmpz (= ZZRingElem) and Base.Integer

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(But this is not a requirement for merging, just something that would be nice to have eventually -- if we don't do it in this PR, someone should open an issue to remind us to do it)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed partitions to accept fmpz integers. However, there are a number of other functions that take integers as inputs. Should we modify everything so that they all accept IntegerUnion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed all functions in partitions.jl to accept IntegerUnion. I didn't do that for schur_polynomials.jl or tableaux.jl. Hope this doesn't break anything... 😬

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed partitions to accept fmpz integers. However, there are a number of other functions that take integers as inputs. Should we modify everything so that they all accept IntegerUnion?

That was my problem as well and I didn't really know what to do about it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, any place that would accept a BigInt should also accept an fmpz / ZZRingElem.

Of course there are places where really only a "small" integer makes sense, in those case staying with Integer is fine.

num_partitions(::Integer)
ascending_partitions
```

## Restricted partitions

```@docs
partitions(::Integer, ::Integer, ::Integer, ::Integer)
partitions(::Integer, ::Integer)
num_partitions(::Integer, ::Integer)
partitions(::Array{Integer,1}, ::Integer, ::Array{Integer,1}, ::Integer)
ClaudiaHeYun marked this conversation as resolved.
Show resolved Hide resolved
```

## Operations

```@docs
conjugate
getindex_safe
```

## Relations

```@docs
dominates
```

5 changes: 5 additions & 0 deletions docs/src/Combinatorics/schur_polynomials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Schur polynomials

```@docs
schur_polynomial(lambda::Partition{T}, n=sum(lambda)::Int) where T<:Integer
```
33 changes: 33 additions & 0 deletions docs/src/Combinatorics/tableaux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Tableaux

```@docs
Tableau
```

## Operations

```@docs
hook_length
hook_lengths
shape
weight
reading_word
```

## Semistandard tableaux

```@docs
is_semistandard
semistandard_tableaux
```

## Standard tableaux

```@docs
is_standard
standard_tableaux
num_standard_tableaux
schensted
bump!
```

47 changes: 47 additions & 0 deletions docs/src/DeveloperDocumentation/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,53 @@ end

However, as always, rules sometimes should be broken.

## Optional arguments for parents of return values

Several objects in Oscar have `parent`s, e.g. polynomials, group elements, ...
ClaudiaHeYun marked this conversation as resolved.
Show resolved Hide resolved
Whenever a function creates such objects from an input which does not involve
the output's parent, the user should have the possibility to pass on this
parent as an optional argument.

Let's see an example. Say, you want to implement the characteristic
polynomial of a matrix. You could do it as follows:
```julia
function characteristic_polynomial(A::MatrixElem)
kk = base_ring(A)
P, x = kk["x"]
AP = change_base_ring(P, A)
return det(AP - x*one(AP))
end
```
You can see that the polynomial ring `P`, i.e. the parent of the output,
is newly created in the body of the function. In particular, calling this
function two times on two different matrices `A` and `B` might produce
incompatible polynomials `p = det(A - x*one(A))` and `q = det(B - x*one(B))`
with different parents. Then `p + q` will produce an error.

To solve this, we should have implemented the function differently:
```julia
function characteristic_polynomial(
A::MatrixElem;
ring::AbstractAlgebra.Ring=(base_ring(A)["t"])[1]
)
AP = change_base_ring(ring, A)
x = first(gens(ring))
return det(AP - x*one(AP))
end

function characteristic_polynomial(
P::AbstractAlgebra.Ring,
A::MatrixElem
)
coefficient_ring(P) === base_ring(A) || error("coefficient rings incompatible")
return characteristic_polynomial(A, ring=P)
end
```
This allows for two different entry points for the ring `P` of the output:
Once as the first argument of a method of `characteristic_polynomial` with
an extended signature, and second as an optional keyword argument for `ring` in
the original method. This should be the general rule for such implementations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are editing the OSCAR styleguide here. Either this is the general rule within OSCAR, or it isn't; the "should" makes no sense.

Whether this is the rule is debatable, though. Do we really want to force all code to offer both these variants? Why? I.e., why two ways to achieve the same thing?

Also, perhaps ring is not always the best name for the argument, and from the text it sounds this is mandatory.

Indeed, as far as I can tell, the "real" charpoly and minpoly do not support the keyword argument variant.

My recommendation: move this addition to the styleguide into a separate PR (it doesn't really belong into this PR anyway). That way, we can discuss it there, and don't hold up this PR here.

within Oscar.

## Deprecating functions

Expand Down
2 changes: 2 additions & 0 deletions experimental/Experimental.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ include("Schemes/CoherentSheaves.jl")
include("Schemes/LazyGlueing.jl")
include("Schemes/CartierDivisor.jl")
include("Schemes/Auxiliary.jl")

fingolfin marked this conversation as resolved.
Show resolved Hide resolved
include("JuLie.jl")
14 changes: 14 additions & 0 deletions experimental/JuLie.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module JuLie

using ..Oscar
using Markdown
import Nemo:libflint
fingolfin marked this conversation as resolved.
Show resolved Hide resolved

include("JuLie/partitions.jl")
include("JuLie/schur_polynomials.jl")
include("JuLie/tableaux.jl")

end

using .JuLie
export Partition, partitions, ascending_partitions, dominates, conjugate, getindex_safe, num_partitions, schur_polynomial, Tableau, shape, semistandard_tableaux, is_standard, is_semistandard, standard_tableaux, schensted, hook_length, hook_lengths, num_standard_tableaux, reading_word, weight, bump!
ClaudiaHeYun marked this conversation as resolved.
Show resolved Hide resolved
Loading