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

Start revising printing of modules #3199

Closed
Closed
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 docs/src/CommutativeAlgebra/GroebnerBases/groebner_bases.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ julia> default_ordering(R)
degrevlex([x, y, z])

julia> F = free_module(R, 2)
Free module of rank 2 over Multivariate polynomial ring in 3 variables over QQ
Free module of rank 2 over multivariate polynomial ring

julia> default_ordering(F)
degrevlex([x, y, z])*lex([gen(1), gen(2)])
Expand Down Expand Up @@ -140,7 +140,7 @@ julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y])

julia> F = free_module(R, 3)
Free module of rank 3 over Multivariate polynomial ring in 2 variables over QQ
Free module of rank 3 over multivariate polynomial ring

julia> f = (5*x*y^2-y^10+3)*F[1]+(4*x^3+2*y) *F[2]+16*x*F[3]
(5*x*y^2 - y^10 + 3)*e[1] + (4*x^3 + 2*y)*e[2] + 16*x*e[3]
Expand Down
2 changes: 1 addition & 1 deletion docs/src/CommutativeAlgebra/GroebnerBases/orderings.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ basis vectors as *lex*, and to the $i > j$ ordering as *invlex*. And, we use the
julia> R, (w, x, y, z) = polynomial_ring(QQ, ["w", "x", "y", "z"]);

julia> F = free_module(R, 3)
Free module of rank 3 over Multivariate polynomial ring in 4 variables over QQ
Free module of rank 3 over multivariate polynomial ring

julia> o1 = degrevlex(R)*invlex(gens(F))
degrevlex([w, x, y, z])*invlex([gen(1), gen(2), gen(3)])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,21 @@ julia> range(C)
5:-1:3

julia> C[5]
Subquotient of Submodule with 1 generator
Subquotient of submodule with 1 generator
1 -> e[1]
by Submodule with 1 generator
by submodule with 1 generator
1 -> x^4*e[1]

julia> delta = map(C, 5)
Map with following data
Domain:
=======
Subquotient of Submodule with 1 generator
1 -> e[1]
by Submodule with 1 generator
1 -> x^4*e[1]
Codomain:
=========
Subquotient of Submodule with 1 generator
1 -> e[1]
by Submodule with 1 generator
1 -> x^3*e[1]
Module homomorphism
from subquotient of submodule with 1 generator
1 -> e[1]
by submodule with 1 generator
1 -> x^4*e[1]
to subquotient of submodule with 1 generator
1 -> e[1]
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe this should use Indent() ?

Suggested change
1 -> e[1]
1 -> e[1]

Copy link
Member Author

Choose a reason for hiding this comment

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

Can't do that right now because it runs into a bug in pretty printing, see Nemocas/AbstractAlgebra.jl#1561

by submodule with 1 generator
1 -> x^3*e[1]

julia> matrix(delta)
[x^2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ julia> f = x*F[1] + y*F[3]
x*e[1] + y*e[3]

julia> parent(f)
Free module of rank 3 over Multivariate polynomial ring in 2 variables over QQ
Free module of rank 3 over multivariate polynomial ring

julia> coordinates(f)
Sparse row with positions [1, 3] and values QQMPolyRingElem[x, y]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z])

julia> F = free_module(R, 1)
Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
Free module of rank 1 over multivariate polynomial ring

julia> A = R[x; y]
[x]
Expand All @@ -98,10 +98,10 @@ julia> B = R[x^2; y^3; z^4]
[z^4]

julia> M = SubquoModule(F, A, B)
Subquotient of Submodule with 2 generators
Subquotient of submodule with 2 generators
1 -> x*e[1]
2 -> y*e[1]
by Submodule with 3 generators
by submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
Expand Down Expand Up @@ -136,9 +136,9 @@ julia> relations(M)
z^4*e[1]

julia> ambient_module(M)
Subquotient of Submodule with 1 generator
Subquotient of submodule with 1 generator
1 -> e[1]
by Submodule with 3 generators
by submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
Expand Down Expand Up @@ -181,7 +181,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z])

julia> F = free_module(R, 1)
Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
Free module of rank 1 over multivariate polynomial ring

julia> A = R[x; y]
[x]
Expand All @@ -193,10 +193,10 @@ julia> B = R[x^2; y^3; z^4]
[z^4]

julia> M = SubquoModule(F, A, B)
Subquotient of Submodule with 2 generators
Subquotient of submodule with 2 generators
1 -> x*e[1]
2 -> y*e[1]
by Submodule with 3 generators
by submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
Expand Down Expand Up @@ -237,7 +237,7 @@ julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z])

