3 * Collection of all flags used through the GiNaC framework. */
6 * GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef __GINAC_FLAGS_H__
24 #define __GINAC_FLAGS_H__
28 /** Flags to control the behavior of expand(). */
29 class expand_options {
32 expand_indexed = 0x0001, ///< expands (a+b).i to a.i+b.i
33 expand_function_args = 0x0002 ///< expands the arguments of functions
37 /** Flags to control the behavior of has(). */
41 algebraic = 0x0001, ///< enable algebraic matching
45 /** Flags to control the behavior of subs(). */
49 no_pattern = 0x0001, ///< disable pattern matching
50 subs_no_pattern = 0x0001, // for backwards compatibility
51 algebraic = 0x0002, ///< enable algebraic substitutions
52 subs_algebraic = 0x0002, // for backwards compatibility
53 pattern_is_product = 0x0004, ///< used internally by expairseq::subschildren()
54 pattern_is_not_product = 0x0008, ///< used internally by expairseq::subschildren()
55 no_index_renaming = 0x0010
59 /** Domain of an object */
69 /** Flags to control series expansion. */
70 class series_options {
73 /** Suppress branch cuts in series expansion. Branch cuts manifest
74 * themselves as step functions, if this option is not passed. If
75 * it is passed and expansion at a point on a cut is performed, then
76 * the analytic continuation of the function is expanded. */
77 suppress_branchcut = 0x0001
81 /** Switch to control algorithm for determinant computation. */
82 class determinant_algo {
85 /** Let the system choose. A heuristics is applied for automatic
86 * determination of a suitable algorithm. */
88 /** Gauss elimination. If \f$m_{i,j}^{(0)}\f$ are the entries of the
89 * original matrix, then the matrix is transformed into triangular
90 * form by applying the rules
92 * m_{i,j}^{(k+1)} = m_{i,j}^{(k)} - m_{i,k}^{(k)} m_{k,j}^{(k)} / m_{k,k}^{(k)}
94 * The determinant is then just the product of diagonal elements.
95 * Choose this algorithm only for purely numerical matrices. */
97 /** Division-free elimination. This is a modification of Gauss
98 * elimination where the division by the pivot element is not
99 * carried out. If \f$m_{i,j}^{(0)}\f$ are the entries of the
100 * original matrix, then the matrix is transformed into triangular
101 * form by applying the rules
103 * m_{i,j}^{(k+1)} = m_{i,j}^{(k)} m_{k,k}^{(k)} - m_{i,k}^{(k)} m_{k,j}^{(k)}
105 * The determinant can later be computed by inspecting the diagonal
106 * elements only. This algorithm is only there for the purpose of
107 * cross-checks. It is never fast. */
109 /** Laplace elimination. This is plain recursive elimination along
110 * minors although multiple minors are avoided by the algorithm.
111 * Although the algorithm is exponential in complexity it is
112 * frequently the fastest one when the matrix is populated by
113 * complicated symbolic expressions. */
115 /** Bareiss fraction-free elimination. This is a modification of
116 * Gauss elimination where the division by the pivot element is
117 * <EM>delayed</EM> until it can be carried out without computing
118 * GCDs. If \f$m_{i,j}^{(0)}\f$ are the entries of the original
119 * matrix, then the matrix is transformed into triangular form by
122 * 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)}
124 * (We have set \f$m_{-1,-1}^{(-1)}=1\f$ in order to avoid a case
125 * distinction in above formula.) It can be shown that nothing more
126 * than polynomial long division is needed for carrying out the
127 * division. The determinant can then be read of from the lower
128 * right entry. This algorithm is rarely fast for computing
134 /** Switch to control algorithm for linear system solving. */
138 /** Let the system choose. A heuristics is applied for automatic
139 * determination of a suitable algorithm. */
141 /** Gauss elimination. If \f$m_{i,j}^{(0)}\f$ are the entries of the
142 * original matrix, then the matrix is transformed into triangular
143 * form by applying the rules
145 * m_{i,j}^{(k+1)} = m_{i,j}^{(k)} - m_{i,k}^{(k)} m_{k,j}^{(k)} / m_{k,k}^{(k)}
147 * This algorithm is well-suited for numerical matrices but generally
148 * suffers from the expensive division (and computation of GCDs) at
151 /** Division-free elimination. This is a modification of Gauss
152 * elimination where the division by the pivot element is not
153 * carried out. If \f$m_{i,j}^{(0)}\f$ are the entries of the
154 * original matrix, then the matrix is transformed into triangular
155 * form by applying the rules
157 * m_{i,j}^{(k+1)} = m_{i,j}^{(k)} m_{k,k}^{(k)} - m_{i,k}^{(k)} m_{k,j}^{(k)}
159 * This algorithm is only there for the purpose of cross-checks.
160 * It suffers from exponential intermediate expression swell. Use it
161 * only for small systems. */
163 /** Bareiss fraction-free elimination. This is a modification of
164 * Gauss elimination where the division by the pivot element is
165 * <EM>delayed</EM> until it can be carried out without computing
166 * GCDs. If \f$m_{i,j}^{(0)}\f$ are the entries of the original
167 * matrix, then the matrix is transformed into triangular form by
170 * 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)}
172 * (We have set \f$m_{-1,-1}^{(-1)}=1\f$ in order to avoid a case
173 * distinction in above formula.) It can be shown that nothing more
174 * than polynomial long division is needed for carrying out the
175 * division. This is generally the fastest algorithm for solving
176 * linear systems. In contrast to division-free elimination it only
177 * has a linear expression swell. For two-dimensional systems, the
178 * two algorithms are equivalent, however. */
183 /** Flags to store information about the state of an object.
184 * @see basic::flags */
188 dynallocated = 0x0001, ///< heap-allocated (i.e. created by new if we want to be clever and bypass the stack, @see ex::construct_from_basic() )
189 evaluated = 0x0002, ///< .eval() has already done its job
190 expanded = 0x0004, ///< .expand(0) has already done its job (other expand() options ignore this flag)
191 hash_calculated = 0x0008, ///< .calchash() has already done its job
192 not_shareable = 0x0010 ///< don't share instances of this object between different expressions unless explicitly asked to (used by ex::compare())
196 /** Possible attributes an object can have. */
200 // answered by class numeric and symbols/constants in particular domains
217 // answered by class relation
222 relation_less_or_equal,
224 relation_greater_or_equal,
226 // answered by class symbol
229 // answered by class lst
232 // answered by class exprseq
235 // answered by classes numeric, symbol, add, mul, power
240 crational_polynomial,
244 // answered by class indexed
245 indexed, // class can carry indices
246 has_indices, // object has at least one index
248 // answered by class idx
258 noncommutative_composite
262 /** Strategies how to clean up the function remember cache.
263 * @see remember_table */
264 class remember_strategies {
267 delete_never, ///< Let table grow undefinitely
268 delete_lru, ///< Least recently used
269 delete_lfu, ///< Least frequently used
270 delete_cyclic ///< First (oldest) one in list
276 #endif // ndef __GINAC_FLAGS_H__