#include "symmetry.h"
#include "lst.h"
#include "numeric.h" // for factorial()
+#include "operators.h"
#include "print.h"
#include "archive.h"
#include "utils.h"
*/
//////////
-// default ctor, dtor, copy ctor, assignment operator and helpers
+// default constructor
//////////
symmetry::symmetry() : type(none)
tinfo_key = TINFO_symmetry;
}
-void symmetry::copy(const symmetry & other)
-{
- inherited::copy(other);
- type = other.type;
- indices = other.indices;
- children = other.children;
-}
-
-DEFAULT_DESTROY(symmetry)
-
//////////
// other constructors
//////////
//////////
/** Construct object from archive_node. */
-symmetry::symmetry(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
+symmetry::symmetry(const archive_node &n, lst &sym_lst) : inherited(n, sym_lst)
{
unsigned t;
if (!(n.find_unsigned("type", t)))
default: c.s << '?'; break;
}
c.s << '(';
- unsigned num = children.size();
- for (unsigned i=0; i<num; i++) {
+ size_t num = children.size();
+ for (size_t i=0; i<num; i++) {
children[i].print(c);
if (i != num - 1)
c.s << ",";
if (num < 2)
return e;
- // Transform object vector to a list
- exlist iv_lst;
- iv_lst.insert(iv_lst.begin(), first, last);
- lst orig_lst(iv_lst, true);
+ // Transform object vector to a lst (for subs())
+ lst orig_lst(first, last);
// Create index vectors for permutation
unsigned *iv = new unsigned[num], *iv2;
if (num < 2)
return e;
- // Transform object vector to a list
- exlist iv_lst;
- iv_lst.insert(iv_lst.begin(), first, last);
- lst orig_lst(iv_lst, true);
+ // Transform object vector to a lst (for subs())
+ lst orig_lst(first, last);
lst new_lst = orig_lst;
// Loop over all cyclic permutations (the first permutation, which is
/** Symmetrize expression over a list of objects (symbols, indices). */
ex ex::symmetrize(const lst & l) const
{
- exvector v;
- v.reserve(l.nops());
- for (unsigned i=0; i<l.nops(); i++)
- v.push_back(l.op(i));
+ exvector v(l.begin(), l.end());
return symm(*this, v.begin(), v.end(), false);
}
/** Antisymmetrize expression over a list of objects (symbols, indices). */
ex ex::antisymmetrize(const lst & l) const
{
- exvector v;
- v.reserve(l.nops());
- for (unsigned i=0; i<l.nops(); i++)
- v.push_back(l.op(i));
+ exvector v(l.begin(), l.end());
return symm(*this, v.begin(), v.end(), true);
}
* (symbols, indices). */
ex ex::symmetrize_cyclic(const lst & l) const
{
- exvector v;
- v.reserve(l.nops());
- for (unsigned i=0; i<l.nops(); i++)
- v.push_back(l.op(i));
+ exvector v(l.begin(), l.end());
return GiNaC::symmetrize_cyclic(*this, v.begin(), v.end());
}