Changeset a9d624 in git


Ignore:
Timestamp:
Sep 8, 2005, 2:47:18 PM (19 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
a171c0db5983b1b21803816bbc2059e6a2c2c01c
Parents:
d964f9729f190e72c24a8391d0e7b4ab964543a2
Message:
*bricken: converters


git-svn-id: file:///usr/local/Singular/svn/trunk@8602 2c84dea3-7e68-4137-9b89-c4e89433aadc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • kernel/Ideal.h

    rd964f9 ra9d624  
    11#ifndef IDEAL_CPP_HEADER
    22#define IDEAL_CPP_HEADER
    3 //$Id: Ideal.h,v 1.1 2005-09-08 12:07:20 bricken Exp $
     3//$Id: Ideal.h,v 1.2 2005-09-08 12:47:04 bricken Exp $
    44#include "Poly.h"
     5#include "ideals.h"
    56//base for ideals as well for modules
    67
     
    4344   return storage.end();
    4445 }
    45  size_type size(){
     46 size_type size() const{
    4647   return storage.size();
    4748 }
     
    6162   return insert(__pos,__first,__last);
    6263 }
     64
    6365};
    6466
     
    6870  Ideal(){
    6971  }
     72  Ideal(ideal i, ring r){
     73    for(int j=0;j<IDELEMS(i);j++){
     74      storage.push_back(Poly(i->m[j],r));
     75    }
     76  }
    7077  Ideal(iterator first,
    7178        iterator last,
     
    7380    IdealBase<Poly>(first,last,__a){
    7481  }
     82 ideal as_ideal() const{
     83   //no checks for rings
     84   int s=size();
     85   ideal result=idInit(s);
     86   
     87   for(int i=0;i<s;i++){
     88     result->m[i]=storage[i].as_poly();
     89   }
     90   return result;
     91 }
    7592};
    7693class Modul:
  • modules/python/ideal_wrap.cc

    rd964f9 ra9d624  
    1616  int i;
    1717  int s=p.size();
    18   tojoin.append("[");
     18  //tojoin.append("[");
    1919  for(i=0;i<s;i++){
    2020    tojoin.append(Poly_as_str(p[i]));
     
    2222      tojoin.append(", ");
    2323  }
    24   tojoin.append("]");
     24  //tojoin.append("]");
    2525  str res=helper.join(tojoin);
    2626  return res;
  • modules/python/interpretertester

    rd964f9 ra9d624  
    3939  return(m);
    4040}
    41 python_module::python("from Singular import number,  polynomial, interpreter_id, get_idhdl,call_interpreter_method, i_arg_list, gen
     41python_module::python("from Singular import number,  polynomial, interpreter_id, get_idhdl,call_interpreter_method, i_arg_list, gen, ideal
    4242
    4343from interpreter import global_functions
     
    4646x=polynomial('x')
    4747y=polynomial('y')
     48i=ideal()
     49i.append(x)
     50i.append(x+y)
     51print i
     52print functions.groebner(i);
    4853xy=x*y
    4954
  • modules/python/wrapper.h

    rd964f9 ra9d624  
    1 //$Id: wrapper.h,v 1.25 2005-09-08 11:45:23 bricken Exp $
     1//$Id: wrapper.h,v 1.26 2005-09-08 12:47:18 bricken Exp $
    22#ifndef PYTHON_SINGULAR_WRAPPER_HEADER
    33#define PYTHON_SINGULAR_WRAPPER_HEADER
     
    1818#include "Poly.h"
    1919#include "PowerSeries.h"
     20#include "Ideal.h"
    2021#include "ideal_wrap.h"
    2122#include <factory.h>
     
    7273    v->data=p.as_poly();
    7374    v->rtyp=POLY_CMD;
     75    internal_append(v);
     76  }
     77  void appendIdeal(const Ideal& p){
     78    leftv v=initArg();
     79    v->data=p.as_ideal();
     80    v->rtyp=IDEAL_CMD;
    7481    internal_append(v);
    7582  }
     
    147154   
    148155    return to_python_value<Vector>()( Vector((poly) v->data, currRing));
     156  case IDEAL_CMD:
     157    return to_python_value<Ideal>()(Ideal((ideal) v->data, currRing));
    149158  case  NUMBER_CMD:
    150159 
     
    211220    .def("append", &arg_list::appendArray)
    212221    .def("append", &arg_list::appendNumber)
    213    .def("append", &arg_list::appendint)
    214    .def("append", &arg_list::appendVector);
     222    .def("append", &arg_list::appendint)
     223    .def("append", &arg_list::appendIdeal)
     224    .def("append", &arg_list::appendVector);
    215225  boost::python::class_<idhdl_wrap>("interpreter_id")
    216226    .def("is_zero", &idhdl_wrap::is_zero)
Note: See TracChangeset for help on using the changeset viewer.