Annotation of python/pyGiNaC/wrappers/numeric.py, revision 1.4

1.1       pearu       1: # This file is part of the PyGiNaC package.
                      2: # http://cens.ioc.ee/projects/pyginac/
                      3: #
1.4     ! pearu       4: # $Revision: 1.3 $
        !             5: # $Id: numeric.py,v 1.3 2001/04/11 20:31:31 pearu Exp $
1.1       pearu       6: #
                      7: # Copyright 2001 Pearu Peterson all rights reserved,
                      8: # Pearu Peterson <pearu@cens.ioc.ee>
                      9: # Permission to use, modify, and distribute this software is given under the
                     10: # terms of the LGPL.  See http://www.fsf.org
                     11: #
                     12: # NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
                     13: #
1.3       pearu      14: # TODO (help/contribution is appreciated):
1.1       pearu      15: # __long__, __complex__, numeric <-> Python string
1.3       pearu      16: # smod
1.1       pearu      17: 
                     18: depends = ['basic']
                     19: 
1.3       pearu      20: #STARTPROTO
                     21: 
                     22: 
                     23: class numeric(basic):
                     24:     """A wrapper around CLN-numbers within the GiNaC class hierarchy."""
                     25:     def __init__(self,numer = 0, denom = 1):
                     26:         """numeric() - construct CLN integer 0.
                     27:     numeric(i) - construct CLN integer from Python integer `i'.
                     28:     numeric(f) - construct CLN real from Python float `f'.
                     29:     numeric(c) - construct CLN number from Python complex `c'.
                     30:     numeric(s) - construct CLN number from Python string `s'.
                     31:     numeric(n,d) - construct CLN rational n/d from Python numbers `n,d'.
                     32:     numeric(ex(numeric(...))) - returns numeric(...).
                     33:     """
                     34:     def is_positive(self):
                     35:         """True if not complex and greater than zero."""
                     36:     def is_negative(self):
                     37:         """True if not complex and less than zero."""
                     38:     def is_integer(self):
                     39:         """True if a non-complex integer."""
                     40:     def is_pos_integer (self):
                     41:         """True if an exact integer greater than zero."""
                     42:     def is_nonneg_integer (self):
                     43:         """True if an exact integer greater or equal zero."""
                     44:     def is_even (self):
                     45:         """True if an exact even integer."""
                     46:     def is_odd (self):
                     47:         """True if an exact odd integer."""
                     48:     def is_prime (self):
                     49:         """Probabilistic primality test. True if an exact integer and prime."""
                     50:     def is_rational (self):
                     51:         """True if an exact rational number, may even be complex
                     52:     (denominator may be unity)."""
                     53:     def is_real (self):
                     54:         """True if a real integer, rational or float (but not complex)."""
                     55:     def is_cinteger (self):
                     56:         """True if element of the domain of integers extended by I, i.e.
                     57:     is of the form a+b*I, where a and b are integers."""
                     58:     def is_crational (self):
                     59:         """True if object is an exact rational number, may even
                     60:     be complex (denominator may be unity)."""
                     61:     def real (self):
                     62:         """Real part of a number."""
                     63:     def imag (self):
                     64:         """Imaginar part of a number."""
                     65:     def numer(self):
                     66:         """Numerator.
                     67:     Computes the numerator of rational numbers, rationalized numerator
                     68:     of complex if real and imaginary part are both rational numbers
                     69:     (i.e numer(4/3+5/6*I) == 8+5*I), the number carrying the sign in
                     70:     all other cases.
                     71:     """
                     72:     def denom(self):
                     73:         """Denominator.
                     74:     Computes the denominator of rational numbers, common integer
                     75:     denominator of complex if real and imaginary part are both
                     76:     rational numbers (i.e denom(4/3+5/6*I) == 6), one in all other
                     77:     cases.
                     78:     """
                     79:     def __int__(self):
                     80:         """Converts numeric types to Python's int."""
                     81:     def __float__(self):
                     82:         """Converts numeric types to Python's double."""
                     83:     def __len__(self):
                     84:         """Size in binary notation.
                     85:     For integers, this is the smallest n >= 0 such that -2^n <= x < 2^n.
                     86:     If x > 0, this is the unique n > 0 such that 2^(n-1) <= x < 2^n.
                     87:     Returns number of bits (excluding sign) needed to represent that
                     88:     number in two's complement if it is an integer, 0 otherwise.
                     89:     """
                     90:     def __cmp__(self, other):
                     91:         """A canonical order on all numbers.
                     92:     For complex numbers this is not possible in a mathematically
                     93:     consistent way but we need to establish some order and it ought to
                     94:     be fast. So we simply define it to be compatible with our method
                     95:     csgn.
                     96:     Returns csgn(self-other). 
                     97:     """
                     98:     def inverse(self):
                     99:         """Inverse of a number."""
                    100:     def csgn(self):
                    101:         """Return the complex half-plane (left or right) in which the
                    102:     number lies.
                    103:     csgn(x)==0 for x==0, csgn(x)==1 for Re(x)>0 or Re(x)=0 and
                    104:     Im(x)>0, csgn(x)==-1 for Re(x)<0 or Re(x)=0 and Im(x)<0.
                    105:     """
                    106:     def is_zero(self):
                    107:         """True if zero."""
                    108:     def is_equal(self, other):
                    109:         """True if equal to other."""
                    110:     def __power__(self, other):
                    111:         """Numerical exponentiation. [pow(b,e,m) not implemented]"""
                    112:     def __coerse__(self, other):
                    113:         """If ex(other)==ex(numeric(other)), then returns (self,numeric(other))
                    114:         Otherwise returns (ex(self), ex(other)).
                    115:         """
                    116:     def __add__(self,other):
                    117:         """Numerical addition."""
                    118:     def __sub__(self,other):
                    119:         """Numerical subtraction."""
                    120:     def __mul__(self,other):
                    121:         """Numerical multiplication."""
                    122:     def __div__(self,other):
                    123:         """Numerical division."""
                    124:     def __neg__(self):
                    125:         """Numerical negation."""
                    126:     def __pos__(self):
                    127:         """"""
                    128: class _Digits:
                    129:     """A global singleton object Digits which behaves just like Maple's
                    130:     Digits.
                    131:     """
                    132:     def __int__(self):
                    133:         """Convert to Python int."""
                    134:     def set(self,i):
                    135:         """Set value to Python integer `i'"""
                    136: 
                    137: Digits = '_Digits()'
                    138: I = 'Imaginary unit'
                    139: 
                    140: #ENDPROTO
                    141: 
