- // check for delta8_{a,b} where a and b are numeric indices, replace by 0 or 1
- if ((!idx1.is_symbolic())&&(!idx2.is_symbolic())) {
- if ((idx1.get_value()!=idx2.get_value())) {
- return _ex1();
- } else {
- return _ex0();
- }
- }
- }
- break;
- case color_d:
- // check for d_{a,a,c} (=0) when a is symbolic
- {
- GINAC_ASSERT(seq.size()==3);
- const coloridx & idx1=ex_to_coloridx(seq[0]);
- const coloridx & idx2=ex_to_coloridx(seq[1]);
- const coloridx & idx3=ex_to_coloridx(seq[2]);
-
- if (idx1.is_equal_same_type(idx2) && idx1.is_symbolic()) {
- return _ex0();
- } else if (idx2.is_equal_same_type(idx3) && idx2.is_symbolic()) {
- return _ex0();
- }
-
- // check for three numeric indices
- if (!(idx1.is_symbolic()||idx2.is_symbolic()||idx3.is_symbolic())) {
- GINAC_ASSERT(idx1.get_value()<=idx2.get_value());
- GINAC_ASSERT(idx2.get_value()<=idx3.get_value());
- if (CMPINDICES(1,4,6)||CMPINDICES(1,5,7)||CMPINDICES(2,5,6)||
- CMPINDICES(3,4,4)||CMPINDICES(3,5,5)) {
- return _ex1_2();
- } else if (CMPINDICES(2,4,7)||CMPINDICES(3,6,6)||CMPINDICES(3,7,7)) {
- return -_ex1_2();
- } else if (CMPINDICES(1,1,8)||CMPINDICES(2,2,8)||CMPINDICES(3,3,8)) {
- return 1/sqrt(numeric(3));
- } else if (CMPINDICES(8,8,8)) {
- return -1/sqrt(numeric(3));
- } else if (CMPINDICES(4,4,8)||CMPINDICES(5,5,8)||CMPINDICES(6,6,8)||CMPINDICES(7,7,8)) {
- return -1/(2*sqrt(numeric(3)));
- }
- return _ex0();
- }
- }
- break;
- case color_f:
- {
- GINAC_ASSERT(seq.size()==3);
- const coloridx & idx1=ex_to_coloridx(seq[0]);
- const coloridx & idx2=ex_to_coloridx(seq[1]);
- const coloridx & idx3=ex_to_coloridx(seq[2]);
-
- // check for three numeric indices
- if (!(idx1.is_symbolic()||idx2.is_symbolic()||idx3.is_symbolic())) {
- GINAC_ASSERT(idx1.get_value()<=idx2.get_value());
- GINAC_ASSERT(idx2.get_value()<=idx3.get_value());
- if (CMPINDICES(1,2,3)) {
- return _ex1();
- } else if (CMPINDICES(1,4,7)||CMPINDICES(2,4,6)||
- CMPINDICES(2,5,7)||CMPINDICES(3,4,5)) {
- return _ex1_2();
- } else if (CMPINDICES(1,5,6)||CMPINDICES(3,6,7)) {
- return -_ex1_2();
- } else if (CMPINDICES(4,5,8)||CMPINDICES(6,7,8)) {
- return sqrt(numeric(3))/2;
- } else if (CMPINDICES(8,8,8)) {
- return -1/sqrt(numeric(3));
- } else if (CMPINDICES(4,4,8)||CMPINDICES(5,5,8)||CMPINDICES(6,6,8)||CMPINDICES(7,7,8)) {
- return -1/(2*sqrt(numeric(3)));
- }
- return _ex0();
- }
- break;
- }
- default:
- // nothing to evaluate
- break;