/[GiNaC]/ginac/ncmul.h
ViewVC logotype

Contents of /ginac/ncmul.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations)
Thu Jul 20 21:12:42 2000 UTC (12 years, 10 months ago) by kreckel
Branch: MAIN
CVS Tags: release_0-6-4, release_0-6-3
Changes since 1.13: +3 -3 lines
File MIME type: text/plain
- Derivatives are now assembled in a slightly different manner (i.e. they
  'look' different on first sight).  Under certain circumstances this can
  result in a dramatic speedup because it gives hashing a better chance,
  especially when computing higher derivatives.
- Series expansion accepts an additional bool argument now, telling it
  whether branch cuts are to be honored (as Maple does it) or not (as
  Mathematica does it).  It defaults to true (i.e. the Maple way).
- Many series expansions of built-in functions have been reengineered.
- The Dilogarithm (Li2) now has floating point evaluation, derivative and a
  proper series expansion.
- Namespace 'std' cleanly disentangled, as demanded by ISO/EIC 14882-1998(E).
- Some helpers updated from upstream.

1 /** @file ncmul.h
2 *
3 * Interface to GiNaC's non-commutative products of expressions. */
4
5 /*
6 * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23 #ifndef __GINAC_NCMUL_H__
24 #define __GINAC_NCMUL_H__
25
26 #include "exprseq.h"
27
28 #ifndef NO_NAMESPACE_GINAC
29 namespace GiNaC {
30 #endif // ndef NO_NAMESPACE_GINAC
31
32 /** Non-commutative product of expressions. */
33 class ncmul : public exprseq
34 {
35 GINAC_DECLARE_REGISTERED_CLASS(ncmul, exprseq)
36
37 friend class power;
38 friend ex nonsimplified_ncmul(const exvector & v);
39 friend ex simplified_ncmul(const exvector & v);
40
41 // member functions
42
43 // default constructor, destructor, copy constructor assignment operator and helpers
44 public:
45 ncmul();
46 ~ncmul();
47 ncmul(const ncmul & other);
48 const ncmul & operator=(const ncmul & other);
49 protected:
50 void copy(const ncmul & other);
51 void destroy(bool call_parent);
52
53 // other constructors
54 public:
55 ncmul(const ex & lh, const ex & rh);
56 ncmul(const ex & f1, const ex & f2, const ex & f3);
57 ncmul(const ex & f1, const ex & f2, const ex & f3,
58 const ex & f4);
59 ncmul(const ex & f1, const ex & f2, const ex & f3,
60 const ex & f4, const ex & f5);
61 ncmul(const ex & f1, const ex & f2, const ex & f3,
62 const ex & f4, const ex & f5, const ex & f6);
63 ncmul(const exvector & v, bool discardable=false);
64 ncmul(exvector * vp); // vp will be deleted
65
66 // functions overriding virtual functions from bases classes
67 public:
68 basic * duplicate() const;
69 void print(std::ostream & os, unsigned upper_precedence) const;
70 void printraw(std::ostream & os) const;
71 void printcsrc(std::ostream & os, unsigned upper_precedence) const;
72 bool info(unsigned inf) const;
73 int degree(const symbol & s) const;
74 int ldegree(const symbol & s) const;
75 ex expand(unsigned options=0) const;
76 ex coeff(const symbol & s, int n=1) const;
77 ex eval(int level=0) const;
78 ex subs(const lst & ls, const lst & lr) const;
79 exvector get_indices(void) const;
80 ex thisexprseq(const exvector & v) const;
81 ex thisexprseq(exvector * vp) const;
82 protected:
83 ex derivative(const symbol & s) const;
84 int compare_same_type(const basic & other) const;
85 unsigned return_type(void) const;
86 unsigned return_type_tinfo(void) const;
87
88 // new virtual functions which can be overridden by derived classes
89 // none
90
91 // non-virtual functions in this class
92 protected:
93 unsigned count_factors(const ex & e) const;
94 void append_factors(exvector & v, const ex & e) const;
95 exvector expandchildren(unsigned options) const;
96 public:
97 const exvector & get_factors(void) const;
98
99 // member variables
100
101 protected:
102 static unsigned precedence;
103 };
104
105 // global constants
106
107 extern const ncmul some_ncmul;
108 extern const type_info & typeid_ncmul;
109
110 // friend funtions
111
112 ex nonsimplified_ncmul(const exvector & v);
113 ex simplified_ncmul(const exvector & v);
114
115 // utility functions
116 inline const ncmul &ex_to_ncmul(const ex &e)
117 {
118 return static_cast <const ncmul &>(*e.bp);
119 }
120
121 #ifndef NO_NAMESPACE_GINAC
122 } // namespace GiNaC
123 #endif // ndef NO_NAMESPACE_GINAC
124
125 #endif // ndef __GINAC_NCMUL_H__

Christian Bauer">Christian Bauer
ViewVC Help
Powered by ViewVC 1.1.15