Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#7194 closed enhancement (fixed)

extended singular functions interface

Reported by: PolyBoRi Owned by: malb
Priority: major Milestone: sage-4.3
Component: commutative algebra Keywords: singular
Cc: malb, burcin, hannes@… Merged in: sage-4.3.alpha1
Authors: Michael Brickenstein Reviewers: Martin Albrecht, Burcin Erocal
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by PolyBoRi)

wrapped list, use intvec as input, wrapped ring (RingWrap? for return)... This can wrap a lot more of Singular functions now.

This needs the header file lists.h, which is not installed by default.

Depends on #6909. After getting a new singular spkg, which includes the header, I consider this patch ready for review.

Cheers, Michael

Attachments (11)

singular_list.patch (10.1 KB) - added by PolyBoRi 13 years ago.
singular_list.2.patch (15.2 KB) - added by PolyBoRi 13 years ago.
singular_list.3.patch (17.7 KB) - added by PolyBoRi 13 years ago.
singular_list.4.patch (35.7 KB) - added by PolyBoRi 13 years ago.
singular_list.5.patch (42.3 KB) - added by PolyBoRi 13 years ago.
singular_list.6.patch (43.8 KB) - added by PolyBoRi 13 years ago.
singular_list.7.patch (27.0 KB) - added by PolyBoRi 13 years ago.
singular_list.8.patch (26.7 KB) - added by PolyBoRi 13 years ago.
singular_list.9.patch (27.0 KB) - added by PolyBoRi 13 years ago.
singular_lists_referee.patch (6.4 KB) - added by malb 13 years ago.
singular_list.10.patch (28.7 KB) - added by malb 13 years ago.
fixed to work with 4.3

Download all attachments as: .zip

Change History (28)

Changed 13 years ago by PolyBoRi

Changed 13 years ago by PolyBoRi

comment:1 Changed 13 years ago by PolyBoRi

I updated the patch. It now supports matrices as well :-). I also fixes some problem when returning polynomials. Cheers, Michael

P.S.: Next targets are intmat and letter place.

comment:2 Changed 13 years ago by PolyBoRi

Hi! A small demonstration of the copy and paste feature:

Singular:

proc content(f)
"USAGE:   content(f); f polynomial/vector
RETURN:  number, the content (greatest common factor of coefficients)
         of the polynomial/vector f
SEE ALSO: cleardenom
EXAMPLE: example content; shows an example
"
{
  if (f==0) { return(number(1)); }
  return(leadcoef(f)/leadcoef(cleardenom(f)));
}
example
{ "EXAMPLE:"; echo = 2;
   ring r=0,(x,y,z),(c,lp);
   content(3x2+18xy-27xyz);
   vector v=[3x2+18xy-27xyz,15x2+12y4,3];
   content(v);
}

Sage:

from sage.libs.singular.function import singular_function, lib
leadcoef =  singular_function("leadcoef")
cleardenom = singular_function("cleardenom")

def content(f):
    """
    Examples:
    sage: P.<x,y,z>=PolynomialRing(QQ)
    sage: content(3*x**2+18*x*y-27*x*y*z)
    -3
    """
    if f==0:
        return 1
    return leadcoef(f)/leadcoef(cleardenom(f))

Changed 13 years ago by PolyBoRi

comment:3 Changed 13 years ago by PolyBoRi

How to construct ring with parameters

P.<x,y,z>=PolynomialRing(QQ)
characteristic=0
number_of_variables=1
number_of_parameters=3
l=[
    [0, ['a','b','c'], [['dp', number_of_parameters*(1,)], ['C', (0,)]], P.ideal([0])]
, ['x', 'y', 'z'], [['dp', number_of_parameters*(1,)], ['C', (0,)]], P.ideal([0])]
ring=singular_function("ring")
ring(l, ring=P)

comment:4 Changed 13 years ago by PolyBoRi

how to make letter place sage: from sage.libs.singular.function import lib, singular_function sage: P.<x,y,z>=QQ[] sage: lib("freegb.lib") sage: make_letter_place_ring = singular_function("makeLetterplaceRing") sage: make_letter_place_ring(10, ring=P) <RingWrap?>

comment:5 Changed 13 years ago by PolyBoRi

sorry:

sage: from sage.libs.singular.function import lib, singular_function
sage: P.<x,y,z>=QQ[]
sage: lib("freegb.lib")
sage: 
sage: make_letter_place_ring = singular_function("makeLetterplaceRing")
sage: make_letter_place_ring(10, ring=P)
<RingWrap>

comment:6 Changed 13 years ago by PolyBoRi

  • Status changed from new to needs_work

the latest patch supports intvec/intmat Cheers, Michael

Changed 13 years ago by PolyBoRi

comment:7 Changed 13 years ago by PolyBoRi

  • Description modified (diff)

Changed 13 years ago by PolyBoRi

comment:8 Changed 13 years ago by PolyBoRi

the recent version wraps vectors over Pn in both direction. Now, I am about hunting the modules.

Changed 13 years ago by PolyBoRi

Changed 13 years ago by PolyBoRi

comment:9 Changed 13 years ago by PolyBoRi

  • Cc hannes@… added
  • Description modified (diff)
  • Summary changed from extended singular functions interface, needs work to extended singular functions interface

The latest version supports also modules and free resolution objects.

Free resolution objects form some lazy blackbox in Singular, so I just did some basic blackbox. The rest can be accessed via singular functions using this interface. So, we might extend Resolution object interface at some time, when it is needed. Cheers, Michael

Changed 13 years ago by PolyBoRi

Changed 13 years ago by PolyBoRi

comment:10 Changed 13 years ago by malb

A new SPKG installing Singular/lists.h is available here

http://sage.math.washington.edu/home/malb/spkgs/singular-3-1-0-4-20090818.p2.spkg

Changed 13 years ago by malb

comment:11 Changed 13 years ago by malb

  • Status changed from needs_work to needs_review

I give Michael's patch a positive review. However, somebody needs to review my documentation/cleanup patch and the SPKG.

How to apply:

comment:12 Changed 13 years ago by malb

  • Report Upstream set to N/A

Michael, Burcin, any takers for looking at my referee patch?

comment:13 Changed 13 years ago by burcin

  • Reviewers set to Martin Albrecht, Burcin Erocal
  • Status changed from needs_review to positive_review

Looks good to me.

comment:14 Changed 13 years ago by mhansen

  • Status changed from positive_review to needs_work

I get all sorts of Cython errors in function.pyx about cdef functions not being declared.

Did you try this on 4.3.alpha0?

Changed 13 years ago by malb

fixed to work with 4.3

comment:15 Changed 13 years ago by malb

I fixed the compilation failures under 4.3, strange that it compiled with 4.2. The instructions remain the same:

comment:16 Changed 13 years ago by mhansen

  • Merged in set to sage-4.3.alpha1
  • Resolution set to fixed
  • Status changed from needs_work to closed

comment:17 Changed 13 years ago by PolyBoRi

Thanks to all, who helped to get that code into Sage (while I was in holidays). You made me really happy :-).

Cheers, Michael

Note: See TracTickets for help on using tickets.