1.4     ! pearu     142: #STARTDOCTEST
        !           143: def test_02_numeric():
        !           144:     """
        !           145: This doc string tests CLN numeric objects
        !           146: >>> from ginac import numeric
        !           147: 
        !           148: To constract CLN number from a Python int:
        !           149: >>> numeric(2)
        !           150: numeric('2')
        !           151: 
        !           152: ... from a Python float:
        !           153: >>> numeric(2.0)
        !           154: numeric('2.0')
        !           155: 
        !           156: ... from a Python complex:
        !           157: >>> numeric(2.0+3.0j)
        !           158: numeric('2.0+3.0*I')
        !           159: 
        !           160: ... from a Python string:
        !           161: >>> numeric('2.3')
        !           162: numeric('2.3')
        !           163: 
        !           164: ... from a numeric:
        !           165: >>> numeric(numeric('2/3'))
        !           166: numeric('2/3')
        !           167: 
        !           168: ... from a pair of numbers:
        !           169: >>> numeric(2,3)
        !           170: numeric('2/3')
        !           171: >>> numeric('2.3', 2)
        !           172: numeric('1.15')
        !           173: >>> numeric(1,numeric(3))
        !           174: numeric('1/3')
        !           175: 
        !           176: ... from an ex object:
        !           177: >>> from ginac import ex,symbol
        !           178: >>> numeric(ex(3))
        !           179: numeric('3')
        !           180: >>> numeric(ex(symbol()))
        !           181: Traceback (most recent call last):
        !           182:     ...
        !           183: TypeError: ex_to_numeric() argument must be ex(numeric)
        !           184: >>> numeric(symbol())
        !           185: Traceback (most recent call last):
        !           186:     ...
        !           187: TypeError: numeric() argument must be int|float|complex|string|numeric|obj,obj|ex(numeric)
        !           188: 
        !           189: For constructing complex numbers, use predefined imaginary unit:
        !           190: >>> from ginac import I
        !           191: >>> I
        !           192: numeric('I')
        !           193: >>> 3*I+2
        !           194: numeric('2+3*I')
        !           195: >>> I/3
        !           196: numeric('1/3*I')
        !           197: 
        !           198: Note that pretty printed ratonal numbers are in the form \d+/\d+ and therefore
        !           199: not usable for evaluation as a Python string:
        !           200: >>> print numeric(2)/3
        !           201: 2/3
        !           202: 
        !           203: For evaluation, apply first evalf() method or function to convert rational
        !           204: numbers to floats:
        !           205: >>> from ginac import evalf
        !           206: >>> evalf(numeric(2)/3)
        !           207: numeric('0.6666666666666666667')
        !           208: >>> numeric('2/3').evalf()
        !           209: numeric('0.6666666666666666667')
        !           210: 
        !           211: Use Digits object to change the number of digits in CLN numbers:
        !           212: >>> from ginac import Digits
        !           213: >>> Digits
        !           214: Digits
        !           215: >>> int(Digits)
        !           216: 17
        !           217: >>> print Digits
        !           218: 17
        !           219: >>> Digits.set(25)
        !           220: >>> int(Digits)
        !           221: 25
        !           222: >>> numeric(2.0)/3
        !           223: numeric('0.66666666666666666666666666667')
        !           224: >>> Digits.set(8)
        !           225: >>> numeric(2.0)/3
        !           226: numeric('0.6666666666666666')
        !           227: >>> Digits.set(17) # back to default
        !           228: 
        !           229: CLN numeric objects can be transformed to Python numbers:
        !           230: >>> int(numeric(3))
        !           231: 3
        !           232: >>> int(numeric(3.4))
        !           233: 3
        !           234: >>> long(numeric(3))   # not implemented yet
        !           235: Traceback (most recent call last):
        !           236: ...
        !           237: TypeError: object can't be converted to long
        !           238: >>> float(numeric(3))
        !           239: 3.0
        !           240: >>> float(numeric(3)+I)
        !           241: 3.0
        !           242: >>> float(numeric(2)/3)
        !           243: 0.66666666666666663
        !           244: >>> complex(numeric(3))
        !           245: (3+0j)
        !           246: >>> complex(numeric(3)+I)
        !           247: (3+1j)
        !           248: 
        !           249: Real and imaginary parts:
        !           250: >>> n = numeric('2/3-4/5*I')
        !           251: >>> n
        !           252: numeric('2/3-4/5*I')
        !           253: >>> n.real()
        !           254: numeric('2/3')
        !           255: >>> n.imag()
        !           256: numeric('-4/5')
        !           257: 
        !           258: numeric has other methods as well:
        !           259: >>> n.inverse()
        !           260: numeric('75/122+45/61*I')
        !           261: >>> n.inverse()*n
        !           262: numeric('1')
        !           263: >>> n.csgn()
        !           264: 1
        !           265: >>> (-n).csgn()
        !           266: -1
        !           267: >>> n.numer()
        !           268: numeric('10-12*I')
        !           269: >>> n.denom()
        !           270: numeric('15')
        !           271: >>> n.is_equal(n.numer()/n.denom())
        !           272: 1
        !           273: >>> (n-n.numer()/n.denom()).is_zero()
        !           274: 1
        !           275: >>> n.is_positive(),n.is_negative(),n.is_integer(),n.is_rational(),n.is_real()
        !           276: (0, 0, 0, 0, 0)
        !           277: >>> n.is_cinteger(),n.is_crational()
        !           278: (0, 1)
        !           279: >>> m = numeric(3)
        !           280: >>> m.is_positive(),m.is_negative(),m.is_integer(),m.is_rational(),m.is_real()
        !           281: (1, 0, 1, 1, 1)
        !           282: >>> m.is_cinteger(),m.is_crational()
        !           283: (1, 1)
        !           284: >>> m.is_pos_integer(), m.is_nonneg_integer()
        !           285: (1, 1)
        !           286: >>> (-m).is_pos_integer(), (-m).is_nonneg_integer()
        !           287: (0, 0)
        !           288: >>> numeric().is_nonneg_integer()
        !           289: 1
        !           290: >>> m.is_even(), m.is_odd(), m.is_prime()
        !           291: (0, 1, 1)
        !           292: >>> len(numeric(345))
        !           293: 9
        !           294: >>> abs(numeric(-3))
        !           295: numeric('3')
        !           296: 
        !           297: Unary operations:
        !           298: >>> +n
        !           299: numeric('2/3-4/5*I')
        !           300: >>> -n
        !           301: numeric('-2/3+4/5*I')
        !           302: 
        !           303: Binary operations:
        !           304: >>> n+m
        !           305: numeric('11/3-4/5*I')
        !           306: >>> n-m
        !           307: numeric('-7/3-4/5*I')
        !           308: >>> n*m
        !           309: numeric('2-12/5*I')
        !           310: >>> n/m
        !           311: numeric('2/9-4/15*I')
        !           312: >>> n**m
        !           313: numeric('-664/675-208/375*I')
        !           314: >>> n**n
        !           315: power(numeric('2/3-4/5*I'), numeric('2/3-4/5*I'))
        !           316: >>> m**n
        !           317: power(numeric('3'), numeric('2/3-4/5*I'))
        !           318: >>> n+3
        !           319: numeric('11/3-4/5*I')
        !           320: >>> 3+n
        !           321: numeric('11/3-4/5*I')
        !           322: >>> n-3
        !           323: numeric('-7/3-4/5*I')
        !           324: >>> 3-n
        !           325: numeric('7/3+4/5*I')
        !           326: >>> n*3
        !           327: numeric('2-12/5*I')
        !           328: >>> 3*n
        !           329: numeric('2-12/5*I')
        !           330: >>> n/3
        !           331: numeric('2/9-4/15*I')
        !           332: >>> 3/n
        !           333: numeric('225/122+135/61*I')
        !           334: >>> n**3
        !           335: numeric('-664/675-208/375*I')
        !           336: >>> 3**n
        !           337: power(numeric('3'), numeric('2/3-4/5*I'))
        !           338: 
        !           339: 
        !           340: """
        !           341: 
        !           342: 
        !           343: #ENDDOCTEST
