* Implementation of GiNaC's non-commutative products of expressions. */
/*
- * GiNaC Copyright (C) 1999-2006 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
return inherited::info(inf);
}
-typedef std::vector<int> intvector;
+typedef std::vector<std::size_t> uintvector;
ex ncmul::expand(unsigned options) const
{
// Now, look for all the factors that are sums and remember their
// position and number of terms.
- intvector positions_of_adds(expanded_seq.size());
- intvector number_of_add_operands(expanded_seq.size());
+ uintvector positions_of_adds(expanded_seq.size());
+ uintvector number_of_add_operands(expanded_seq.size());
size_t number_of_adds = 0;
size_t number_of_expanded_terms = 1;
exvector distrseq;
distrseq.reserve(number_of_expanded_terms);
- intvector k(number_of_adds);
+ uintvector k(number_of_adds);
/* Rename indices in the static members of the product */
exvector expanded_seq_mod;
exvector assocseq;
assocseq.reserve(factors);
cit = evaledseq.begin();
+ make_flat_inserter mf(evaledseq, true);
while (cit != citend)
- append_factors(assocseq, *cit++);
+ { ex factor = mf.handle_factor(*(cit++), 1);
+ append_factors(assocseq, factor);
+ }
// ncmul(x) -> x
if (assocseq.size()==1) return *(seq.begin());