oscar-system / Singular.jl

Julia package for the Singular library
Other
31 stars 33 forks source link

missing Singular kernel functions #59

Open ThomasBreuer opened 5 years ago

ThomasBreuer commented 5 years ago

I have tried to reimplement some of the functionality of Singular's finvar.lib, using GAP and its package GAPJulia for calling Singular.jl, but some of the Singular kernel features seem to be missing.

Did I overlook something, or are these functions not available via Singular.jl? Of course I can implement these functions in GAP (or Julia), and then use Singular itself essentially for Groebner basis computations; is this a recommended way to proceed?

wbhart commented 5 years ago

Singular.jl is currently being rewritten (see the cxx_wrap branch).

After we have it working again, we will switch over the code to run on Julia-1.0.

After that, we will start to fill out the kernel interface. We have a HiWi doing the above, so it could be some months before we get there.

sebasguts commented 5 years ago

@wbhart Can you give a more precise (i.e., calendar week number) estimate on which date we will be able to use Singular.jl again? The new GAP interface only works with a Julia that contains @rbehrends patch, so it is unusable with Singular.jl, potentially until some time next year?

wbhart commented 5 years ago

We will have someone work on it for ostensibly 3 months starting this coming Thursday. I will possibly find some time to put into it, but I can't guarantee that.

wbhart commented 5 years ago

Sorry for the delay in updating everyone. This was quite difficult to sort out since it implied finding someone (else) to work on it.

We have agreed to get n_Q, spoly and sideal working with CxxWrap and Julia-1.0, up to an including std, by the time of our meeting in November. Barring any unforeseen obstacles, this should be possible given the manpower we currently have.

Sachin Mohan will be working on this, together with Andreas Steenpas. Our first meeting to discuss how to do the job is tomorrow at 4pm.

In the mean time, I will work on reestablishing support for Nemo coefficients as Singular coefficient rings, using the new CxxWrap interface we've been writing over the past few months (though not immediately, as I have other commitments right at this moment).

The work has been progressing very slowly as we only had a HiWi working on it 8 hours per week (you have to multiply every time estimate by 5 when comparing with a full time worker, and then make an adjustment for the level of experience).

Our HiWi will be cutting back to 4 hours per week over the next month, due to exams, hence the addition of Andreas Steenpas to the effort.

wbhart commented 5 years ago

We've opened issue #60 for the update to Julia-1.0, which is a prerequisite to resolve this issue. Our meeting today went well, and I this is all underway now. Updates will continue at issue #60, until we are ready to get back to this issue.

fingolfin commented 3 years ago

@ThomasBreuer do you know what the status of this issue is?

ThomasBreuer commented 3 years ago

There is dimension for computing the Krull dimension of the quotient of a polynomial ring by an ideal, and substitutions can be computed with evaluate; at the moment I do not see how to get the minbase functionality.

fieker commented 3 years ago

What is the goal? In Oscar we have function vector_space(K::AbstractAlgebra.Field, e::Array{T, 1}; target = nothing) where {T <: MPolyElem}

which will give the VS generated by the polynomials. In Oscar/examples is function Oscar.monomials(R::MPolyRing, d::Int)

is the goal to re-write the .lib in Singular.jl or in Oscar? minbase looks difficult as it seems to be also affected by global variables...

hannes14 commented 3 years ago

degBound affects all Groebner base computaions in Singular, not only minbase: if your ideal is homogeneous, a partial GB (up toi degree degBound) is returned. This can save you time IF you know that the result has at most degree degBound. Not setting7using degBound willl also return the correct result, but needs mor time.

fingolfin commented 2 years ago

@ThomasBreuer what's the status of this issue? is there still something concrete you are missing? By now, calling Singular library functions should be possible (and we do so in Oscar)

ThomasBreuer commented 2 years ago

@fingolfin As far as I understand, minbase is a Singular kernel function, not a library function. At the time when I opened this issue (three years ago), the idea was to use the GAP interface to Julia for using Singular functionality from GAP, and this worked via the machinery from GAP's Homalg package(s) but not via Singular.jl. (see the files GAP.jl/pkg/JuliaExperimental/gap/finvar.g*). Independent of this old GAP code, the question would be what is the recommended way to get the minbase results in Oscar.

fingolfin commented 2 years ago

minbase is implemented by the Singular kernel function idMinBase which is wrapped in libsingular-julia, and then called in Singular.jl by two methods for minimal_generating_set() (once for ideals and once for modules).

However, you (well, finvar.lib need it with degBound set. OK, so it took some time to trace this, but I believe this is the "sysvar" with id VMAXDEG and corresponds to the global variable Kstd1_deg in the Singular kernel. Since it is a global variable, using it is dangerous, as one must not forget to restore it else unexpected things can happen in code elsewhere. It is set by the interpreter C function jjMAXDEG which also enables/disables the global option OPT_DEGBOUND depending on whether the bound is zero or not.

As far as I could tell, there is no corresponding function in libsingular-julia right now (but maybe @hannes14 or @tthsqe12 know more).


For dim on an ideal, I think you can use dimension().


For "substitutions of indeterminates by linear combinations thereof" I think AlgebraHomomorphism can do it.

tthsqe12 commented 2 years ago

So the goal here is be able to repoduce the following singular code?

  int DEGB = degBound;
  degBound=d;
...
      B=minbase(B);
      degBound=DEGB;
      return(B);

Indeed, degBound is one of those global system variables, and is named VMAXDEG. The julia version could look like the following?

DEGB = Singular.set_deg_bound(d) # return the old value, also sets/clears OPT_DEGBOUND as in jjMAXDEG
... minimal_generating_set(...)
Singular.set_deg_bound(DEGB)

I actually don't like giving the user access to these global variables because now everyone has to also keep track of the state of them, which is just a headache. If there aren't too many functions that one would want to use with the non-default value of this global variable, could we just add the degree bound in as a second argument to minimal_generating_set?

tthsqe12 commented 2 years ago

What do we want here? I can see three possibilities:

  1. give the user unrestricted access to singular's global variables :(
  2. provide a minimal_generating_set(I::sideal, deg_bound::Int) which sets and resets the global variable internally
  3. provide a general with_deg_bound(d) do f in a do-block syntax for setting and resetting the global variable automatically in an arbitrary block of code.
hannes14 commented 2 years ago

I prefer 2, as deg_boud needs really "to know what you do".

tthsqe12 commented 2 years ago

I am doing the third option in #527, which can be used to easily implement stuff like the second option without making changes to libsingular-julia.