File:  [CENS] / python / pyGiNaC / wrappers4 / pseries.cpp
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Tue Nov 27 18:41:06 2001 UTC (15 years, 11 months ago) by pearu
Branches: MAIN
CVS tags: HEAD
Implemented pseries.

/*
  This file is part of the PyGiNaC package.
  http://cens.ioc.ee/projects/pyginac/

  $Revision: 1.1 $
  $Id: pseries.cpp,v 1.1 2001-11-27 18:41:06 pearu Exp $
 
  Copyright 2001 Pearu Peterson all rights reserved,
  Pearu Peterson <pearu@cens.ioc.ee>
  Permission to use, modify, and distribute this software is given under the
  terms of the LGPL.  See http://www.fsf.org
 
  NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
*/

#ifndef PYGINAC_PSERIES_CPP
#define PYGINAC_PSERIES_CPP
/* prototypes */

GiNaC::ex pseries_convert_to_poly(const GiNaC::pseries & self,bool no_order);
GiNaC::ex pseries_shift_exponents(const GiNaC::pseries & self,int deg);

BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE

GiNaC::pseries & from_python(PyObject* o,
			     py::type<GiNaC::pseries &>);
const GiNaC::pseries & from_python (PyObject* o,
				    py::type<const GiNaC::pseries &>);

BOOST_PYTHON_END_CONVERSION_NAMESPACE


#else
#ifndef PYGINAC_PSERIES_CPP_1
#define PYGINAC_PSERIES_CPP_1
/* definitions */

ex_class.def(&GiNaC::pseries::get_var, "pseries_get_var");
ex_class.def(&GiNaC::pseries::get_point, "pseries_get_point");
ex_class.def(&GiNaC::pseries::is_compatible_to, "pseries_is_compatible_to");
ex_class.def(&GiNaC::pseries::is_terminating, "pseries_is_terminating");
ex_class.def(pseries_convert_to_poly, "pseries_convert_to_poly");
ex_class.def(&GiNaC::pseries::add_series, "pseries_add_series");
ex_class.def(&GiNaC::pseries::mul_series, "pseries_mul_series");
ex_class.def(&GiNaC::pseries::mul_const, "pseries_mul_const");
ex_class.def(&GiNaC::pseries::power_const, "pseries_power_const");
ex_class.def(pseries_shift_exponents, "pseries_shift_exponents");
ex_class.def(&GiNaC::pseries::is_zero, "pseries_is_zero");

#else
/* implementation */

GiNaC::ex pseries_convert_to_poly(const GiNaC::pseries & self,bool no_order) {
  return self.convert_to_poly(no_order);
}
GiNaC::ex pseries_shift_exponents(const GiNaC::pseries & self,int deg) {
  return self.shift_exponents(deg);
}


BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE

GiNaC::pseries & from_python(PyObject* o,
			     py::type<GiNaC::pseries &>) {
  if (PYOBJ_IS_EX(o)) {
    GiNaC::ex & e = pyobj_get_ex_nonconst(o);
    if (GiNaC::is_a<GiNaC::pseries>(e))
      return GiNaC::ex_to_nonconst<GiNaC::pseries>(e);
  }
  PyErr_SetString(PyExc_TypeError,(std::string("from_python(obj, pseries) expected pseries but got ")+PyString_AsString(PyObject_Repr(PyObject_Type(o)))).c_str());
  throw py::error_already_set();
}

const GiNaC::pseries & from_python (PyObject* o,
				    py::type<const GiNaC::pseries &>) {
  return from_python(o, py::type<GiNaC::pseries &>());
}

BOOST_PYTHON_END_CONVERSION_NAMESPACE

#endif
#endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>