File:  [CENS] / python / pyGiNaC / wrappers / ginac_enhancements.cpp
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Tue Apr 17 22:39:25 2001 UTC (16 years, 7 months ago) by pearu
Branches: MAIN
CVS tags: HEAD
Fixed bugs. Exposed/checked functions. Started testing framework.

/*
# This file is part of the PyGiNaC package.
# http://cens.ioc.ee/projects/pyginac/
#
# $Revision: 1.2 $
# $Id: ginac_enhancements.cpp,v 1.2 2001-04-17 22:39:25 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.
#
*/


#include <ginac/ginac.h>

namespace GiNaC {

#if GINACLIB_MAJOR_VERSION == 0 && (GINACLIB_MINOR_VERSION < 8 || (GINACLIB_MINOR_VERSION == 8 && GINACLIB_MICRO_VERSION == 0))
  ex basic::collect(const ex & s) const
  {
    ex x;
    int m = this->degree(s);
    for (int n=this->ldegree(s); n<=m; ++n)
      x += this->coeff(s,n)*power(s,n);
    return x + (*this - x).expand();
  }
#endif

#if GINACLIB_MAJOR_VERSION == 0 && (GINACLIB_MINOR_VERSION < 8 || (GINACLIB_MINOR_VERSION == 8 && GINACLIB_MICRO_VERSION <= 1))
  bool is_negative(const numeric & x) { return x.is_negative(); }
#endif
  
}

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