File:  [CENS] / python / pyGiNaC / wrappers3 / ncmul_py.cpp
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Thu Apr 26 19:44:48 2001 UTC (16 years, 7 months ago) by pearu
Branches: MAIN
CVS tags: HEAD
Impl. pseries,ncmul. Preparing for a release.

/*
# This file is part of the PyGiNaC package.
# http://cens.ioc.ee/projects/pyginac/
#
# $Revision: 1.1 $
# $Id: ncmul_py.cpp,v 1.1 2001-04-26 19:44:48 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.
#
*/
/*DT
  Non-commutative multiplication
  ------------------------------

  >>> from ginac import is_ncmul,ncmul
 */


#ifdef PYGINAC_DEFS
this_module.def(&ncmul_0, "ncmul");
this_module.def(&ncmul_1, "ncmul");
this_module.def(&ncmul_2ex, "ncmul");
this_module.def(&ncmul_2, "ncmul");
ex_class.def(&ex::is_ncmul, "is_ncmul");
this_module.def(&ex::is_ncmul, "is_ncmul");
this_module.def(&return_false, "is_ncmul");
#else
#ifdef PYGINAC_EX_PROTOS
#define PYGINAC_PROTOS
#endif
#ifdef PYGINAC_PROTOS
#ifdef PYGINAC_EX_PROTOS
bool is_ncmul(void) const;
#else // PYGINAC_EX_PROTOS
GiNaC::ex ncmul_0(void);
GiNaC::ex ncmul_1(const GiNaC::ncmul & e);
GiNaC::ex ncmul_2ex(const GiNaC::ex & l, const GiNaC::ex & r);
GiNaC::ex ncmul_2(py::ref l, py::ref r);
BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE
GiNaC::ncmul from_python (PyObject* o, py::type<const GiNaC::ncmul &>);
BOOST_PYTHON_END_CONVERSION_NAMESPACE
#endif // !PYGINAC_EX_PROTOS
#else  // PYGINAC_PROTOS
BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE
GiNaC::ncmul from_python (PyObject* o, py::type<const GiNaC::ncmul &>) {
  return GiNaC::ncmul(from_python(o, py::type<const GiNaC::exvector &>()), true);
}
BOOST_PYTHON_END_CONVERSION_NAMESPACE
/*F_DT is_ncmul(obj)
  Check if `obj' is ncmul.
*/
/*M_DT is_mul(self)
  Check if object is ncmul.
*/
bool ex::is_ncmul(void) const { return is_ex_exactly_of_type(*this, ncmul); }

/*F_DT ncmul(*args)
  ncmul() - return numeric('1').
  ncmul([]) - return numeric('1').
  ncmul(l,r) - multiply two expressions.
    If `l' and/or `r' are Python objects, they are converted to ex objects.
  ncmul(seq) - product of expressions in a sequence `seq'.
  ncmul(ncmul(...)) -> ncmul(...)
*/
GiNaC::ex ncmul_0(void) {
  return GiNaC::numeric(1);
}
GiNaC::ex ncmul_1(const GiNaC::ncmul & e) {
  return e;
}
GiNaC::ex ncmul_2ex(const GiNaC::ex & l, const GiNaC::ex & r) {
  return GiNaC::ncmul(l,r);
}
GiNaC::ex ncmul_2(py::ref l, py::ref r) {
  return GiNaC::ncmul(ex_from_ref(l), ex_from_ref(r));
}

#endif // !PYGINAC_PROTOS
#endif // !PYGINAC_DEFS




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