]> www.ginac.de Git - ginac.git/blob - ginac/tensor.cpp
Man-page mentions keywords real_symbols and complex_symbols.
[ginac.git] / ginac / tensor.cpp
1 /** @file tensor.cpp
2  *
3  *  Implementation of GiNaC's special tensors. */
4
5 /*
6  *  GiNaC Copyright (C) 1999-2004 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 #include <iostream>
24 #include <stdexcept>
25 #include <vector>
26
27 #include "tensor.h"
28 #include "idx.h"
29 #include "indexed.h"
30 #include "symmetry.h"
31 #include "relational.h"
32 #include "operators.h"
33 #include "lst.h"
34 #include "numeric.h"
35 #include "matrix.h"
36 #include "archive.h"
37 #include "utils.h"
38
39 namespace GiNaC {
40
41 GINAC_IMPLEMENT_REGISTERED_CLASS(tensor, basic)
42
43 GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(tensdelta, tensor,
44   print_func<print_dflt>(&tensdelta::do_print).
45   print_func<print_latex>(&tensdelta::do_print_latex))
46
47 GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(tensmetric, tensor,
48   print_func<print_dflt>(&tensmetric::do_print).
49   print_func<print_latex>(&tensmetric::do_print))
50
51 GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(minkmetric, tensmetric,
52   print_func<print_dflt>(&minkmetric::do_print).
53   print_func<print_latex>(&minkmetric::do_print_latex))
54
55 GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(spinmetric, tensmetric,
56   print_func<print_dflt>(&spinmetric::do_print).
57   print_func<print_latex>(&spinmetric::do_print_latex))
58
59 GINAC_IMPLEMENT_REGISTERED_CLASS_OPT(tensepsilon, tensor,
60   print_func<print_dflt>(&tensepsilon::do_print).
61   print_func<print_latex>(&tensepsilon::do_print_latex))
62
63 //////////
64 // constructors
65 //////////
66
67 tensor::tensor() : inherited(TINFO_tensor)
68 {
69         setflag(status_flags::evaluated | status_flags::expanded);
70 }
71
72 DEFAULT_CTOR(tensdelta)
73 DEFAULT_CTOR(tensmetric)
74
75 minkmetric::minkmetric() : pos_sig(false)
76 {
77         tinfo_key = TINFO_minkmetric;
78 }
79
80 spinmetric::spinmetric()
81 {
82         tinfo_key = TINFO_spinmetric;
83 }
84
85 minkmetric::minkmetric(bool ps) : pos_sig(ps)
86 {
87         tinfo_key = TINFO_minkmetric;
88 }
89
90 tensepsilon::tensepsilon() : minkowski(false), pos_sig(false)
91 {
92         tinfo_key = TINFO_tensepsilon;
93 }
94
95 tensepsilon::tensepsilon(bool mink, bool ps) : minkowski(mink), pos_sig(ps)
96 {
97         tinfo_key = TINFO_tensepsilon;
98 }
99
100 //////////
101 // archiving
102 //////////
103
104 DEFAULT_ARCHIVING(tensor)
105 DEFAULT_ARCHIVING(tensdelta)
106 DEFAULT_ARCHIVING(tensmetric)
107 DEFAULT_ARCHIVING(spinmetric)
108 DEFAULT_UNARCHIVE(minkmetric)
109 DEFAULT_UNARCHIVE(tensepsilon)
110
111 minkmetric::minkmetric(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst)
112 {
113         n.find_bool("pos_sig", pos_sig);
114 }
115
116 void minkmetric::archive(archive_node &n) const
117 {
118         inherited::archive(n);
119         n.add_bool("pos_sig", pos_sig);
120 }
121
122 tensepsilon::tensepsilon(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst)
123 {
124         n.find_bool("minkowski", minkowski);
125         n.find_bool("pos_sig", pos_sig);
126 }
127
128 void tensepsilon::archive(archive_node &n) const
129 {
130         inherited::archive(n);
131         n.add_bool("minkowski", minkowski);
132         n.add_bool("pos_sig", pos_sig);
133 }
134
135 //////////
136 // functions overriding virtual functions from base classes
137 //////////
138
139 DEFAULT_COMPARE(tensor)
140 DEFAULT_COMPARE(tensdelta)
141 DEFAULT_COMPARE(tensmetric)
142 DEFAULT_COMPARE(spinmetric)
143
144 int minkmetric::compare_same_type(const basic & other) const
145 {
146         GINAC_ASSERT(is_a<minkmetric>(other));
147         const minkmetric &o = static_cast<const minkmetric &>(other);
148
149         if (pos_sig != o.pos_sig)
150                 return pos_sig ? -1 : 1;
151         else
152                 return inherited::compare_same_type(other);
153 }
154
155 int tensepsilon::compare_same_type(const basic & other) const
156 {
157         GINAC_ASSERT(is_a<tensepsilon>(other));
158         const tensepsilon &o = static_cast<const tensepsilon &>(other);
159
160         if (minkowski != o.minkowski)
161                 return minkowski ? -1 : 1;
162         else if (pos_sig != o.pos_sig)
163                 return pos_sig ? -1 : 1;
164         else
165                 return inherited::compare_same_type(other);
166 }
167
168 DEFAULT_PRINT_LATEX(tensdelta, "delta", "\\delta")
169 DEFAULT_PRINT(tensmetric, "g")
170 DEFAULT_PRINT_LATEX(minkmetric, "eta", "\\eta")
171 DEFAULT_PRINT_LATEX(spinmetric, "eps", "\\varepsilon")
172 DEFAULT_PRINT_LATEX(tensepsilon, "eps", "\\varepsilon")
173
174 /** Automatic symbolic evaluation of an indexed delta tensor. */
175 ex tensdelta::eval_indexed(const basic & i) const
176 {
177         GINAC_ASSERT(is_a<indexed>(i));
178         GINAC_ASSERT(i.nops() == 3);
179         GINAC_ASSERT(is_a<tensdelta>(i.op(0)));
180
181         const idx & i1 = ex_to<idx>(i.op(1));
182         const idx & i2 = ex_to<idx>(i.op(2));
183
184         // The dimension of the indices must be equal, otherwise we use the minimal
185         // dimension
186         if (!i1.get_dim().is_equal(i2.get_dim())) {
187                 ex min_dim = i1.minimal_dim(i2);
188                 exmap m;
189                 m[i1] = i1.replace_dim(min_dim);
190                 m[i2] = i2.replace_dim(min_dim);
191                 return i.subs(m, subs_options::no_pattern);
192         }
193
194         // Trace of delta tensor is the (effective) dimension of the space
195         if (is_dummy_pair(i1, i2)) {
196                 try {
197                         return i1.minimal_dim(i2);
198                 } catch (std::exception &e) {
199                         return i.hold();
200                 }
201         }
202
203         // Numeric evaluation
204         if (static_cast<const indexed &>(i).all_index_values_are(info_flags::integer)) {
205                 int n1 = ex_to<numeric>(i1.get_value()).to_int(), n2 = ex_to<numeric>(i2.get_value()).to_int();
206                 if (n1 == n2)
207                         return _ex1;
208                 else
209                         return _ex0;
210         }
211
212         // No further simplifications
213         return i.hold();
214 }
215
216 /** Automatic symbolic evaluation of an indexed metric tensor. */
217 ex tensmetric::eval_indexed(const basic & i) const
218 {
219         GINAC_ASSERT(is_a<indexed>(i));
220         GINAC_ASSERT(i.nops() == 3);
221         GINAC_ASSERT(is_a<tensmetric>(i.op(0)));
222         GINAC_ASSERT(is_a<varidx>(i.op(1)));
223         GINAC_ASSERT(is_a<varidx>(i.op(2)));
224
225         const varidx & i1 = ex_to<varidx>(i.op(1));
226         const varidx & i2 = ex_to<varidx>(i.op(2));
227
228         // The dimension of the indices must be equal, otherwise we use the minimal
229         // dimension
230         if (!i1.get_dim().is_equal(i2.get_dim())) {
231                 ex min_dim = i1.minimal_dim(i2);
232                 exmap m;
233                 m[i1] = i1.replace_dim(min_dim);
234                 m[i2] = i2.replace_dim(min_dim);
235                 return i.subs(m, subs_options::no_pattern);
236         }
237
238         // A metric tensor with one covariant and one contravariant index gets
239         // replaced by a delta tensor
240         if (i1.is_covariant() != i2.is_covariant())
241                 return delta_tensor(i1, i2);
242
243         // No further simplifications
244         return i.hold();
245 }
246
247 /** Automatic symbolic evaluation of an indexed Lorentz metric tensor. */
248 ex minkmetric::eval_indexed(const basic & i) const
249 {
250         GINAC_ASSERT(is_a<indexed>(i));
251         GINAC_ASSERT(i.nops() == 3);
252         GINAC_ASSERT(is_a<minkmetric>(i.op(0)));
253         GINAC_ASSERT(is_a<varidx>(i.op(1)));
254         GINAC_ASSERT(is_a<varidx>(i.op(2)));
255
256         const varidx & i1 = ex_to<varidx>(i.op(1));
257         const varidx & i2 = ex_to<varidx>(i.op(2));
258
259         // Numeric evaluation
260         if (static_cast<const indexed &>(i).all_index_values_are(info_flags::nonnegint)) {
261                 int n1 = ex_to<numeric>(i1.get_value()).to_int(), n2 = ex_to<numeric>(i2.get_value()).to_int();
262                 if (n1 != n2)
263                         return _ex0;
264                 else if (n1 == 0)
265                         return pos_sig ? _ex_1 : _ex1;
266                 else
267                         return pos_sig ? _ex1 : _ex_1;
268         }
269
270         // Perform the usual evaluations of a metric tensor
271         return inherited::eval_indexed(i);
272 }
273
274 /** Automatic symbolic evaluation of an indexed metric tensor. */
275 ex spinmetric::eval_indexed(const basic & i) const
276 {
277         GINAC_ASSERT(is_a<indexed>(i));
278         GINAC_ASSERT(i.nops() == 3);
279         GINAC_ASSERT(is_a<spinmetric>(i.op(0)));
280         GINAC_ASSERT(is_a<spinidx>(i.op(1)));
281         GINAC_ASSERT(is_a<spinidx>(i.op(2)));
282
283         const spinidx & i1 = ex_to<spinidx>(i.op(1));
284         const spinidx & i2 = ex_to<spinidx>(i.op(2));
285
286         // Convolutions are zero
287         if (!(static_cast<const indexed &>(i).get_dummy_indices().empty()))
288                 return _ex0;
289
290         // Numeric evaluation
291         if (static_cast<const indexed &>(i).all_index_values_are(info_flags::nonnegint)) {
292                 int n1 = ex_to<numeric>(i1.get_value()).to_int(), n2 = ex_to<numeric>(i2.get_value()).to_int();
293                 if (n1 == n2)
294                         return _ex0;
295                 else if (n1 < n2)
296                         return _ex1;
297                 else
298                         return _ex_1;
299         }
300
301         // No further simplifications
302         return i.hold();
303 }
304
305 /** Automatic symbolic evaluation of an indexed epsilon tensor. */
306 ex tensepsilon::eval_indexed(const basic & i) const
307 {
308         GINAC_ASSERT(is_a<indexed>(i));
309         GINAC_ASSERT(i.nops() > 1);
310         GINAC_ASSERT(is_a<tensepsilon>(i.op(0)));
311
312         // Convolutions are zero
313         if (!(static_cast<const indexed &>(i).get_dummy_indices().empty()))
314                 return _ex0;
315
316         // Numeric evaluation
317         if (static_cast<const indexed &>(i).all_index_values_are(info_flags::nonnegint)) {
318
319                 // Get sign of index permutation (the indices should already be in
320                 // a canonic order but we can't assume what exactly that order is)
321                 std::vector<int> v;
322                 v.reserve(i.nops() - 1);
323                 for (size_t j=1; j<i.nops(); j++)
324                         v.push_back(ex_to<numeric>(ex_to<idx>(i.op(j)).get_value()).to_int());
325                 int sign = permutation_sign(v.begin(), v.end());
326
327                 // In a Minkowski space, check for covariant indices
328                 if (minkowski) {
329                         for (size_t j=1; j<i.nops(); j++) {
330                                 const ex & x = i.op(j);
331                                 if (!is_a<varidx>(x))
332                                         throw(std::runtime_error("indices of epsilon tensor in Minkowski space must be of type varidx"));
333                                 if (ex_to<varidx>(x).is_covariant())
334                                         if (ex_to<idx>(x).get_value().is_zero())
335                                                 sign = (pos_sig ? -sign : sign);
336                                         else
337                                                 sign = (pos_sig ? sign : -sign);
338                         }
339                 }
340
341                 return sign;
342         }
343
344         // No further simplifications
345         return i.hold();
346 }
347
348 bool tensor::replace_contr_index(exvector::iterator self, exvector::iterator other) const
349 {
350         // Try to contract the first index
351         const idx *self_idx = &ex_to<idx>(self->op(1));
352         const idx *free_idx = &ex_to<idx>(self->op(2));
353         bool first_index_tried = false;
354
355 again:
356         if (self_idx->is_symbolic()) {
357                 for (size_t i=1; i<other->nops(); i++) {
358                         const idx &other_idx = ex_to<idx>(other->op(i));
359                         if (is_dummy_pair(*self_idx, other_idx)) {
360
361                                 // Contraction found, remove this tensor and substitute the
362                                 // index in the second object
363                                 try {
364                                         // minimal_dim() throws an exception when index dimensions are not comparable
365                                         ex min_dim = self_idx->minimal_dim(other_idx);
366                                         *other = other->subs(other_idx == free_idx->replace_dim(min_dim));
367                                         *self = _ex1; // *other is assigned first because assigning *self invalidates free_idx
368                                         return true;
369                                 } catch (std::exception &e) {
370                                         return false;
371                                 }
372                         }
373                 }
374         }
375
376         if (!first_index_tried) {
377
378                 // No contraction with the first index found, try the second index
379                 self_idx = &ex_to<idx>(self->op(2));
380                 free_idx = &ex_to<idx>(self->op(1));
381                 first_index_tried = true;
382                 goto again;
383         }
384
385         return false;
386 }
387
388 /** Contraction of an indexed delta tensor with something else. */
389 bool tensdelta::contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const
390 {
391         GINAC_ASSERT(is_a<indexed>(*self));
392         GINAC_ASSERT(is_a<indexed>(*other));
393         GINAC_ASSERT(self->nops() == 3);
394         GINAC_ASSERT(is_a<tensdelta>(self->op(0)));
395
396         // Replace the dummy index with this tensor's other index and remove
397         // the tensor (this is valid for contractions with all other tensors)
398         return replace_contr_index(self, other);
399 }
400
401 /** Contraction of an indexed metric tensor with something else. */
402 bool tensmetric::contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const
403 {
404         GINAC_ASSERT(is_a<indexed>(*self));
405         GINAC_ASSERT(is_a<indexed>(*other));
406         GINAC_ASSERT(self->nops() == 3);
407         GINAC_ASSERT(is_a<tensmetric>(self->op(0)));
408
409         // If contracting with the delta tensor, let the delta do it
410         // (don't raise/lower delta indices)
411         if (is_a<tensdelta>(other->op(0)))
412                 return false;
413
414         // Replace the dummy index with this tensor's other index and remove
415         // the tensor
416         return replace_contr_index(self, other);
417 }
418
419 /** Contraction of an indexed spinor metric with something else. */
420 bool spinmetric::contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const
421 {
422         GINAC_ASSERT(is_a<indexed>(*self));
423         GINAC_ASSERT(is_a<indexed>(*other));
424         GINAC_ASSERT(self->nops() == 3);
425         GINAC_ASSERT(is_a<spinmetric>(self->op(0)));
426
427         // Contractions between spinor metrics
428         if (is_a<spinmetric>(other->op(0))) {
429                 const idx &self_i1 = ex_to<idx>(self->op(1));
430                 const idx &self_i2 = ex_to<idx>(self->op(2));
431                 const idx &other_i1 = ex_to<idx>(other->op(1));
432                 const idx &other_i2 = ex_to<idx>(other->op(2));
433
434                 if (is_dummy_pair(self_i1, other_i1)) {
435                         if (is_dummy_pair(self_i2, other_i2))
436                                 *self = _ex2;
437                         else
438                                 *self = delta_tensor(self_i2, other_i2);
439                         *other = _ex1;
440                         return true;
441                 } else if (is_dummy_pair(self_i1, other_i2)) {
442                         if (is_dummy_pair(self_i2, other_i1))
443                                 *self = _ex_2;
444                         else
445                                 *self = -delta_tensor(self_i2, other_i1);
446                         *other = _ex1;
447                         return true;
448                 } else if (is_dummy_pair(self_i2, other_i1)) {
449                         *self = -delta_tensor(self_i1, other_i2);
450                         *other = _ex1;
451                         return true;
452                 } else if (is_dummy_pair(self_i2, other_i2)) {
453                         *self = delta_tensor(self_i1, other_i1);
454                         *other = _ex1;
455                         return true;
456                 }
457         }
458
459         // If contracting with the delta tensor, let the delta do it
460         // (don't raise/lower delta indices)
461         if (is_a<tensdelta>(other->op(0)))
462                 return false;
463
464         // Try to contract first index
465         const idx *self_idx = &ex_to<idx>(self->op(1));
466         const idx *free_idx = &ex_to<idx>(self->op(2));
467         bool first_index_tried = false;
468         int sign = 1;
469
470 again:
471         if (self_idx->is_symbolic()) {
472                 for (size_t i=1; i<other->nops(); i++) {
473                         const idx &other_idx = ex_to<idx>(other->op(i));
474                         if (is_dummy_pair(*self_idx, other_idx)) {
475
476                                 // Contraction found, remove metric tensor and substitute
477                                 // index in second object (assign *self last because this
478                                 // invalidates free_idx)
479                                 *other = other->subs(other_idx == *free_idx);
480                                 *self = (static_cast<const spinidx *>(self_idx)->is_covariant() ? sign : -sign);
481                                 return true;
482                         }
483                 }
484         }
485
486         if (!first_index_tried) {
487
488                 // No contraction with first index found, try second index
489                 self_idx = &ex_to<idx>(self->op(2));
490                 free_idx = &ex_to<idx>(self->op(1));
491                 first_index_tried = true;
492                 sign = -sign;
493                 goto again;
494         }
495
496         return false;
497 }
498
499 /** Contraction of epsilon tensor with something else. */
500 bool tensepsilon::contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const
501 {
502         GINAC_ASSERT(is_a<indexed>(*self));
503         GINAC_ASSERT(is_a<indexed>(*other));
504         GINAC_ASSERT(is_a<tensepsilon>(self->op(0)));
505         size_t num = self->nops() - 1;
506
507         if (is_exactly_a<tensepsilon>(other->op(0)) && num+1 == other->nops()) {
508
509                 // Contraction of two epsilon tensors is a determinant
510                 bool variance = is_a<varidx>(self->op(1));
511                 matrix M(num, num);
512                 for (size_t i=0; i<num; i++) {
513                         for (size_t j=0; j<num; j++) {
514                                 if (minkowski)
515                                         M(i, j) = lorentz_g(self->op(i+1), other->op(j+1), pos_sig);
516                                 else if (variance)
517                                         M(i, j) = metric_tensor(self->op(i+1), other->op(j+1));
518                                 else
519                                         M(i, j) = delta_tensor(self->op(i+1), other->op(j+1));
520                         }
521                 }
522                 int sign = minkowski ? -1 : 1;
523                 *self = sign * M.determinant().simplify_indexed();
524                 *other = _ex1;
525                 return true;
526         }
527
528         return false;
529 }
530
531 //////////
532 // global functions
533 //////////
534
535 ex delta_tensor(const ex & i1, const ex & i2)
536 {
537         if (!is_a<idx>(i1) || !is_a<idx>(i2))
538                 throw(std::invalid_argument("indices of delta tensor must be of type idx"));
539
540         return indexed(tensdelta(), sy_symm(), i1, i2);
541 }
542
543 ex metric_tensor(const ex & i1, const ex & i2)
544 {
545         if (!is_a<varidx>(i1) || !is_a<varidx>(i2))
546                 throw(std::invalid_argument("indices of metric tensor must be of type varidx"));
547
548         return indexed(tensmetric(), sy_symm(), i1, i2);
549 }
550
551 ex lorentz_g(const ex & i1, const ex & i2, bool pos_sig)
552 {
553         if (!is_a<varidx>(i1) || !is_a<varidx>(i2))
554                 throw(std::invalid_argument("indices of metric tensor must be of type varidx"));
555
556         return indexed(minkmetric(pos_sig), sy_symm(), i1, i2);
557 }
558
559 ex spinor_metric(const ex & i1, const ex & i2)
560 {
561         if (!is_a<spinidx>(i1) || !is_a<spinidx>(i2))
562                 throw(std::invalid_argument("indices of spinor metric must be of type spinidx"));
563         if (!ex_to<idx>(i1).get_dim().is_equal(2) || !ex_to<idx>(i2).get_dim().is_equal(2))
564                 throw(std::runtime_error("index dimension for spinor metric must be 2"));
565
566         return indexed(spinmetric(), sy_anti(), i1, i2);
567 }
568
569 ex epsilon_tensor(const ex & i1, const ex & i2)
570 {
571         if (!is_a<idx>(i1) || !is_a<idx>(i2))
572                 throw(std::invalid_argument("indices of epsilon tensor must be of type idx"));
573
574         ex dim = ex_to<idx>(i1).get_dim();
575         if (!dim.is_equal(ex_to<idx>(i2).get_dim()))
576                 throw(std::invalid_argument("all indices of epsilon tensor must have the same dimension"));
577         if (!ex_to<idx>(i1).get_dim().is_equal(_ex2))
578                 throw(std::runtime_error("index dimension of epsilon tensor must match number of indices"));
579
580         return indexed(tensepsilon(), sy_anti(), i1, i2);
581 }
582
583 ex epsilon_tensor(const ex & i1, const ex & i2, const ex & i3)
584 {
585         if (!is_a<idx>(i1) || !is_a<idx>(i2) || !is_a<idx>(i3))
586                 throw(std::invalid_argument("indices of epsilon tensor must be of type idx"));
587
588         ex dim = ex_to<idx>(i1).get_dim();
589         if (!dim.is_equal(ex_to<idx>(i2).get_dim()) || !dim.is_equal(ex_to<idx>(i3).get_dim()))
590                 throw(std::invalid_argument("all indices of epsilon tensor must have the same dimension"));
591         if (!ex_to<idx>(i1).get_dim().is_equal(_ex3))
592                 throw(std::runtime_error("index dimension of epsilon tensor must match number of indices"));
593
594         return indexed(tensepsilon(), sy_anti(), i1, i2, i3);
595 }
596
597 ex lorentz_eps(const ex & i1, const ex & i2, const ex & i3, const ex & i4, bool pos_sig)
598 {
599         if (!is_a<varidx>(i1) || !is_a<varidx>(i2) || !is_a<varidx>(i3) || !is_a<varidx>(i4))
600                 throw(std::invalid_argument("indices of Lorentz epsilon tensor must be of type varidx"));
601
602         ex dim = ex_to<idx>(i1).get_dim();
603         if (!dim.is_equal(ex_to<idx>(i2).get_dim()) || !dim.is_equal(ex_to<idx>(i3).get_dim()) || !dim.is_equal(ex_to<idx>(i4).get_dim()))
604                 throw(std::invalid_argument("all indices of epsilon tensor must have the same dimension"));
605         if (!ex_to<idx>(i1).get_dim().is_equal(_ex4))
606                 throw(std::runtime_error("index dimension of epsilon tensor must match number of indices"));
607
608         return indexed(tensepsilon(true, pos_sig), sy_anti(), i1, i2, i3, i4);
609 }
610
611 } // namespace GiNaC