Changeset 5139d6 in git for modules/python


Ignore:
Timestamp:
Sep 23, 2005, 2:59:51 PM (19 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
Children:
f12ddcdde3136bd52030cdeef8ef6bf42ffd45f0
Parents:
ed394ae06b197dc56ef19044305263fc7d2b194f
Message:
*bricken: optimized


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

Legend:

Unmodified
Added
Removed
  • modules/python/interpreter_support.cc

    red394a r5139d6  
    1 //$Id: interpreter_support.cc,v 1.15 2005-09-20 08:39:44 bricken Exp $
     1//$Id: interpreter_support.cc,v 1.16 2005-09-23 12:59:30 bricken Exp $
    22#include <poly_wrap.h>
    33#include <sstream>
     
    157157    internal_append(v);
    158158  }
    159   void appendIntvec(better_intvec& iv){
     159  void appendIntvec(Intvec& iv){
    160160    leftv v=initArg();
    161161    v->data=iv.allocate_legacy_intvec_copy();
     
    258258    }
    259259  }
    260   void writeIntvec(const better_intvec& iv){
     260  void writeIntvec(const Intvec& iv){
    261261    if(id->typ=INTVEC_CMD){
    262262        delete id->data.iv;
     
    342342    return object(Ring((ring) v->data));
    343343  case INTVEC_CMD:
    344     return object(better_intvec(*(intvec*) v->data));
     344    return object(Intvec(*(intvec*) v->data));
    345345  default:
    346346   
     
    379379    return object(Ring((ring) id.id->data.uring));
    380380  case INTVEC_CMD:
    381     return object(better_intvec(*(intvec*) id.id->data.iv));
     381    return object(Intvec(*(intvec*) id.id->data.iv));
    382382  default:
    383383    return object();   
  • modules/python/intvec_wrap.cc

    red394a r5139d6  
    1 //$Id: intvec_wrap.cc,v 1.2 2005-09-20 08:39:44 bricken Exp $
     1//$Id: intvec_wrap.cc,v 1.3 2005-09-23 12:59:30 bricken Exp $
    22#include <boost/python.hpp>
    33#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
     
    77
    88using namespace boost::python;
    9 static boost::python::object intvec_as_str(const better_intvec& p)
     9static boost::python::object intvec_as_str(const Intvec& p)
    1010
    1111  using boost::python::str;
     
    2828
    2929void export_intvec(){
    30 boost::python::class_<better_intvec>("intvec")
     30boost::python::class_<Intvec>("intvec")
    3131      .def("__str__", intvec_as_str)
    3232     .def(boost::python::init <>())
    33      .def(boost::python::vector_indexing_suite<better_intvec>());
     33     .def(boost::python::vector_indexing_suite<Intvec>());
    3434}
  • modules/python/intvec_wrap.h

    red394a r5139d6  
    1 //$Id: intvec_wrap.h,v 1.3 2005-09-21 14:11:20 bricken Exp $
     1//$Id: intvec_wrap.h,v 1.4 2005-09-23 12:59:30 bricken Exp $
    22#ifndef INTVEC_WRAP_HEADER
    33#define INTVEC_WRAP_HEADER
     
    55#include "mod2.h"
    66#include "intvec.h"
     7#include "IIntvec.h"
    78void export_intvec();
    8 class better_intvec: public std::vector<int>{
    9 public:
    10   better_intvec(iterator first,
    11         iterator last,
    12         const allocator_type& __a = allocator_type()):
    13     std::vector<int>(first,last,__a){
    14   }
    15   better_intvec(int n=0):std::vector<int>(n){}
    16   better_intvec(intvec& iv):std::vector<int>(iv.length()){
    17     int n=iv.length();
    18     for(int i=0;i<n;i++){
    19       (*this)[i]=iv[i];
    20     }
    21   }
    22   intvec* allocate_legacy_intvec_copy() const{
    23     int s=size();
    24     intvec* iv=new intvec(s);
    25    
    26     for(int i=0;i<s;i++){
    27       (*iv)[i]=(*this)[i];
    28     }
    29     return iv;
    30   }
    31 };
     9
    3210
    3311#endif
  • modules/python/poly_wrap.cc

    red394a r5139d6  
    2525//    .def(boost::python::init <std::vector<int> >())
    2626    .def(boost::python::init <Number>())
    27     .def(boost::python::init <better_intvec> ())
     27    .def(boost::python::init <Intvec> ())
    2828    .def("__str__", Poly_as_str)
    2929    .def("__iter__", boost::python::iterator<Poly>())
     
    3131    .def(boost::python::init <const char* >())
    3232   
     33    .def("leadCoef",&Poly::leadCoef)
     34    .def("leadExp", &Poly::leadExp)
    3335    .def(-self)
    3436    .def(self*=self)
Note: See TracChangeset for help on using the changeset viewer.