Changeset 92a473 in git
- Timestamp:
- Sep 21, 2005, 9:13:10 AM (19 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- d83bbe1632a5e0ab0676e4581f6f2e91fae7b383
- Parents:
- 8062aa63166d4d1d159c8cd2c00a2baf0be49271
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/Ideal.h
r8062aa r92a473 1 1 #ifndef IDEAL_CPP_HEADER 2 2 #define IDEAL_CPP_HEADER 3 //$Id: Ideal.h,v 1. 5 2005-09-20 07:18:18bricken Exp $3 //$Id: Ideal.h,v 1.6 2005-09-21 07:13:10 bricken Exp $ 4 4 #include <vector> 5 5 #include "Poly.h" … … 26 26 { 27 27 28 } 29 ring getRing() const{ 30 //FIXME: is a hack 31 if (size()>0){ 32 return storage[0].getRing(); 33 } 34 else 35 return (ring) NULL; 28 36 } 29 37 poly_type& operator[] (int n){ -
modules/openmathserver/polyd.py
r8062aa r92a473 10 10 groebnersym=OMSymbol("groebner",content) 11 11 DMPsym=OMSymbol("DMP",content) 12 DMPLsym=OMSymbol("DMPL",content) 12 13 SDMPsym=OMSymbol("SDMP",content) 13 14 termsym=OMSymbol("term", content) 15 dpsym=OMSymbol("graded_reverse_lexicographic", content) 16 lpsym=OMSymbol("lexicographic", content) 17 14 18 poly_ring_dsym=OMSymbol("poly_ring_d",content) 15 19 def groebnerfunc(context, *args): -
modules/openmathserver/singularom.py
r8062aa r92a473 2 2 from interpreter import * 3 3 from objects import * 4 from polyd import DMPsym, SDMPsym, termsym 4 from polyd import DMPsym, SDMPsym, termsym, lpsym,dpsym,poly_ring_dsym, DMPLsym 5 from fieldname1 import Qsym as Rationals 5 6 singular=singular_globals_proxy() 7 class SingularException(Exception): 8 pass 9 6 10 def encodePoly(p): 7 11 terms=[encodeTerm(t) for t in p] 8 12 return OMApply(SDMPsym,terms) 9 13 14 def encodePolyWithRing(p): 15 """FIXME: just encodes currentRing""" 16 p=encodePoly(p) 17 r=encodeRing(ring()) 18 return OMApply(DMPsym,[r,p]) 19 20 21 orderingTable={ 22 "lp": lpsym, 23 "dp": dpsym 24 } 25 def encodeOrdering(r): 26 rl=singular.ringlist(r) 27 return orderingTable[rl[2][0][0]] 28 29 def encodeField(r): 30 char=singular.char(r) 31 if char==0 and singular.npars(r)==0: 32 return Rationals 33 else: 34 raise SingularException("unknown field to encode") 35 36 def encodeIdeal(i): 37 """FIXME: uses only currentRing""" 38 r=encodeRing(ring()) 39 return OMApply(DMPLsym,[r]+[encodePoly(p) for p in i]) 40 def encodeRing(r): 41 nv=singular.nvars(r) 42 f=encodeField(r) 43 return OMApply(poly_ring_dsym,[f,OMint(nv)]) 44 10 45 def encodeTerm(t): 11 46 """FIXME: ugly because it uses slow interpreter interface""" -
modules/openmathserver/singulartest.sing
r8062aa r92a473 1 1 ring r=0,(x,y,z),lp; 2 2 poly f=37x3y+x2yz; 3 ideal i=f,f*f,f*f*f; 3 4 LIB("python_module.so"); 4 5 Python_module::python("from interpreter import singular_globals_proxy … … 6 7 from context import * 7 8 inter=singular_globals_proxy() 9 inter.r.set() 10 inter.__getattr__('print')(inter.f.ring()) 8 11 doc= encodePoly(inter.f) 9 #print doc10 #print doc.children11 12 context=Context() 13 output=context.XMLEncodeObject(doc) 14 print output 15 doc=encodeOrdering(singular.r) 16 output=context.XMLEncodeObject(doc) 17 print output 18 doc=encodeRing(singular.r) 19 output=context.XMLEncodeObject(doc) 20 print output 21 doc=encodePolyWithRing(singular.f) 22 output=context.XMLEncodeObject(doc) 23 print output 24 doc=encodeIdeal(singular.i) 25 output=context.XMLEncodeObject(doc) 26 print output 27 print 'semi encoding groebner basis' 28 doc=encodeIdeal(singular.groebner(singular.i)) 12 29 output=context.XMLEncodeObject(doc) 13 30 print output -
modules/python/ideal_wrap.cc
r8062aa r92a473 1 //$Id: ideal_wrap.cc,v 1. 5 2005-09-20 08:39:44bricken Exp $1 //$Id: ideal_wrap.cc,v 1.6 2005-09-21 07:12:48 bricken Exp $ 2 2 #include <poly_wrap.h> 3 3 #include <boost/python.hpp> … … 5 5 #include "Poly.h" 6 6 #include "Ideal.h" 7 #include "ring_wrap.h" 7 8 #include <boost/python/suite/indexing/vector_indexing_suite.hpp> 8 9 using boost::python::self; … … 27 28 return res; 28 29 } 30 static Ring Ideal_get_Ring(const Ideal & p){ 31 return p.getRing(); 32 } 29 33 30 34 … … 33 37 boost::python::class_<Ideal>("ideal") 34 38 .def("__str__", Ideal_as_str) 39 .def("ring",Ideal_get_Ring) 35 40 .def(boost::python::init <>()) 36 41 .def(vector_indexing_suite<Ideal >()); -
modules/python/poly_wrap.cc
r8062aa r92a473 3 3 #include "mod2.h" 4 4 #include "Poly.h" 5 #include "ring_wrap.h" 5 6 using boost::python::self; 6 7 boost::python::str Poly_as_str(const Poly& p) … … 12 13 return boost::python::str(out,strlen(out)); 13 14 } 15 static Ring Poly_get_Ring(const Poly & p){ 16 return p.getRing(); 17 } 14 18 void export_poly() 15 19 { 16 20 boost::python::class_<Poly>("polynomial") 21 .def("ring",Poly_get_Ring) 17 22 .def(boost::python::init <int>()) 18 23 .def(boost::python::init <Poly>()) -
modules/python/ring_wrap.cc
r8062aa r92a473 1 //$Id: ring_wrap.cc,v 1. 2 2005-09-20 08:39:44bricken Exp $1 //$Id: ring_wrap.cc,v 1.3 2005-09-21 07:12:48 bricken Exp $ 2 2 #include <poly_wrap.h> 3 3 #include <boost/python.hpp> … … 15 15 boost::python::class_<Ring>("ring") 16 16 .def("__str__", Ring_as_str) 17 .def("set", &Ring::set) 17 18 .def(boost::python::init <>()); 18 19 -
modules/python/ring_wrap.h
r8062aa r92a473 1 //$Id: ring_wrap.h,v 1. 4 2005-09-20 12:22:59bricken Exp $1 //$Id: ring_wrap.h,v 1.5 2005-09-21 07:12:48 bricken Exp $ 2 2 #ifndef RING_WRAP_HEADER 3 3 #define RING_WRAP_HEADER 4 #include "ring.h" 4 5 class Ring{ 5 6 public: … … 16 17 --(pimpl->ref); 17 18 } 19 void set(){ 20 rChangeCurrRing(pimpl); 21 } 18 22 }; 19 23 void export_ring();
Note: See TracChangeset
for help on using the changeset viewer.