A2 = A_symm.mul(A_symm);
ex e, e1;
- bool anticommuting = ex_to<clifford>(clifford_unit(nu, A)).is_anticommuting();
int result = 0;
// checks general identities and contractions for clifford_unit
result += check_equal_simplify(e, A.trace() * clifford_unit(mu, A));
e = clifford_unit(nu, A) * clifford_unit(mu, A) * clifford_unit(nu.toggle_variance(), A);
- if (anticommuting)
- result += check_equal_simplify(e, 2*indexed(A_symm, sy_symm(), mu, mu)*clifford_unit(mu, A) - A.trace()*clifford_unit(mu, A));
result += check_equal_simplify_term(e, 2 * indexed(A_symm, sy_symm(), nu.toggle_variance(), mu) *clifford_unit(nu, A)-A.trace()*clifford_unit(mu, A), mu);
e = clifford_unit(mu, A) * clifford_unit(nu, A)
* clifford_unit(mu.toggle_variance(), A) * clifford_unit(nu.toggle_variance(), A);
- if (anticommuting)
- result += check_equal_simplify(e, 2*A2.trace()*dirac_ONE() - pow(A.trace(), 2)*dirac_ONE());
result += check_equal_simplify_term2(e, 2*indexed(A_symm, sy_symm(), nu.toggle_variance(), mu.toggle_variance()) * clifford_unit(mu, A) * clifford_unit(nu, A) - pow(A.trace(), 2)*dirac_ONE());
e = clifford_unit(mu.toggle_variance(), A) * clifford_unit(nu, A)
* clifford_unit(mu, A) * clifford_unit(nu.toggle_variance(), A);
- if (anticommuting) {
- result += check_equal_simplify(e, 2*A2.trace()*dirac_ONE() - pow(A.trace(), 2)*dirac_ONE());
- e1 = remove_dirac_ONE(simplify_indexed(e));
- result += check_equal(e1, 2*A2.trace() - pow(A.trace(), 2));
- }
result += check_equal_simplify_term2(e, 2*indexed(A_symm, nu, mu) * clifford_unit(mu.toggle_variance(), A) * clifford_unit(nu.toggle_variance(), A) - pow(A.trace(), 2)*dirac_ONE());
e = clifford_unit(nu.toggle_variance(), A) * clifford_unit(rho.toggle_variance(), A)
* clifford_unit(mu, A) * clifford_unit(rho, A) * clifford_unit(nu, A);
e = e.simplify_indexed().collect(clifford_unit(mu, A));
- if (anticommuting)
- result += check_equal(e, (4*indexed(A2, sy_symm(), mu, mu) - 4 * indexed(A_symm, sy_symm(), mu, mu)*A.trace() +pow(A.trace(), 2)) * clifford_unit(mu, A));
result += check_equal_simplify_term(e, 4* indexed(A_symm, sy_symm(), nu.toggle_variance(), rho)*indexed(A_symm, sy_symm(), rho.toggle_variance(), mu) *clifford_unit(nu, A)
- 2*A.trace() * (clifford_unit(rho, A) * indexed(A_symm, sy_symm(), rho.toggle_variance(), mu)
e = clifford_unit(nu.toggle_variance(), A) * clifford_unit(rho, A)
* clifford_unit(mu, A) * clifford_unit(rho.toggle_variance(), A) * clifford_unit(nu, A);
e = e.simplify_indexed().collect(clifford_unit(mu, A));
- if (anticommuting)
- result += check_equal(e, (4*indexed(A2, sy_symm(), mu, mu) - 4*indexed(A_symm, sy_symm(), mu, mu)*A.trace() +pow(A.trace(), 2))* clifford_unit(mu, A));
result += check_equal_simplify_term(e, 4* indexed(A_symm, sy_symm(), nu.toggle_variance(), rho)*indexed(A_symm, sy_symm(), rho.toggle_variance(), mu) *clifford_unit(nu, A)
- 2*A.trace() * (clifford_unit(rho, A) * indexed(A_symm, sy_symm(), rho.toggle_variance(), mu)
result += clifford_check4(); cout << '.' << flush;
result += clifford_check5(); cout << '.' << flush;
-/*
// anticommuting, symmetric examples
result += clifford_check6(ex_to<matrix>(diag_matrix(lst(-1, 1, 1, 1)))); cout << '.' << flush;
result += clifford_check6(ex_to<matrix>(diag_matrix(lst(-1, -1, -1, -1)))); cout << '.' << flush;
0, 0, 1, 1,
0, 0, 0, 1;
result += clifford_check6(A); cout << '.' << flush;
-*/
symbol dim("D");
result += clifford_check7(minkmetric(), dim); cout << '.' << flush;
function
@example
- ex clifford_unit(const ex & mu, const ex & metr, unsigned char rl = 0,
- bool anticommuting = false);
+ ex clifford_unit(const ex & mu, const ex & metr, unsigned char rl = 0);
@end example
-where @code{mu} should be a @code{varidx} class object indexing the
-generators, an index @code{mu} with a numeric value may be of type
-@code{idx} as well.
+where @code{mu} should be a @code{idx} (or descendant) class object
+indexing the generators.
Parameter @code{metr} defines the metric @math{M(i, j)} and can be
represented by a square @code{matrix}, @code{tensormetric} or @code{indexed} class
object. In fact, any expression either with two free indices or without
object with two newly created indices with @code{metr} as its
@code{op(0)} will be used.
Optional parameter @code{rl} allows to distinguish different
-Clifford algebras, which will commute with each other. The last
-optional parameter @code{anticommuting} defines if the anticommuting
-assumption (i.e.
-@tex
-$e_i e_j + e_j e_i = 0$)
-@end tex
-@ifnottex
-e~i e~j + e~j e~i = 0)
-@end ifnottex
-will be used for contraction of Clifford units. If the @code{metric} is
-supplied by a @code{matrix} object, then the value of
-@code{anticommuting} is calculated automatically and the supplied one
-will be ignored. One can overcome this by giving @code{metric} through
-matrix wrapped into an @code{indexed} object.
+Clifford algebras, which will commute with each other.
Note that the call @code{clifford_unit(mu, minkmetric())} creates
something very close to @code{dirac_gamma(mu)}, although
@cindex @code{clifford::get_metric()}
The method @code{clifford::get_metric()} returns a metric defining this
Clifford number.
-@cindex @code{clifford::is_anticommuting()}
-The method @code{clifford::is_anticommuting()} returns the
-@code{anticommuting} property of a unit.
If the matrix @math{M(i, j)} is in fact symmetric you may prefer to create
the Clifford algebra units with a call like that
@example
@{
...
- varidx nu(symbol("nu"), 4);
+ idx i(symbol("i"), 4);
realsymbol s("s");
ex M = diag_matrix(lst(1, -1, 0, s));
- ex e = clifford_unit(nu, M);
- ex e0 = e.subs(nu == 0);
- ex e1 = e.subs(nu == 1);
- ex e2 = e.subs(nu == 2);
- ex e3 = e.subs(nu == 3);
+ ex e = clifford_unit(i, M);
+ ex e0 = e.subs(i == 0);
+ ex e1 = e.subs(i == 1);
+ ex e2 = e.subs(i == 2);
+ ex e3 = e.subs(i == 3);
...
@}
@end example
@example
ex lst_to_clifford(const ex & v, const ex & mu, const ex & metr,
- unsigned char rl = 0, bool anticommuting = false);
+ unsigned char rl = 0);
ex lst_to_clifford(const ex & v, const ex & e);
@end example
with @samp{e.k}
directly supplied in the second form of the procedure. In the first form
the Clifford unit @samp{e.k} is generated by the call of
-@code{clifford_unit(mu, metr, rl, anticommuting)}. The previous code may be rewritten
+@code{clifford_unit(mu, metr, rl)}. The previous code may be rewritten
with the help of @code{lst_to_clifford()} as follows
@example
@{
...
- varidx nu(symbol("nu"), 4);
+ idx i(symbol("i"), 4);
realsymbol s("s");
ex M = diag_matrix(lst(1, -1, 0, s));
- ex e0 = lst_to_clifford(lst(1, 0, 0, 0), nu, M);
- ex e1 = lst_to_clifford(lst(0, 1, 0, 0), nu, M);
- ex e2 = lst_to_clifford(lst(0, 0, 1, 0), nu, M);
- ex e3 = lst_to_clifford(lst(0, 0, 0, 1), nu, M);
+ ex e0 = lst_to_clifford(lst(1, 0, 0, 0), i, M);
+ ex e1 = lst_to_clifford(lst(0, 1, 0, 0), i, M);
+ ex e2 = lst_to_clifford(lst(0, 0, 1, 0), i, M);
+ ex e3 = lst_to_clifford(lst(0, 0, 0, 1), i, M);
...
@}
@end example
@example
ex clifford_moebius_map(const ex & a, const ex & b, const ex & c,
const ex & d, const ex & v, const ex & G,
- unsigned char rl = 0, bool anticommuting = false);
+ unsigned char rl = 0);
ex clifford_moebius_map(const ex & M, const ex & v, const ex & G,
- unsigned char rl = 0, bool anticommuting = false);
+ unsigned char rl = 0);
@end example
It takes a list or vector @code{v} and makes the Moebius (conformal or
the matrix @samp{M = [[a, b], [c, d]]}. The parameter @code{G} defines
the metric of the surrounding (pseudo-)Euclidean space. This can be an
indexed object, tensormetric, matrix or a Clifford unit, in the later
-case the optional parameters @code{rl} and @code{anticommuting} are
-ignored even if supplied. Depending from the type of @code{v} the
-returned value of this function is either a vector or a list holding vector's
-components.
+case the optional parameter @code{rl} is ignored even if supplied.
+Depending from the type of @code{v} the returned value of this function
+is either a vector or a list holding vector's components.
@cindex @code{clifford_max_label()}
Finally the function
// default constructors
//////////
-clifford::clifford() : representation_label(0), metric(0), anticommuting(true), commutator_sign(-1)
+clifford::clifford() : representation_label(0), metric(0), commutator_sign(-1)
{
tinfo_key = &clifford::tinfo_static;
}
/** Construct object without any indices. This constructor is for internal
* use only. Use the dirac_ONE() function instead.
* @see dirac_ONE */
-clifford::clifford(const ex & b, unsigned char rl, bool anticommut) : inherited(b), representation_label(rl), metric(0), anticommuting(anticommut), commutator_sign(-1)
+clifford::clifford(const ex & b, unsigned char rl) : inherited(b), representation_label(rl), metric(0), commutator_sign(-1)
{
tinfo_key = &clifford::tinfo_static;
}
* use only. Use the clifford_unit() or dirac_gamma() functions instead.
* @see clifford_unit
* @see dirac_gamma */
-clifford::clifford(const ex & b, const ex & mu, const ex & metr, unsigned char rl, bool anticommut, int comm_sign) : inherited(b, mu), representation_label(rl), metric(metr), anticommuting(anticommut), commutator_sign(comm_sign)
+clifford::clifford(const ex & b, const ex & mu, const ex & metr, unsigned char rl, int comm_sign) : inherited(b, mu), representation_label(rl), metric(metr), commutator_sign(comm_sign)
{
GINAC_ASSERT(is_a<varidx>(mu));
tinfo_key = &clifford::tinfo_static;
}
-clifford::clifford(unsigned char rl, const ex & metr, bool anticommut, int comm_sign, const exvector & v, bool discardable) : inherited(not_symmetric(), v, discardable), representation_label(rl), metric(metr), anticommuting(anticommut), commutator_sign(comm_sign)
+clifford::clifford(unsigned char rl, const ex & metr, int comm_sign, const exvector & v, bool discardable) : inherited(not_symmetric(), v, discardable), representation_label(rl), metric(metr), commutator_sign(comm_sign)
{
tinfo_key = &clifford::tinfo_static;
}
-clifford::clifford(unsigned char rl, const ex & metr, bool anticommut, int comm_sign, std::auto_ptr<exvector> vp) : inherited(not_symmetric(), vp), representation_label(rl), metric(metr), anticommuting(anticommut), commutator_sign(comm_sign)
+clifford::clifford(unsigned char rl, const ex & metr, int comm_sign, std::auto_ptr<exvector> vp) : inherited(not_symmetric(), vp), representation_label(rl), metric(metr), commutator_sign(comm_sign)
{
tinfo_key = &clifford::tinfo_static;
}
n.find_unsigned("label", rl);
representation_label = rl;
n.find_ex("metric", metric, sym_lst);
- n.find_bool("anticommuting", anticommuting);
n.find_unsigned("commutator_sign+1", rl);
commutator_sign = rl - 1;
}
inherited::archive(n);
n.add_unsigned("label", representation_label);
n.add_ex("metric", metric);
- n.add_bool("anticommuting", anticommuting);
n.add_unsigned("commutator_sign+1", commutator_sign+1);
}
return false;
}
-/** An utility function looking for a given metric within an exvector,
- * used in cliffordunit::contract_with(). */
-static int find_same_metric(exvector & v, ex & c)
-{
- for (size_t i=0; i<v.size(); i++) {
- if (is_a<indexed>(v[i]) && !is_a<clifford>(v[i])
- && ((ex_to<varidx>(c.op(1)) == ex_to<indexed>(v[i]).get_indices()[0]
- && ex_to<varidx>(c.op(1)) == ex_to<indexed>(v[i]).get_indices()[1])
- || (ex_to<varidx>(c.op(1)).toggle_variance() == ex_to<indexed>(v[i]).get_indices()[0]
- && ex_to<varidx>(c.op(1)).toggle_variance() == ex_to<indexed>(v[i]).get_indices()[1]))) {
- return i; // the index of the found term
- }
- }
- return -1; //nothing found
-}
-
/** Contraction of a Clifford unit with something else. */
bool cliffordunit::contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const
{
&& unit.same_metric(*other))
return false;
- // Find if a previous contraction produces the square of self
- int prev_square = find_same_metric(v, *self);
- const varidx d((new symbol)->setflag(status_flags::dynallocated), ex_to<idx>(self->op(1)).get_dim()),
- in1((new symbol)->setflag(status_flags::dynallocated), ex_to<idx>(self->op(1)).get_dim()),
- in2((new symbol)->setflag(status_flags::dynallocated), ex_to<idx>(self->op(1)).get_dim());
- ex squared_metric;
- if (prev_square > -1)
- squared_metric = simplify_indexed(indexed(v[prev_square].op(0), in1, d)
- * unit.get_metric(d.toggle_variance(), in2, true)).op(0);
-
exvector::iterator before_other = other - 1;
- const varidx & mu = ex_to<varidx>(self->op(1));
- const varidx & mu_toggle = ex_to<varidx>(other->op(1));
- const varidx & alpha = ex_to<varidx>(before_other->op(1));
+ ex mu = self->op(1);
+ ex mu_toggle = other->op(1);
+ ex alpha = before_other->op(1);
// e~mu e.mu = Tr ONE
if (other - self == 1) {
- if (prev_square > -1) {
- *self = indexed(squared_metric, mu, mu_toggle);
- v[prev_square] = _ex1;
- } else {
- *self = unit.get_metric(mu, mu_toggle, true);
- }
+ *self = unit.get_metric(mu, mu_toggle, true);
*other = dirac_ONE(rl);
return true;
} else if (other - self == 2) {
if (is_a<clifford>(*before_other) && ex_to<clifford>(*before_other).get_representation_label() == rl) {
- if (ex_to<clifford>(*self).is_anticommuting()) {
- // e~mu e~alpha e.mu = (2*pow(e~alpha, 2) -Tr(B)) e~alpha
- if (prev_square > -1) {
- *self = 2 * indexed(squared_metric, alpha, alpha)
- - indexed(squared_metric, mu, mu_toggle);
- v[prev_square] = _ex1;
- } else {
- *self = 2 * unit.get_metric(alpha, alpha, true) - unit.get_metric(mu, mu_toggle, true);
- }
- *other = _ex1;
- return true;
-
- } else {
- // e~mu e~alpha e.mu = 2*e~mu B(alpha, mu.toggle_variance())-Tr(B) e~alpha
- *self = 2 * (*self) * unit.get_metric(alpha, mu_toggle, true) - unit.get_metric(mu, mu_toggle, true) * (*before_other);
- *before_other = _ex1;
- *other = _ex1;
- return true;
- }
+ // e~mu e~alpha e.mu = 2*e~mu B(alpha, mu.toggle_variance())-Tr(B) e~alpha
+ *self = 2 * (*self) * unit.get_metric(alpha, mu_toggle, true) - unit.get_metric(mu, mu_toggle, true) * (*before_other);
+ *before_other = _ex1;
+ *other = _ex1;
+ return true;
+
} else {
// e~mu S e.mu = Tr S ONE
*self = unit.get_metric(mu, mu_toggle, true);
ex S = ncmul(exvector(self + 1, before_other), true);
if (is_a<clifford>(*before_other) && ex_to<clifford>(*before_other).get_representation_label() == rl) {
- if (ex_to<clifford>(*self).is_anticommuting()) {
- if (prev_square > -1) {
- *self = 2 * (*before_other) * S * indexed(squared_metric, alpha, alpha)
- - (*self) * S * (*other) * (*before_other);
- } else {
- *self = 2 * (*before_other) * S * unit.get_metric(alpha, alpha, true) - (*self) * S * (*other) * (*before_other);
- }
- } else {
- *self = 2 * (*self) * S * unit.get_metric(alpha, mu_toggle, true) - (*self) * S * (*other) * (*before_other);
- }
+ *self = 2 * (*self) * S * unit.get_metric(alpha, mu_toggle, true) - (*self) * S * (*other) * (*before_other);
} else {
// simply commutes
*self = (*self) * S * (*other) * (*before_other);
ex clifford::thiscontainer(const exvector & v) const
{
- return clifford(representation_label, metric, anticommuting, commutator_sign, v);
+ return clifford(representation_label, metric, commutator_sign, v);
}
ex clifford::thiscontainer(std::auto_ptr<exvector> vp) const
{
- return clifford(representation_label, metric, anticommuting, commutator_sign, vp);
+ return clifford(representation_label, metric, commutator_sign, vp);
}
ex diracgamma5::conjugate() const
ex dirac_ONE(unsigned char rl)
{
static ex ONE = (new diracone)->setflag(status_flags::dynallocated);
- return clifford(ONE, rl, false);
+ return clifford(ONE, rl);
}
-ex clifford_unit(const ex & mu, const ex & metr, unsigned char rl, bool anticommuting)
+ex clifford_unit(const ex & mu, const ex & metr, unsigned char rl)
{
static ex unit = (new cliffordunit)->setflag(status_flags::dynallocated);
if (!is_a<idx>(mu))
throw(std::invalid_argument("clifford_unit(): index of Clifford unit must be of type idx or varidx"));
- if (ex_to<idx>(mu).is_symbolic() && !is_a<varidx>(mu))
- throw(std::invalid_argument("clifford_unit(): symbolic index of Clifford unit must be of type varidx (not idx)"));
-
exvector indices = metr.get_free_indices();
if ((indices.size() == 2) && is_a<varidx>(indices[0]) && is_a<varidx>(indices[1])) {
- return clifford(unit, mu, metr, rl, anticommuting);
+ return clifford(unit, mu, metr, rl);
} else if (is_a<matrix>(metr)) {
matrix M = ex_to<matrix>(metr);
unsigned n = M.rows();
bool symmetric = true;
- anticommuting = true;
static varidx xi((new symbol)->setflag(status_flags::dynallocated), n),
chi((new symbol)->setflag(status_flags::dynallocated), n);
- if ((n == M.cols()) && (n == ex_to<varidx>(mu).get_dim())) {
+ if ((n == M.cols()) && (n == ex_to<idx>(mu).get_dim())) {
for (unsigned i = 0; i < n; i++) {
for (unsigned j = i+1; j < n; j++) {
if (M(i, j) != M(j, i)) {
symmetric = false;
}
- if (M(i, j) != -M(j, i)) {
- anticommuting = false;
- }
}
}
- return clifford(unit, mu, indexed(metr, symmetric?symmetric2():not_symmetric(), xi, chi), rl, anticommuting);
+ return clifford(unit, mu, indexed(metr, symmetric?symmetric2():not_symmetric(), xi, chi), rl);
} else {
throw(std::invalid_argument("clifford_unit(): metric for Clifford unit must be a square matrix with the same dimensions as index"));
}
} else if (indices.size() == 0) { // a tensor or other expression without indices
static varidx xi((new symbol)->setflag(status_flags::dynallocated), ex_to<varidx>(mu).get_dim()),
chi((new symbol)->setflag(status_flags::dynallocated), ex_to<varidx>(mu).get_dim());
- return clifford(unit, mu, indexed(metr, xi, chi), rl, anticommuting);
+ return clifford(unit, mu, indexed(metr, xi, chi), rl);
} else
throw(std::invalid_argument("clifford_unit(): metric for Clifford unit must be of type tensor, matrix or an expression with two free indices"));
}
static varidx xi((new symbol)->setflag(status_flags::dynallocated), ex_to<varidx>(mu).get_dim()),
chi((new symbol)->setflag(status_flags::dynallocated), ex_to<varidx>(mu).get_dim());
- return clifford(gamma, mu, indexed((new minkmetric)->setflag(status_flags::dynallocated), symmetric2(), xi, chi), rl, true);
+ return clifford(gamma, mu, indexed((new minkmetric)->setflag(status_flags::dynallocated), symmetric2(), xi, chi), rl);
}
ex dirac_gamma5(unsigned char rl)
static varidx xi((new symbol)->setflag(status_flags::dynallocated), dim),
chi((new symbol)->setflag(status_flags::dynallocated), dim);
- return clifford(e, varidx(0, dim), indexed((new minkmetric)->setflag(status_flags::dynallocated), symmetric2(), xi, chi), rl, true);
+ return clifford(e, varidx(0, dim), indexed((new minkmetric)->setflag(status_flags::dynallocated), symmetric2(), xi, chi), rl);
}
/** Check whether a given tinfo key (as returned by return_type_tinfo()
throw(std::invalid_argument("clifford_inverse(): cannot find inverse of Clifford number with zero norm!"));
}
-ex lst_to_clifford(const ex & v, const ex & mu, const ex & metr, unsigned char rl, bool anticommuting)
+ex lst_to_clifford(const ex & v, const ex & mu, const ex & metr, unsigned char rl)
{
if (!ex_to<idx>(mu).is_dim_numeric())
throw(std::invalid_argument("lst_to_clifford(): Index should have a numeric dimension"));
- ex e = clifford_unit(mu, metr, rl, anticommuting);
+ ex e = clifford_unit(mu, metr, rl);
return lst_to_clifford(v, e);
}
unsigned min, max;
if (is_a<clifford>(e)) {
- varidx mu = ex_to<varidx>(e.op(1));
- unsigned dim = (ex_to<numeric>(mu.get_dim())).to_int();
+ ex mu = e.op(1);
+ ex mu_toggle
+ = is_a<varidx>(mu) ? ex_to<varidx>(mu).toggle_variance() : mu;
+ unsigned dim = (ex_to<numeric>(ex_to<idx>(mu).get_dim())).to_int();
if (is_a<matrix>(v)) {
if (ex_to<matrix>(v).cols() > ex_to<matrix>(v).rows()) {
}
if (min == 1) {
if (dim == max)
- return indexed(v, ex_to<varidx>(mu).toggle_variance()) * e;
+ return indexed(v, mu_toggle) * e;
else
throw(std::invalid_argument("lst_to_clifford(): dimensions of vector and clifford unit mismatch"));
} else
throw(std::invalid_argument("lst_to_clifford(): first argument should be a vector (nx1 or 1xn matrix)"));
} else if (v.info(info_flags::list)) {
if (dim == ex_to<lst>(v).nops())
- return indexed(matrix(dim, 1, ex_to<lst>(v)), ex_to<varidx>(mu).toggle_variance()) * e;
+ return indexed(matrix(dim, 1, ex_to<lst>(v)), mu_toggle) * e;
else
throw(std::invalid_argument("lst_to_clifford(): list length and dimension of clifford unit mismatch"));
} else
static ex get_clifford_comp(const ex & e, const ex & c)
{
pointer_to_map_function_1arg<const ex &> fcn(get_clifford_comp, c);
- int ival = ex_to<numeric>(ex_to<varidx>(c.op(1)).get_value()).to_int();
+ int ival = ex_to<numeric>(ex_to<idx>(c.op(1)).get_value()).to_int();
if (is_a<add>(e) || e.info(info_flags::list) // || is_a<pseries>(e) || is_a<integral>(e)
|| is_a<matrix>(e))
if (ind < e.nops()) {
ex S = 1;
bool same_value_index, found_dummy;
- same_value_index = ( ex_to<varidx>(e.op(ind).op(1)).is_numeric()
- && (ival == ex_to<numeric>(ex_to<varidx>(e.op(ind).op(1)).get_value()).to_int()) );
+ same_value_index = ( ex_to<idx>(e.op(ind).op(1)).is_numeric()
+ && (ival == ex_to<numeric>(ex_to<idx>(e.op(ind).op(1)).get_value()).to_int()) );
found_dummy = same_value_index;
for(size_t j=0; j < e.nops(); j++)
if (j != ind)
found_dummy = true;
exvector::const_iterator it = ind_vec.begin(), itend = ind_vec.end();
while (it != itend) {
- S = S * e.op(j).subs(lst(ex_to<varidx>(*it) == ival, ex_to<varidx>(*it).toggle_variance() == ival), subs_options::no_pattern);
+ ex curridx = *it;
+ ex curridx_toggle = is_a<varidx>(curridx)
+ ? ex_to<varidx>(curridx).toggle_variance()
+ : curridx;
+ S = S * e.op(j).subs(lst(curridx == ival,
+ curridx_toggle == ival), subs_options::no_pattern);
++it;
}
} else
} else if (e.is_zero())
return e;
else if (is_a<clifford>(e) && ex_to<clifford>(e).same_metric(c))
- if ( ex_to<varidx>(e.op(1)).is_numeric() &&
- (ival != ex_to<numeric>(ex_to<varidx>(e.op(1)).get_value()).to_int()) )
+ if ( ex_to<idx>(e.op(1)).is_numeric() &&
+ (ival != ex_to<numeric>(ex_to<idx>(e.op(1)).get_value()).to_int()) )
return 0;
else
return 1;
lst clifford_to_lst(const ex & e, const ex & c, bool algebraic)
{
GINAC_ASSERT(is_a<clifford>(c));
- varidx mu = ex_to<varidx>(c.op(1));
- if (! mu.is_dim_numeric())
+ ex mu = c.op(1);
+ if (! ex_to<idx>(mu).is_dim_numeric())
throw(std::invalid_argument("clifford_to_lst(): index should have a numeric dimension"));
- unsigned int D = ex_to<numeric>(mu.get_dim()).to_int();
+ unsigned int D = ex_to<numeric>(ex_to<idx>(mu).get_dim()).to_int();
if (algebraic) // check if algebraic method is applicable
for (unsigned int i = 0; i < D; i++)
}
-ex clifford_moebius_map(const ex & a, const ex & b, const ex & c, const ex & d, const ex & v, const ex & G, unsigned char rl, bool anticommuting)
+ex clifford_moebius_map(const ex & a, const ex & b, const ex & c, const ex & d, const ex & v, const ex & G, unsigned char rl)
{
ex x, D, cu;
else throw(std::invalid_argument("clifford_moebius_map(): metric should be an indexed object, matrix, or a Clifford unit"));
varidx mu((new symbol)->setflag(status_flags::dynallocated), D);
- cu = clifford_unit(mu, G, rl, anticommuting);
+ cu = clifford_unit(mu, G, rl);
}
x = lst_to_clifford(v, cu);
return (is_a<matrix>(v) ? matrix(ex_to<matrix>(v).rows(), ex_to<matrix>(v).cols(), ex_to<lst>(e)) : e);
}
-ex clifford_moebius_map(const ex & M, const ex & v, const ex & G, unsigned char rl, bool anticommuting)
+ex clifford_moebius_map(const ex & M, const ex & v, const ex & G, unsigned char rl)
{
if (is_a<matrix>(M))
return clifford_moebius_map(ex_to<matrix>(M)(0,0), ex_to<matrix>(M)(0,1),
- ex_to<matrix>(M)(1,0), ex_to<matrix>(M)(1,1), v, G, rl, anticommuting);
+ ex_to<matrix>(M)(1,0), ex_to<matrix>(M)(1,1), v, G, rl);
else
throw(std::invalid_argument("clifford_moebius_map(): parameter M should be a matrix"));
}
// other constructors
public:
- clifford(const ex & b, unsigned char rl = 0, bool anticommut = false);
- clifford(const ex & b, const ex & mu, const ex & metr, unsigned char rl = 0, bool anticommut = false, int comm_sign = -1);
+ clifford(const ex & b, unsigned char rl = 0);
+ clifford(const ex & b, const ex & mu, const ex & metr, unsigned char rl = 0, int comm_sign = -1);
// internal constructors
- clifford(unsigned char rl, const ex & metr, bool anticommut, int comm_sign, const exvector & v, bool discardable = false);
- clifford(unsigned char rl, const ex & metr, bool anticommut, int comm_sign, std::auto_ptr<exvector> vp);
+ clifford(unsigned char rl, const ex & metr, int comm_sign, const exvector & v, bool discardable = false);
+ clifford(unsigned char rl, const ex & metr, int comm_sign, std::auto_ptr<exvector> vp);
// functions overriding virtual functions from base classes
public:
ex get_metric() const { return metric; }
virtual ex get_metric(const ex & i, const ex & j, bool symmetrised = false) const;
bool same_metric(const ex & other) const;
- bool is_anticommuting() const { return anticommuting; } //**< See the member variable anticommuting */
int get_commutator_sign() const { return commutator_sign; } //**< See the member variable commutator_sign */
inline size_t nops() const {return inherited::nops() + 1; }
protected:
unsigned char representation_label; /**< Representation label to distinguish independent spin lines */
ex metric; /**< Metric of the space, all constructors make it an indexed object */
- bool anticommuting; /**< Simplifications for anticommuting units is much simpler and we need this info readily available */
int commutator_sign; /**< It is the sign in the definition e~i e~j +/- e~j e~i = B(i, j) + B(j, i)*/
};
* @param metr Metric (should be indexed, tensmetric or a derived class, or a matrix)
* @param rl Representation label
* @return newly constructed Clifford unit object */
-ex clifford_unit(const ex & mu, const ex & metr, unsigned char rl = 0, bool anticommuting = false);
+ex clifford_unit(const ex & mu, const ex & metr, unsigned char rl = 0);
/** Create a Dirac gamma object.
*
* @param rl Representation label
* @param e Clifford unit object
* @return Clifford vector with given components */
-ex lst_to_clifford(const ex & v, const ex & mu, const ex & metr, unsigned char rl = 0, bool anticommuting = false);
+ex lst_to_clifford(const ex & v, const ex & mu, const ex & metr, unsigned char rl = 0);
ex lst_to_clifford(const ex & v, const ex & e);
/** An inverse function to lst_to_clifford(). For given Clifford vector extracts
* @param v Vector to be transformed
* @param G Metric of the surrounding space, may be a Clifford unit then the next parameter is ignored
* @param rl Representation label
- * @param anticommuting indicates if Clifford units anticommutes
* @return List of components of the transformed vector*/
-ex clifford_moebius_map(const ex & a, const ex & b, const ex & c, const ex & d, const ex & v, const ex & G, unsigned char rl = 0, bool anticommuting = false);
+ex clifford_moebius_map(const ex & a, const ex & b, const ex & c, const ex & d, const ex & v, const ex & G, unsigned char rl = 0);
/** The second form of Moebius transformations defined by a 2x2 Clifford matrix M
* This function takes the transformation matrix M as a single entity.
* @param v Vector to be transformed
* @param G Metric of the surrounding space, may be a Clifford unit then the next parameter is ignored
* @param rl Representation label
- * @param anticommuting indicates if Clifford units anticommutes
* @return List of components of the transformed vector*/
-ex clifford_moebius_map(const ex & M, const ex & v, const ex & G, unsigned char rl = 0, bool anticommuting = false);
+ex clifford_moebius_map(const ex & M, const ex & v, const ex & G, unsigned char rl = 0);
} // namespace GiNaC