* Interface to class for extended truncated power series. */
/*
- * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2002 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
ex point;
};
-/** Return a reference to the pseries object embedded in an expression.
- * The result is undefined if the expression does not contain a pseries
- * object at its top level.
- *
- * @param e expression
- * @return reference to pseries object
- * @see is_ex_of_type */
-inline const pseries &ex_to_pseries(const ex &e)
+
+// utility functions
+
+/** Specialization of is_exactly_a<pseries>(obj) for pseries objects. */
+template<> inline bool is_exactly_a<pseries>(const basic & obj)
{
- return static_cast<const pseries &>(*e.bp);
+ return obj.tinfo()==TINFO_pseries;
}
/** Convert the pseries object embedded in an expression to an ordinary
*
* @param e expression
* @return polynomial expression
- * @see is_ex_of_type
+ * @see is_a<>
* @see pseries::convert_to_poly */
inline ex series_to_poly(const ex &e)
{
- return (static_cast<const pseries &>(*e.bp).convert_to_poly(true));
+ return (ex_to<pseries>(e).convert_to_poly(true));
}
inline bool is_terminating(const pseries & s)