|
GiNaC
1.6.2
|
00001 00005 /* 00006 * GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany 00007 * 00008 * This program is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 #ifndef GINAC_MUL_H 00024 #define GINAC_MUL_H 00025 00026 #include "expairseq.h" 00027 00028 namespace GiNaC { 00029 00031 class mul : public expairseq 00032 { 00033 GINAC_DECLARE_REGISTERED_CLASS(mul, expairseq) 00034 00035 friend class add; 00036 friend class ncmul; 00037 friend class power; 00038 00039 // other constructors 00040 public: 00041 mul(const ex & lh, const ex & rh); 00042 mul(const exvector & v); 00043 mul(const epvector & v); 00044 mul(const epvector & v, const ex & oc, bool do_index_renaming = false); 00045 mul(std::auto_ptr<epvector> vp, const ex & oc, bool do_index_renaming = false); 00046 mul(const ex & lh, const ex & mh, const ex & rh); 00047 00048 // functions overriding virtual functions from base classes 00049 public: 00050 unsigned precedence() const {return 50;} 00051 bool info(unsigned inf) const; 00052 bool is_polynomial(const ex & var) const; 00053 int degree(const ex & s) const; 00054 int ldegree(const ex & s) const; 00055 ex coeff(const ex & s, int n = 1) const; 00056 bool has(const ex & other, unsigned options = 0) const; 00057 ex eval(int level=0) const; 00058 ex evalf(int level=0) const; 00059 ex real_part() const; 00060 ex imag_part() const; 00061 ex evalm() const; 00062 ex series(const relational & s, int order, unsigned options = 0) const; 00063 ex normal(exmap & repl, exmap & rev_lookup, int level = 0) const; 00064 numeric integer_content() const; 00065 ex smod(const numeric &xi) const; 00066 numeric max_coefficient() const; 00067 exvector get_free_indices() const; 00068 ex conjugate() const; 00069 protected: 00070 ex derivative(const symbol & s) const; 00071 ex eval_ncmul(const exvector & v) const; 00072 unsigned return_type() const; 00073 return_type_t return_type_tinfo() const; 00074 ex thisexpairseq(const epvector & v, const ex & oc, bool do_index_renaming = false) const; 00075 ex thisexpairseq(std::auto_ptr<epvector> vp, const ex & oc, bool do_index_renaming = false) const; 00076 expair split_ex_to_pair(const ex & e) const; 00077 expair combine_ex_with_coeff_to_pair(const ex & e, const ex & c) const; 00078 expair combine_pair_with_coeff_to_pair(const expair & p, const ex & c) const; 00079 ex recombine_pair_to_ex(const expair & p) const; 00080 bool expair_needs_further_processing(epp it); 00081 ex default_overall_coeff() const; 00082 void combine_overall_coeff(const ex & c); 00083 void combine_overall_coeff(const ex & c1, const ex & c2); 00084 bool can_make_flat(const expair & p) const; 00085 ex expand(unsigned options=0) const; 00086 void find_real_imag(ex&, ex&) const; 00087 00088 // new virtual functions which can be overridden by derived classes 00089 // none 00090 00091 // non-virtual functions in this class 00092 public: 00093 ex algebraic_subs_mul(const exmap & m, unsigned options) const; 00094 protected: 00095 void print_overall_coeff(const print_context & c, const char *mul_sym) const; 00096 void do_print(const print_context & c, unsigned level) const; 00097 void do_print_latex(const print_latex & c, unsigned level) const; 00098 void do_print_csrc(const print_csrc & c, unsigned level) const; 00099 void do_print_python_repr(const print_python_repr & c, unsigned level) const; 00100 static bool can_be_further_expanded(const ex & e); 00101 std::auto_ptr<epvector> expandchildren(unsigned options) const; 00102 }; 00103 GINAC_DECLARE_UNARCHIVER(mul); 00104 00105 } // namespace GiNaC 00106 00107 #endif // ndef GINAC_MUL_H