1.1       pearu     344: wrapperclass = '''
                    345: 
                    346: class numeric_w : public GiNaC::numeric {
                    347:   PyObject * self;
                    348: public:
                    349: 
                    350:   numeric_w(const GiNaC::numeric & other): GiNaC::numeric(other), self() {
                    351:     DEBUG_C("numeric_w::numeric_w(raw)");
                    352:   }
                    353:   numeric_w(python::ref);
                    354: 
                    355:   numeric_w(PyObject * self_): GiNaC::numeric(), self(self_) {
                    356:     DEBUG_C("numeric_w::numeric_w()");
                    357:   }
                    358:   numeric_w(PyObject * self_, const GiNaC::numeric & other)
                    359:     : GiNaC::numeric(other), self(self_) {
                    360:     DEBUG_C("numeric_w::numeric_w(numeric)");
                    361:   }
                    362:   numeric_w(PyObject * self_, const GiNaC::ex & other)
                    363:     : GiNaC::numeric(ex_to_numeric_w(other)), self(self_) {
                    364:     DEBUG_C("numeric_w::numeric_w(ex)");
                    365:   }
                    366:   numeric_w(PyObject * self_, python::ref other)
                    367:   : GiNaC::numeric(numeric_w(other)), self(self_) {
                    368:     DEBUG_C("numeric_w::numeric_w(ref)");
                    369:   }
                    370:   numeric_w::numeric_w(PyObject * self_, python::ref numer, python::ref denom)
                    371:   : GiNaC::numeric(numeric_w(numer)/numeric_w(denom)), self(self_) {
                    372:     DEBUG_C("numeric_w::numeric_w(ref,ref)");
                    373:   }
                    374:   ~numeric_w() {
                    375:     DEBUG_C("numeric_w::~numeric_w()");
                    376:   }
1.4     ! pearu     377: 
1.1       pearu     378:   long to_long_w(void) const {
                    379:     DEBUG_M("numeric.to_long()");
                    380:     return cln::cl_I_to_long(cln::truncate1(cln::the<cln::cl_R>(this->to_cl_N())));
                    381:   }
1.4     ! pearu     382: #ifdef PYGINAC_matrix
        !           383:   UNEX_RET op_mul_matrix(const GiNaC::matrix & other) const {
        !           384:     return UNEX(GiNaC::ex(other.mul(*this)));
1.3       pearu     385:   }
1.4     ! pearu     386:   UNEX_RET op_div_matrix(const GiNaC::matrix & other) const {
        !           387:     return UNEX(GiNaC::ex(other.inverse().mul(*this)));
        !           388:   }
        !           389: #endif
1.1       pearu     390: };
                    391: 
1.2       pearu     392: class _numeric_digits_w : public GiNaC::_numeric_digits {
                    393:   PyObject * self;
                    394: public:
                    395:   _numeric_digits_w(PyObject * self_, const GiNaC::_numeric_digits & other)
                    396:     : GiNaC::_numeric_digits(other), self(self_) {}
                    397:   std::string python_repr(void) const {
                    398:     std::ostrstream os;
                    399:     os << "Digits" << std::ends;
                    400:     return os.str();
                    401:   }
                    402:   std::string python_str(void) const {
                    403:     std::ostrstream os;
                    404:     this -> print (os);
                    405:     os << std::ends;
                    406:     return os.str();
                    407:   }
                    408:   void set_w(long d) { ((GiNaC::_numeric_digits &)(*this)) = d; }
                    409:   long to_long_w(void) { return *this; }
                    410: };
1.1       pearu     411: '''
                    412: 
                    413: builder = '''
                    414: python::class_builder<numeric_w> numeric_w_class(this_module, "_numeric_w");
                    415: python::class_builder<GiNaC::numeric, numeric_w> numeric_class(this_module, "numeric");
                    416: numeric_py_class = python::as_object(numeric_class.get_extension_class());
                    417: numeric_class.declare_base(numeric_w_class);
                    418: numeric_class.declare_base(basic_class);
1.2       pearu     419: 
                    420: python::class_builder<_numeric_digits_w> _numeric_digits_w_class(this_module, "_numeric_digits_w");
                    421: python::class_builder<GiNaC::_numeric_digits, _numeric_digits_w> _numeric_digits_class(this_module, "_numeric_digits");
                    422: _numeric_digits_class.declare_base(_numeric_digits_w_class);
1.1       pearu     423: '''
                    424: 
                    425: constructors = '''
                    426: numeric_class.def(python::constructor<>());
                    427: numeric_class.def(python::constructor<const GiNaC::numeric &>());
                    428: numeric_class.def(python::constructor<const GiNaC::ex &>());
                    429: numeric_class.def(python::constructor<python::ref>());
                    430: numeric_class.def(python::constructor<python::ref, python::ref>());
                    431: '''
                    432: 
                    433: defs = '''
1.2       pearu     434: _numeric_digits_class.def(&_numeric_digits_w::python_repr, "__repr__");
                    435: _numeric_digits_class.def(&_numeric_digits_w::python_str, "__str__");
                    436: _numeric_digits_class.def(&_numeric_digits_w::to_long_w, "__int__");
                    437: _numeric_digits_class.def(&_numeric_digits_w::set_w, "set");
                    438: this_module.add(BOOST_PYTHON_CONVERSION::to_python(GiNaC::Digits), "Digits");
                    439: this_module.add(BOOST_PYTHON_CONVERSION::to_python(GiNaC::I), "I");
                    440: 
1.1       pearu     441: numeric_class.def(&basic_w::python_str, "__str__");
                    442: numeric_class.def(&basic_w::python_repr, "__repr__");
1.4     ! pearu     443: numeric_class.def(&numeric_coerce, "__coerce__");
        !           444: numeric_class.def(python::operators<(python::op_abs)>());
        !           445: #ifdef PYGINAC_matrix
        !           446: numeric_class.def(&numeric_w::op_mul_matrix, "__mul__");
        !           447: numeric_class.def(&numeric_w::op_div_matrix, "__div__");
        !           448: #endif
        !           449: BASIC_OPS(numeric)
1.1       pearu     450: 
                    451: //numeric_class.def(&numeric_w::add, "add");
                    452: //numeric_class.def(&numeric_w::sub, "sub");
                    453: //numeric_class.def(&numeric_w::mul, "mul");
                    454: //numeric_class.def(&numeric_w::div, "div");
1.4     ! pearu     455: //numeric_class.def(&numeric_w::power_w, "__pow__");
1.1       pearu     456: //numeric_class.def(&numeric_w::add_dyn, "add_dyn");
                    457: //numeric_class.def(&numeric_w::sub_dyn, "sub_dyn");
                    458: //numeric_class.def(&numeric_w::div_dyn, "div_dyn");
                    459: //numeric_class.def(&numeric_w::power_dyn, "power_dyn");
1.3       pearu     460: numeric_class.def(&numeric_w::inverse, "inverse");
                    461: numeric_class.def(&numeric_w::csgn, "csgn");
1.1       pearu     462: numeric_class.def(&numeric_w::compare, "__cmp__");
1.2       pearu     463: numeric_class.def(&numeric_w::is_positive, "is_positive");
                    464: numeric_class.def(&numeric_w::is_negative, "is_negative");
                    465: numeric_class.def(&numeric_w::is_integer, "is_integer");
                    466: numeric_class.def(&numeric_w::is_pos_integer, "is_pos_integer");
                    467: numeric_class.def(&numeric_w::is_nonneg_integer, "is_nonneg_integer");
                    468: numeric_class.def(&numeric_w::is_even, "is_even");
                    469: numeric_class.def(&numeric_w::is_odd, "is_odd");
                    470: numeric_class.def(&numeric_w::is_prime, "is_prime");
                    471: numeric_class.def(&numeric_w::is_rational, "is_rational");
                    472: numeric_class.def(&numeric_w::is_real, "is_real");
                    473: //numeric_class.def(&numeric_w::is_equal, "is_equal"); //defined in basic
1.3       pearu     474: numeric_class.def(&numeric_w::is_zero, "is_zero");
1.2       pearu     475: numeric_class.def(&numeric_w::is_cinteger, "is_cinteger");
                    476: numeric_class.def(&numeric_w::is_crational, "is_crational");
1.1       pearu     477: //numeric_class.def(&numeric_w::to_int, "to_int");
                    478: numeric_class.def(&numeric_w::to_long_w, "__int__");
                    479: numeric_class.def(&numeric_w::to_double, "__float__");
                    480: //numeric_class.def(&numeric_w::to_cl_N, "to_cl_N");
1.2       pearu     481: numeric_class.def(&numeric_w::real, "real");
                    482: numeric_class.def(&numeric_w::imag, "imag");
1.3       pearu     483: numeric_class.def(&numeric_w::numer, "numer"); //defined in basic
                    484: numeric_class.def(&numeric_w::denom, "denom"); //defined in basic
                    485: numeric_class.def(&numeric_w::int_length, "__len__");
1.1       pearu     486: 
                    487: '''
                    488: 
                    489: implementation = '''
                    490: EX_TO_BASIC(numeric)
1.4     ! pearu     491: 
        !           492: static python::tuple numeric_coerce(const GiNaC::numeric & left, python::ref right) {
        !           493:   GiNaC::ex r = ex_w(right);
        !           494:   if (is_ex_exactly_of_type(r, numeric))
        !           495:     return python::tuple(left,ex_to_numeric(r));
        !           496: #ifdef PYGINAC_matrix
        !           497:   if (is_ex_exactly_of_type(r, matrix))
        !           498:     return python::tuple(left, ex_to_matrix(r));
        !           499: #endif
        !           500:   return python::tuple(GiNaC::ex(left), r);
        !           501: }
1.1       pearu     502: 
                    503: numeric_w::numeric_w(python::ref other): GiNaC::numeric()
                    504: {
                    505:   PyObject * o = other.get();
                    506:   DEBUG_C("numeric_w::numeric_w(raw:ref)");
                    507:   if (PyInt_Check(o))
                    508:     this->GiNaC::numeric::operator=(PyInt_AS_LONG(o));
                    509:   else if (PyFloat_Check(o))
                    510:     this->GiNaC::numeric::operator=(PyFloat_AS_DOUBLE(o));
                    511:   else if (PyComplex_Check(o))
                    512:     this->GiNaC::numeric::operator=(GiNaC::numeric(
                    513:     cln::complex(PyComplex_RealAsDouble(o),PyComplex_ImagAsDouble(o))
                    514:     ));
                    515:   else if (PyString_Check(o))
                    516:     this->GiNaC::numeric::operator=(PyString_AS_STRING(o));
                    517:   else if (NumericInstance_Check(o))
                    518:     this->GiNaC::numeric::operator=(BOOST_PYTHON_CONVERSION::from_python(o, python::type<const GiNaC::numeric &>()));
                    519:   else {
                    520:     PyErr_SetString(PyExc_TypeError, "numeric() argument must be int|float|complex|string|numeric|obj,obj|ex(numeric)");
                    521:     throw python::error_already_set();
                    522:   }
                    523: }
                    524: '''

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