else if (is_a<ncmul>(e) || is_a<mul>(e)) {
// find a Clifford unit with the same metric, delete it and substitute its index
size_t ind = e.nops() + 1;
- for (size_t j = 0; j < e.nops(); j++)
- if (is_a<clifford>(e.op(j)) && ex_to<clifford>(c).same_metric(e.op(j)))
- if (ind > e.nops())
+ for (size_t j = 0; j < e.nops(); j++) {
+ if (is_a<clifford>(e.op(j)) && ex_to<clifford>(c).same_metric(e.op(j))) {
+ if (ind > e.nops()) {
ind = j;
- else
+ }
+ else {
throw(std::invalid_argument("get_clifford_comp(): expression is a Clifford multi-vector"));
+ }
+ }
+ }
if (ind < e.nops()) {
ex S = 1;
bool same_value_index, found_dummy;
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)
- if (same_value_index)
+ for (size_t j=0; j < e.nops(); j++) {
+ if (j != ind) {
+ if (same_value_index) {
S = S * e.op(j);
+ }
else {
exvector ind_vec = ex_to<indexed>(e.op(j)).get_dummy_indices(ex_to<indexed>(e.op(ind)));
if (ind_vec.size() > 0) {
} else
S = S * e.op(j);
}
+ }
+ }
return (found_dummy ? S : 0);
} else
throw(std::invalid_argument("get_clifford_comp(): expression is not a Clifford vector to the given units"));
}
}
// X_n
- for (int n=2; n<Xn.size(); ++n) {
+ for (size_t n=2; n<Xn.size(); ++n) {
for (int i=xninitsize+1; i<=xend; ++i) {
if (i & 1) {
result = 0; // k == 0
Gparameter a(x.size());
exmap subslst;
std::size_t pos = 1;
- int scale;
+ int scale = pos;
for (sortmap_t::const_iterator it = sortmap.begin(); it != sortmap.end(); ++it) {
if (it->second < x.size()) {
if (s[it->second] > 0) {
int Sm = 0;
int Smp1 = 0;
std::vector<std::vector<cln::cl_N> > crG(s.size() - 1, std::vector<cln::cl_N>(L2 + 1));
- for (int m=0; m < s.size() - 1; m++) {
+ for (int m=0; m < (int)s.size() - 1; m++) {
Sm += s[m];
Smp1 = Sm + s[m+1];
for (int i = 0; i <= L2; i++)
int factor, int &nummatches, const std::vector<bool> &subsed,
std::vector<bool> &matched)
{
- if (factor == pat.nops())
+ if (factor == (int)pat.nops())
return true;
for (size_t i=0; i<e.nops(); ++i) {
// F(2n+2) = F(n+1)*(2*F(n) + F(n+1))
if (n.is_zero())
return *_num0_p;
- if (n.is_negative())
- if (n.is_even())
+ if (n.is_negative()) {
+ if (n.is_even()) {
return -fibonacci(-n);
- else
+ }
+ else {
return fibonacci(-n);
+ }
+ }
cln::cl_I u(0);
cln::cl_I v(1);
const ex & ebasis = level==1 ? basis : basis.eval(level-1);
const ex & eexponent = level==1 ? exponent : exponent.eval(level-1);
- bool basis_is_numerical = false;
- bool exponent_is_numerical = false;
- const numeric *num_basis;
- const numeric *num_exponent;
+ const numeric *num_basis = NULL;
+ const numeric *num_exponent = NULL;
if (is_exactly_a<numeric>(ebasis)) {
- basis_is_numerical = true;
num_basis = &ex_to<numeric>(ebasis);
}
if (is_exactly_a<numeric>(eexponent)) {
- exponent_is_numerical = true;
num_exponent = &ex_to<numeric>(eexponent);
}
return ebasis;
// ^(0,c1) -> 0 or exception (depending on real value of c1)
- if (ebasis.is_zero() && exponent_is_numerical) {
+ if ( ebasis.is_zero() && num_exponent ) {
if ((num_exponent->real()).is_zero())
throw (std::domain_error("power::eval(): pow(0,I) is undefined"));
else if ((num_exponent->real()).is_negative())
if (is_exactly_a<power>(ebasis) && ebasis.op(0).info(info_flags::positive) && ebasis.op(1).info(info_flags::real))
return power(ebasis.op(0), ebasis.op(1) * eexponent);
- if (exponent_is_numerical) {
+ if ( num_exponent ) {
// ^(c1,c2) -> c1^c2 (c1, c2 numeric(),
// except if c1,c2 are rational, but c1^c2 is not)
- if (basis_is_numerical) {
+ if ( num_basis ) {
const bool basis_is_crational = num_basis->is_crational();
const bool exponent_is_crational = num_exponent->is_crational();
if (!basis_is_crational || !exponent_is_crational) {
if (minkowski) {
for (size_t j=1; j<i.nops(); j++) {
const ex & x = i.op(j);
- if (!is_a<varidx>(x))
+ if (!is_a<varidx>(x)) {
throw(std::runtime_error("indices of epsilon tensor in Minkowski space must be of type varidx"));
- if (ex_to<varidx>(x).is_covariant())
- if (ex_to<idx>(x).get_value().is_zero())
+ }
+ if (ex_to<varidx>(x).is_covariant()) {
+ if (ex_to<idx>(x).get_value().is_zero()) {
sign = (pos_sig ? -sign : sign);
- else
+ }
+ else {
sign = (pos_sig ? sign : -sign);
+ }
+ }
}
}