return result;
}
+static unsigned clifford_check8()
+{
+ unsigned result = 0;
+
+ realsymbol a("a");
+ varidx mu(symbol("mu", "\\mu"), 1);
+
+ ex e = clifford_unit(mu, diag_matrix(lst(-1))), e0 = e.subs(mu==0);
+ result += ( exp(a*e0)*e0*e0 == -exp(e0*a) ) ? 0 : 1;
+
+ return result;
+}
+
unsigned exam_clifford()
{
unsigned result = 0;
result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst(-1, 0, 1, -1))))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst(-1, 0, 1, -1))));; cout << '.' << flush;
result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst(-3, 0, 2, -1))))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst(-3, 0, 2, -1))));; cout << '.' << flush;
+ return result;
+
realsymbol s("s"), t("t"); // symbolic entries in matric
result += clifford_check6<varidx>(ex_to<matrix>(diag_matrix(lst(-1, 1, s, t))))+clifford_check6<idx>(ex_to<matrix>(diag_matrix(lst(-1, 1, s, t))));; cout << '.' << flush;
result += clifford_check7(indexed(-2*minkmetric(), sy_symm(), xi, chi), dim); cout << '.' << flush;
result += clifford_check7(-2*delta_tensor(xi, chi), dim); cout << '.' << flush;
+ result += clifford_check8(); cout << '.' << flush;
+
return result;
}
ex clifford_unit(const ex & mu, const ex & metr, unsigned char rl)
{
- static ex unit = (new cliffordunit)->setflag(status_flags::dynallocated);
+ //static ex unit = (new cliffordunit)->setflag(status_flags::dynallocated);
+ 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"));
unsigned n = M.rows();
bool symmetric = true;
- static idx xi((new symbol)->setflag(status_flags::dynallocated), n),
+ //static idx xi((new symbol)->setflag(status_flags::dynallocated), n),
+ // chi((new symbol)->setflag(status_flags::dynallocated), n);
+ idx xi((new symbol)->setflag(status_flags::dynallocated), n),
chi((new symbol)->setflag(status_flags::dynallocated), n);
if ((n == M.cols()) && (n == ex_to<idx>(mu).get_dim())) {
for (unsigned i = 0; i < n; i++) {
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<idx>(mu).get_dim()),
+ //static varidx xi((new symbol)->setflag(status_flags::dynallocated), ex_to<idx>(mu).get_dim()),
+ // chi((new symbol)->setflag(status_flags::dynallocated), ex_to<idx>(mu).get_dim());
+ varidx xi((new symbol)->setflag(status_flags::dynallocated), ex_to<idx>(mu).get_dim()),
chi((new symbol)->setflag(status_flags::dynallocated), ex_to<idx>(mu).get_dim());
return clifford(unit, mu, indexed(metr, xi, chi), rl);
} else
ex expand(unsigned options=0) const;
ex eval(int level=0) const;
ex evalf(int level=0) const;
+ ex eval_ncmul(const exvector & v) const;
unsigned calchash() const;
ex series(const relational & r, int order, unsigned options = 0) const;
ex thiscontainer(const exvector & v) const;
throw(std::logic_error("function::evalf(): invalid nparams"));
}
+/**
+ * This method is defined to be in line with behaviour of function::return_type()
+ */
+ex function::eval_ncmul(const exvector & v) const
+{
+ // If this function is called then the list of arguments is non-empty
+ // and the first argument is non-commutative, see function::return_type()
+ return seq.begin()->eval_ncmul(v);
+}
+
unsigned function::calchash() const
{
unsigned v = golden_ratio_hash(golden_ratio_hash((p_int)tinfo()) ^ serial);