+ } else if (is_a<matrix>(metr)) {
+ matrix M = ex_to<matrix>(metr);
+ unsigned n = M.rows();
+ bool symmetric = true;
+
+ //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 == get_dim_uint(mu))) {
+ for (unsigned i = 0; i < n; i++) {
+ for (unsigned j = i+1; j < n; j++) {
+ if (!M(i, j).is_equal(M(j, i))) {
+ symmetric = false;
+ }
+ }
+ }
+ 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<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
+ throw(std::invalid_argument("clifford_unit(): metric for Clifford unit must be of type tensor, matrix or an expression with two free indices"));