julia> F = free_module(R, 1)
Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
Free module of rank 1 over multivariate polynomial ring

julia> A = R[x; y]
[x]
Expand All @@ -249,10 +249,10 @@ julia> B = R[x^2; y^3; z^4]
[z^4]

julia> M = SubquoModule(F, A, B)
Subquotient of Submodule with 2 generators
Subquotient of submodule with 2 generators
1 -> x*e[1]
2 -> y*e[1]
by Submodule with 3 generators
by submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
Expand All @@ -261,10 +261,10 @@ julia> m = z*M[1] + M[2]
(x*z + y)*e[1]

julia> parent(m)
Subquotient of Submodule with 2 generators
Subquotient of submodule with 2 generators
1 -> x*e[1]
2 -> y*e[1]
by Submodule with 3 generators
by submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
Expand All @@ -285,7 +285,7 @@ julia> parent(fm) === ambient_free_module(M)
true

julia> F = ambient_free_module(M)
Free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
Free module of rank 1 over multivariate polynomial ring

julia> f = x*F[1]
x*e[1]
Expand Down
16 changes: 8 additions & 8 deletions experimental/Schemes/CoherentSheaves.jl
Original file line number Diff line number Diff line change
Expand Up @@ -722,10 +722,10 @@ Coherent sheaf of modules
3: [(s0//s2), (s1//s2), (s3//s2)] affine 3-space
4: [(s0//s3), (s1//s3), (s2//s3)] affine 3-space
with restrictions
1: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
2: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
3: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
4: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
1: free module of rank 1 over multivariate polynomial ring
2: free module of rank 1 over multivariate polynomial ring
3: free module of rank 1 over multivariate polynomial ring
4: free module of rank 1 over multivariate polynomial ring
```
"""
function twisting_sheaf(IP::AbsProjectiveScheme{<:Field}, d::Int)
Expand Down Expand Up @@ -783,10 +783,10 @@ Coherent sheaf of modules
3: [(s0//s2), (s1//s2), (s3//s2)] affine 3-space
4: [(s0//s3), (s1//s3), (s2//s3)] affine 3-space
with restrictions
1: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
2: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
3: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
4: free module of rank 1 over Multivariate polynomial ring in 3 variables over QQ
1: free module of rank 1 over multivariate polynomial ring
2: free module of rank 1 over multivariate polynomial ring
3: free module of rank 1 over multivariate polynomial ring
4: free module of rank 1 over multivariate polynomial ring
```
"""
function tautological_bundle(IP::AbsProjectiveScheme{<:Field})
Expand Down
9 changes: 5 additions & 4 deletions src/Modules/FreeModules-graded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ function show(io::IO, F::FreeModule_dec)
@show_name(io, F)
@show_special(io, F)

io_compact = IOContext(io, :compact => true, :supercompact => true)
print(io, "Free module of rank $(length(F.d)) over ")
print(IOContext(io, :compact =>true), F.R)
print(io_compact, F.R)
if is_graded(F.R)
print(io, ", graded as ")
else
Expand All @@ -92,7 +93,7 @@ function show(io::IO, F::FreeModule_dec)
else
first = false
end
print(IOContext(io, :compact => true), F.R, "^$v(", k, ")")
print(io_compact, F.R, "^$v(", k, ")")
end

#=
Expand All @@ -103,8 +104,8 @@ function show(io::IO, F::FreeModule_dec)
while i+j <= dim(F) && d == F.d[i+j]
j += 1
end
print(IOContext(io, :compact => true), F.R, "^$j")
print(IOContext(io, :compact => true), "(", -d, ")")
print(io_compact, F.R, "^$j")
print(io_compact, "(", -d, ")")
if i+j < dim(F)
print(io, " + ")
end
Expand Down
6 changes: 3 additions & 3 deletions src/Modules/ModuleTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y])

julia> F = free_module(R, 3)
Free module of rank 3 over Multivariate polynomial ring in 2 variables over QQ
Free module of rank 3 over multivariate polynomial ring

julia> f = F(sparse_row(R, [(1,x),(3,y)]))
x*e[1] + y*e[3]
Expand Down Expand Up @@ -272,10 +272,10 @@ julia> B = R[x^2; x*y; y^2; z^4]
[z^4]

julia> M = SubquoModule(A, B)
Subquotient of Submodule with 2 generators
Subquotient of submodule with 2 generators
1 -> x*e[1]
2 -> y*e[1]
by Submodule with 4 generators
by submodule with 4 generators
1 -> x^2*e[1]
2 -> x*y*e[1]
3 -> y^2*e[1]
Expand Down
Loading
Loading