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

Use Lowercase in some show methods #1726

Merged
merged 2 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ julia> K, a = number_field(f, "a");
julia> O = maximal_order(K);

julia> O
Maximal order of Number field of degree 3 over QQ
with basis AbsSimpleNumFieldElem[1, a, a^2]
Maximal order of number field of degree 3 over QQ
with basis [1, a, a^2]
```

## Documentation
Expand Down
8 changes: 4 additions & 4 deletions src/AlgAss/AlgGrp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,24 +167,24 @@
end

function show(io::IO, A::GroupAlgebra)
io = pretty(io)
if is_terse(io)
print(io, "Group algebra of ")
if is_finite(group(A))
print(io, "dimension ", order(group(A)))
print(io, "dimension ", order(group(A)), " ")

Check warning on line 174 in src/AlgAss/AlgGrp.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgAss/AlgGrp.jl#L174

Added line #L174 was not covered by tests
else
print(io, "infinite dimension ")
end
print(io, " over ", base_ring(A))
else
print(io, "Group algebra of group ")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is independent of this PR, but I was surprised by this show method:

  • terse prints "Group algebra of dimension 10 over QQ"
  • non-terse prints "Group algebra of group of order 10 over QQ"

So the "terse" mode is indeed a little bit shorter, but I wonder why even bother in this case to have two different outputs?

Copy link
Owner

Choose a reason for hiding this comment

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

makes sense

if is_finite(group(A))
print(io, "of order ", order(group(A)), " ")
else
print(io, "of infinite order ")
end
print(io, "over ")
print(terse(io), base_ring(A))
io = terse(io)
thofma marked this conversation as resolved.
Show resolved Hide resolved
end
print(io, "over ", Lowercase(), base_ring(A))
end

################################################################################
Expand Down
2 changes: 1 addition & 1 deletion src/GenOrd/GenOrd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ julia> k, a = quadratic_field(12);

julia> integral_closure(ZZ, k)

Maximal order of Real quadratic field defined by x^2 - 12
Maximal order of real quadratic field defined by x^2 - 12
with basis AbsSimpleNumFieldElem[1, 1//2*sqrt(12)]
```
"""
Expand Down
20 changes: 16 additions & 4 deletions src/NumFieldOrd/NfOrd/NfOrd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@
################################################################################

function show(io::IO, S::AbsNumFieldOrderSet)
io = pretty(io)

Check warning on line 197 in src/NumFieldOrd/NfOrd/NfOrd.jl

View check run for this annotation

Codecov / codecov/patch

src/NumFieldOrd/NfOrd/NfOrd.jl#L197

Added line #L197 was not covered by tests
print(io, "Set of orders of the number field ")
print(io, S.nf)
print(io, Lowercase(), S.nf)

Check warning on line 199 in src/NumFieldOrd/NfOrd/NfOrd.jl

View check run for this annotation

Codecov / codecov/patch

src/NumFieldOrd/NfOrd/NfOrd.jl#L199

Added line #L199 was not covered by tests
end

function extra_name(O::AbsNumFieldOrder)
Expand All @@ -217,14 +218,25 @@
end

function show_gen(io::IO, O::AbsNumFieldOrder)
io = pretty(io)

Check warning on line 221 in src/NumFieldOrd/NfOrd/NfOrd.jl

View check run for this annotation

Codecov / codecov/patch

src/NumFieldOrd/NfOrd/NfOrd.jl#L221

Added line #L221 was not covered by tests
print(io, "Order of ")
println(io, nf(O))
println(io, Lowercase(), nf(O))

Check warning on line 223 in src/NumFieldOrd/NfOrd/NfOrd.jl

View check run for this annotation

Codecov / codecov/patch

src/NumFieldOrd/NfOrd/NfOrd.jl#L223

Added line #L223 was not covered by tests
print(io, "with Z-basis ")
print(io, basis(O, copy = false))
b = basis(O, copy = false)

Check warning on line 225 in src/NumFieldOrd/NfOrd/NfOrd.jl

View check run for this annotation

Codecov / codecov/patch

src/NumFieldOrd/NfOrd/NfOrd.jl#L225

Added line #L225 was not covered by tests
# use `typeinfo` in IOContext to change e.g. `AbsSimpleNumFieldElem[1, a, a^2]`
# to `[1, a, a^2]` when printing the base
print(IOContext(terse(io), :typeinfo=>typeof(b)), b)

Check warning on line 228 in src/NumFieldOrd/NfOrd/NfOrd.jl

View check run for this annotation

Codecov / codecov/patch

src/NumFieldOrd/NfOrd/NfOrd.jl#L228

Added line #L228 was not covered by tests
thofma marked this conversation as resolved.
Show resolved Hide resolved
end

function show_maximal(io::IO, O::AbsNumFieldOrder)
print(io, "Maximal order of $(nf(O)) \nwith basis $(O.basis_nf)")
io = pretty(io)
print(io, "Maximal order of ")
println(io, Lowercase(), nf(O))
print(io, "with basis ")
b = O.basis_nf
# use `typeinfo` in IOContext to change e.g. `AbsSimpleNumFieldElem[1, a, a^2]`
# to `[1, a, a^2]` when printing the base
print(IOContext(terse(io), :typeinfo=>typeof(b)), b)
end

################################################################################
Expand Down
3 changes: 2 additions & 1 deletion src/NumFieldOrd/NfOrd/ResidueRing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
################################################################################

function show(io::IO, Q::AbsOrdQuoRing)
print(io, "Quotient of $(Q.base_ring)")
io = pretty(io)
print(io, "Quotient of ", Lowercase(), Q.base_ring)

Check warning on line 81 in src/NumFieldOrd/NfOrd/ResidueRing.jl

View check run for this annotation

Codecov / codecov/patch

src/NumFieldOrd/NfOrd/ResidueRing.jl#L80-L81

Added lines #L80 - L81 were not covered by tests
end

function AbstractAlgebra.expressify(x::AbsOrdQuoRingElem; context = nothing)
Expand Down
Loading