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