Skip to content

Commit

Permalink
Lift std (#313)
Browse files Browse the repository at this point in the history
* better support for lift_std

- a native version for ideals (as opposed to modules)
- with/out syzygies
- with/out complete_reduction
  • Loading branch information
fieker committed Dec 23, 2020
1 parent 2a3692f commit b64e3f1
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 4 deletions.
8 changes: 8 additions & 0 deletions docs/src/ideal.md
Expand Up @@ -252,6 +252,14 @@ fglm(::sideal, ::Symbol)
satstd{T <: AbstractAlgebra.RingElem}(::sideal{T}, ::sideal{T})
```

```@docs
lift_std(::sideal; ::Bool)
```

```@docs
lift_std_syz(::sideal; ::Bool)
```

**Examples**

```julia
Expand Down
7 changes: 7 additions & 0 deletions docs/src/module.md
Expand Up @@ -108,6 +108,13 @@ d = ngens(M)
std(::smodule; ::Bool)
```

```@docs
lift_std(::smodule; ::Bool)
```

```@docs
lift_std_syz(::smodule; ::Bool)
```
**Examples**

```julia
Expand Down
31 changes: 31 additions & 0 deletions src/ideal/ideal.jl
Expand Up @@ -521,6 +521,37 @@ function syz(I::sideal)
return Module(R, ptr)
end

###############################################################################
#
# LiftStd
#
###############################################################################

@doc Markdown.doc"""
lift_std_syz(I::sdeal)
computes the Groebner base G of I, the transformation matrix T and the syzygies of M.
Returns G,T,S
(Matrix(G) = Matrix(I) * T, 0=Matrix(M)*Matrix(S))
"""
function lift_std_syz(M::sideal; complete_reduction::Bool = false)
R = base_ring(M)
ptr,T_ptr,S_ptr = libSingular.id_LiftStdSyz(M.ptr, R.ptr, complete_reduction)
return Ideal(R, ptr), smatrix{elem_type(R)}(R, T_ptr), Module(R,S_ptr)
end

@doc Markdown.doc"""
lift_std(I::sideal)
computes the Groebner base G of I and the transformation matrix T such that
(Matrix(G) = Matrix(I) * T)
"""
function lift_std(M::sideal; complete_reduction::Bool = false)
R = base_ring(M)
ptr,T_ptr = libSingular.id_LiftStd(M.ptr, R.ptr, complete_reduction)
return Ideal(R, ptr), smatrix{elem_type(R)}(R, T_ptr)
end

###############################################################################
#
# Resolutions
Expand Down
20 changes: 16 additions & 4 deletions src/module/module.jl
Expand Up @@ -285,18 +285,30 @@ end
###############################################################################

@doc Markdown.doc"""
lift_std(M::smodule)
lift_std_syz(M::smodule)
computes the Groebner base G of M, the transformation matrix T and the syzygies of M.
Returns G,T,S
(Matrix(G) = (Matrix(T)*Matrix(M), 0=Matrix(S)*Matrix(M))
(Matrix(G) = Matrix(M) * T, 0=Matrix(M)*Matrix(S))
"""
function lift_std(M::smodule)
function lift_std_syz(M::smodule; complete_reduction::Bool = false)
R = base_ring(M)
ptr,T_ptr,S_ptr = libSingular.id_LiftStd(M.ptr, R.ptr)
ptr,T_ptr,S_ptr = libSingular.id_LiftStdSyz(M.ptr, R.ptr, complete_reduction)
return Module(R, ptr), smatrix{elem_type(R)}(R, T_ptr), Module(R,S_ptr)
end

@doc Markdown.doc"""
lift_std(M::smodule)
computes the Groebner base G of M and the transformation matrix T such that
(Matrix(G) = Matrix(M) * T)
"""
function lift_std(M::smodule; complete_reduction::Bool = false)
R = base_ring(M)
ptr,T_ptr = libSingular.id_LiftStd(M.ptr, R.ptr, complete_reduction)
return Module(R, ptr), smatrix{elem_type(R)}(R, T_ptr)
end

###############################################################################
#
# Modulo
Expand Down
29 changes: 29 additions & 0 deletions test/ideal/sideal-test.jl
Expand Up @@ -337,3 +337,32 @@ end
@test typeof(L2) == Array{Array{spoly{n_Q}, 1}, 1}
end

@testset "sideal.lift_std..." begin
R, (x, y) = PolynomialRing(QQ, ["x", "y"])

I = Ideal(R, x, y)
G, T = Singular.lift_std(I)
@test G[1] == y
@test G[2] == x
@test T[1,1] == 0
@test T[2,2] == 0
@test T[2,1] == 1
@test T[1,2] == 1

G, T = Singular.lift_std(I, complete_reduction = true)
@test G[1] == y
@test G[2] == x
@test T[1,1] == 0
@test T[2,2] == 0
@test T[2,1] == 1
@test T[1,2] == 1

G, T, S = Singular.lift_std_syz(I)
mG = Singular.Matrix(G)
mI = Singular.Matrix(I)
mS = Singular.Matrix(S)
@test iszero(mI*mS)
# @test mI*T == mG
# should be true, but there are additional (invisible) zeros in G
# causing a dimension mismatch
end

0 comments on commit b64e3f1

Please sign in to comment.