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

add radical and prepare for more #103

Closed
wants to merge 1 commit into from
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
56 changes: 56 additions & 0 deletions deps/src/ideals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,54 @@ auto id_Std_helper(ideal a, ring b, bool complete_reduction = false)
return id;
}

auto id_Radical_helper(ideal a, ring b)
{
ideal id = NULL;
if (!idIs0(a))
{
id = ii_CallProcId2Id("primdec.lib","radical",a,b);
}
else
id = idInit(0, a->rank);
return id;
}

auto id_RadicalZ_helper(ideal a, ring b)
{
ideal id = NULL;
if (!idIs0(a))
{
id = ii_CallProcId2Id("primdecint.lib","radicalZ",a,b);
}
else
id = idInit(0, a->rank);
return id;
}

auto id_equiRadical_helper(ideal a, ring b)
{
ideal id = NULL;
if (!idIs0(a))
{
id = ii_CallProcId2Id("primdec.lib","equiRadical",a,b);
}
else
id = idInit(0, a->rank);
return id;
}

auto id_equidimMax_helper(ideal a, ring b)
{
ideal id = NULL;
if (!idIs0(a))
{
id = ii_CallProcId2Id("primdec.lib","equidimMax",a,b);
}
else
id = idInit(0, a->rank);
return id;
}

void singular_define_ideals(jlcxx::Module & Singular)
{
Singular.method("id_Delete",
Expand All @@ -123,6 +171,10 @@ void singular_define_ideals(jlcxx::Module & Singular)

Singular.method("idElem", &idElem);

Singular.method("id_equiRadical", &id_equiRadical_helper);

Singular.method("id_equidimMax", &id_equidimMax_helper);

Singular.method("id_Normalize", &id_Normalize);

Singular.method("id_Head", &id_Head);
Expand Down Expand Up @@ -174,6 +226,10 @@ void singular_define_ideals(jlcxx::Module & Singular)

Singular.method("id_Std", &id_Std_helper);

Singular.method("id_Radical", &id_Radical_helper);

Singular.method("id_RadicalZ", &id_RadicalZ_helper);

Singular.method("id_Eliminate", [](ideal m, poly p, ring o) {
const ring origin = currRing;
rChangeCurrRing(o);
Expand Down
4 changes: 4 additions & 0 deletions docs/src/ideal.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ isvar_generated(::sideal)
normalize!(::sideal)
```

```@docs
radical(::sideal)
```

**Examples**

```
Expand Down
13 changes: 12 additions & 1 deletion src/ideal/ideal.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export sideal, IdealSet, syz, lead, normalize!, isconstant, iszerodim, fres,
highcorner, jacobi, jet, kbase, ngens, sres, intersection, quotient,
reduce, eliminate, kernel, equal, contains, isvar_generated, saturation,
satstd, slimgb, std, vdim
satstd, slimgb, std, vdim, radical

###############################################################################
#
Expand Down Expand Up @@ -335,6 +335,17 @@ function std(I::sideal; complete_reduction::Bool=false)
return z
end

@doc Markdown.doc"""
radical(I::sideal)
> Compute for thedical of an ideal $I$.
"""
function radical(I::sideal)
R = base_ring(I)
ptr = libSingular.id_Radical(I.ptr, R.ptr)
z = Ideal(R, ptr)
return z
end

@doc Markdown.doc"""
satstd{T <: AbstractAlgebra.RingElem}(I::sideal{T}, J::sideal{T})
> Given an ideal $J$ generated by variables, computes a standard basis of
Expand Down