]> www.ginac.de Git - ginac.git/blob - ginac/flags.h
removed unused function
[ginac.git] / ginac / flags.h
1 /** @file flags.h
2  *
3  *  Collection of all flags used through the GiNaC framework. */
4
5 /*
6  *  GiNaC Copyright (C) 1999-2003 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_FLAGS_H__
24 #define __GINAC_FLAGS_H__
25
26 namespace GiNaC {
27
28 /** Flags to control the behavior of expand(). */
29 class expand_options {
30 public:
31         enum {
32                 expand_indexed = 0x0001,      ///< expands (a+b).i to a.i+b.i
33                 expand_function_args = 0x0002 ///< expands the arguments of functions
34         };
35 };
36
37 /** Flags to control the behavior of subs(). */
38 class subs_options {
39 public:
40         enum {
41                 no_pattern = 0x0001,             ///< disable pattern matching
42                 subs_no_pattern = 0x0001, // for backwards compatibility
43                 algebraic = 0x0002,              ///< enable algebraic substitutions
44                 subs_algebraic = 0x0002,  // for backwards compatibility
45         pattern_is_product = 0x0004,     ///< used internally by expairseq::subschildren()
46         pattern_is_not_product = 0x0008  ///< used internally by expairseq::subschildren()
47         };
48 };
49
50 /** Flags to control series expansion. */
51 class series_options {
52 public:
53         enum {
54                 /** Suppress branch cuts in series expansion.  Branch cuts manifest
55                  *  themselves as step functions, if this option is not passed.  If
56                  *  it is passed and expansion at a point on a cut is performed, then
57                  *  the analytic continuation of the function is expanded. */
58                 suppress_branchcut = 0x0001
59         };
60 };
61
62 /** Switch to control algorithm for determinant computation. */
63 class determinant_algo {
64 public:
65         enum {
66                 /** Let the system choose.  A heuristics is applied for automatic
67                  *  determination of a suitable algorithm. */
68                 automatic,
69                 /** Gauss elimination.  If \f$m_{i,j}^{(0)}\f$ are the entries of the
70                  *  original matrix, then the matrix is transformed into triangular
71                  *  form by applying the rules
72                  *  \f[
73                  *      m_{i,j}^{(k+1)} = m_{i,j}^{(k)} - m_{i,k}^{(k)} m_{k,j}^{(k)} / m_{k,k}^{(k)}
74                  *  \f]
75                  *  The determinant is then just the product of diagonal elements.
76                  *  Choose this algorithm only for purely numerical matrices. */
77                 gauss,
78                 /** Division-free elimination.  This is a modification of Gauss
79                  *  elimination where the division by the pivot element is not
80                  *  carried out.  If \f$m_{i,j}^{(0)}\f$ are the entries of the
81                  *  original matrix, then the matrix is transformed into triangular
82                  *  form by applying the rules
83                  *  \f[
84                  *      m_{i,j}^{(k+1)} = m_{i,j}^{(k)} m_{k,k}^{(k)} - m_{i,k}^{(k)} m_{k,j}^{(k)}
85                  *  \f]
86                  *  The determinant can later be computed by inspecting the diagonal
87                  *  elements only.  This algorithm is only there for the purpose of
88                  *  cross-checks.  It is never fast. */
89                 divfree,
90                 /** Laplace elimination.  This is plain recursive elimination along
91                  *  minors although multiple minors are avoided by the algorithm.
92                  *  Although the algorithm is exponential in complexity it is
93                  *  frequently the fastest one when the matrix is populated by
94                  *  complicated symbolic expressions. */
95                 laplace,
96                 /** Bareiss fraction-free elimination.  This is a modification of
97                  *  Gauss elimination where the division by the pivot element is
98                  *  <EM>delayed</EM> until it can be carried out without computing
99                  *  GCDs.  If \f$m_{i,j}^{(0)}\f$ are the entries of the original
100                  *  matrix, then the matrix is transformed into triangular form by
101                  *  applying the rules
102                  *  \f[
103                  *      m_{i,j}^{(k+1)} = (m_{i,j}^{(k)} m_{k,k}^{(k)} - m_{i,k}^{(k)} m_{k,j}^{(k)}) / m_{k-1,k-1}^{(k-1)}
104                  *  \f]
105                  *  (We have set \f$m_{-1,-1}^{(-1)}=1\f$ in order to avoid a case
106                  *  distinction in above formula.)  It can be shown that nothing more
107                  *  than polynomial long division is needed for carrying out the
108                  *  division.  The determinant can then be read of from the lower
109                  *  right entry.  This algorithm is rarely fast for computing
110                  *  determinants. */
111                 bareiss
112         };
113 };
114
115 /** Switch to control algorithm for linear system solving. */
116 class solve_algo {
117 public:
118         enum {
119                 /** Let the system choose.  A heuristics is applied for automatic
120                  *  determination of a suitable algorithm. */
121                 automatic,
122                 /** Gauss elimination.  If \f$m_{i,j}^{(0)}\f$ are the entries of the
123                  *  original matrix, then the matrix is transformed into triangular
124                  *  form by applying the rules
125                  *  \f[
126                  *      m_{i,j}^{(k+1)} = m_{i,j}^{(k)} - m_{i,k}^{(k)} m_{k,j}^{(k)} / m_{k,k}^{(k)}
127                  *  \f]
128                  *  This algorithm is well-suited for numerical matrices but generally
129                  *  suffers from the expensive division (and computation of GCDs) at
130                  *  each step. */
131                 gauss,
132                 /** Division-free elimination.  This is a modification of Gauss
133                  *  elimination where the division by the pivot element is not
134                  *  carried out.  If \f$m_{i,j}^{(0)}\f$ are the entries of the
135                  *  original matrix, then the matrix is transformed into triangular
136                  *  form by applying the rules
137                  *  \f[
138                  *      m_{i,j}^{(k+1)} = m_{i,j}^{(k)} m_{k,k}^{(k)} - m_{i,k}^{(k)} m_{k,j}^{(k)}
139                  *  \f]
140                  *  This algorithm is only there for the purpose of cross-checks.
141                  *  It suffers from exponential intermediate expression swell.  Use it
142                  *  only for small systems. */
143                 divfree,
144                 /** Bareiss fraction-free elimination.  This is a modification of
145                  *  Gauss elimination where the division by the pivot element is
146                  *  <EM>delayed</EM> until it can be carried out without computing
147                  *  GCDs.  If \f$m_{i,j}^{(0)}\f$ are the entries of the original
148                  *  matrix, then the matrix is transformed into triangular form by
149                  *  applying the rules
150                  *  \f[
151                  *      m_{i,j}^{(k+1)} = (m_{i,j}^{(k)} m_{k,k}^{(k)} - m_{i,k}^{(k)} m_{k,j}^{(k)}) / m_{k-1,k-1}^{(k-1)}
152                  *  \f]
153                  *  (We have set \f$m_{-1,-1}^{(-1)}=1\f$ in order to avoid a case
154                  *  distinction in above formula.)  It can be shown that nothing more
155                  *  than polynomial long division is needed for carrying out the
156                  *  division.  This is generally the fastest algorithm for solving
157                  *  linear systems.  In contrast to division-free elimination it only
158                  *  has a linear expression swell.  For two-dimensional systems, the
159                  *  two algorithms are equivalent, however. */
160                 bareiss
161         };
162 };
163
164 /** Flags to store information about the state of an object.
165  *  @see basic::flags */
166 class status_flags {
167 public:
168         enum {
169                 dynallocated    = 0x0001, ///< heap-allocated (i.e. created by new if we want to be clever and bypass the stack, @see ex::construct_from_basic() )
170                 evaluated       = 0x0002, ///< .eval() has already done its job
171                 expanded        = 0x0004, ///< .expand(0) has already done its job (other expand() options ignore this flag)
172                 hash_calculated = 0x0008  ///< .calchash() has already done its job
173         };
174 };
175
176 /** Possible attributes an object can have. */
177 class info_flags {
178 public:
179         enum {
180                 // answered by class numeric
181                 numeric,
182                 real,
183                 rational,
184                 integer,
185                 crational,
186                 cinteger,
187                 positive,
188                 negative,
189                 nonnegative,
190                 posint,
191                 negint,
192                 nonnegint,
193                 even,
194                 odd,
195                 prime,
196
197                 // answered by class relation
198                 relation,
199                 relation_equal,
200                 relation_not_equal,
201                 relation_less,
202                 relation_less_or_equal,
203                 relation_greater,
204                 relation_greater_or_equal,
205
206                 // answered by class symbol
207                 symbol,
208
209                 // answered by class lst
210                 list,
211
212                 // answered by class exprseq
213                 exprseq,
214
215                 // answered by classes numeric, symbol, add, mul, power
216                 polynomial,
217                 integer_polynomial,
218                 cinteger_polynomial,
219                 rational_polynomial,
220                 crational_polynomial,
221                 rational_function,
222                 algebraic,
223
224                 // answered by class indexed
225                 indexed,      // class can carry indices
226                 has_indices,  // object has at least one index
227
228                 // answered by class idx
229                 idx
230         };
231 };
232
233 class return_types {
234 public:
235         enum {
236                 commutative,
237                 noncommutative,
238                 noncommutative_composite
239         };
240 };
241
242 /** Strategies how to clean up the function remember cache.
243  *  @see remember_table */
244 class remember_strategies {
245 public:
246         enum {
247                 delete_never,   ///< Let table grow undefinitely
248                 delete_lru,     ///< Least recently used
249                 delete_lfu,     ///< Least frequently used
250                 delete_cyclic   ///< First (oldest) one in list
251         };
252 };
253
254 } // namespace GiNaC
255
256 #endif // ndef __GINAC_FLAGS_H__