#include "ncmul.h"
#include "symmetry.h"
#include "numeric.h"
+#include "mul.h"
#include "power.h" // for sqrt()
#include "symbol.h"
#include "print.h"
DEFAULT_ARCHIVING(su3d)
//////////
-// functions overriding virtual functions from bases classes
+// functions overriding virtual functions from base classes
//////////
int color::compare_same_type(const basic & other) const
{
- GINAC_ASSERT(other.tinfo() == TINFO_color);
+ GINAC_ASSERT(is_a<color>(other));
const color &o = static_cast<const color &>(other);
if (representation_label != o.representation_label) {
return inherited::compare_same_type(other);
}
+bool color::match_same_type(const basic & other) const
+{
+ GINAC_ASSERT(is_a<color>(other));
+ const color &o = static_cast<const color &>(other);
+
+ return representation_label == o.representation_label;
+}
+
DEFAULT_COMPARE(su3one)
DEFAULT_COMPARE(su3t)
DEFAULT_COMPARE(su3f)
it++;
}
- if (s.size() == 0)
+ if (s.empty())
return color(su3one(), representation_label);
else
return simplified_ncmul(s);
/** Automatic symbolic evaluation of indexed symmetric structure constant. */
ex su3d::eval_indexed(const basic & i) const
{
- GINAC_ASSERT(is_of_type(i, indexed));
+ GINAC_ASSERT(is_a<indexed>(i));
GINAC_ASSERT(i.nops() == 4);
- GINAC_ASSERT(is_ex_of_type(i.op(0), su3d));
+ GINAC_ASSERT(is_a<su3d>(i.op(0)));
// Convolutions are zero
- if (static_cast<const indexed &>(i).get_dummy_indices().size() != 0)
+ if (!(static_cast<const indexed &>(i).get_dummy_indices().empty()))
return _ex0();
// Numeric evaluation
/** Automatic symbolic evaluation of indexed antisymmetric structure constant. */
ex su3f::eval_indexed(const basic & i) const
{
- GINAC_ASSERT(is_of_type(i, indexed));
+ GINAC_ASSERT(is_a<indexed>(i));
GINAC_ASSERT(i.nops() == 4);
- GINAC_ASSERT(is_ex_of_type(i.op(0), su3f));
+ GINAC_ASSERT(is_a<su3f>(i.op(0)));
// Numeric evaluation
if (static_cast<const indexed &>(i).all_index_values_are(info_flags::nonnegint)) {
/** Contraction of generator with something else. */
bool su3t::contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const
{
- GINAC_ASSERT(is_ex_of_type(*self, indexed));
- GINAC_ASSERT(is_ex_of_type(*other, indexed));
+ GINAC_ASSERT(is_a<indexed>(*self));
+ GINAC_ASSERT(is_a<indexed>(*other));
GINAC_ASSERT(self->nops() == 2);
- GINAC_ASSERT(is_ex_of_type(self->op(0), su3t));
+ GINAC_ASSERT(is_a<su3t>(self->op(0)));
unsigned char rl = ex_to<color>(*self).get_representation_label();
if (is_ex_exactly_of_type(other->op(0), su3t)) {
/** Contraction of an indexed symmetric structure constant with something else. */
bool su3d::contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const
{
- GINAC_ASSERT(is_ex_of_type(*self, indexed));
- GINAC_ASSERT(is_ex_of_type(*other, indexed));
+ GINAC_ASSERT(is_a<indexed>(*self));
+ GINAC_ASSERT(is_a<indexed>(*other));
GINAC_ASSERT(self->nops() == 4);
- GINAC_ASSERT(is_ex_of_type(self->op(0), su3d));
+ GINAC_ASSERT(is_a<su3d>(self->op(0)));
if (is_ex_exactly_of_type(other->op(0), su3d)) {
/** Contraction of an indexed antisymmetric structure constant with something else. */
bool su3f::contract_with(exvector::iterator self, exvector::iterator other, exvector & v) const
{
- GINAC_ASSERT(is_ex_of_type(*self, indexed));
- GINAC_ASSERT(is_ex_of_type(*other, indexed));
+ GINAC_ASSERT(is_a<indexed>(*self));
+ GINAC_ASSERT(is_a<indexed>(*other));
GINAC_ASSERT(self->nops() == 4);
- GINAC_ASSERT(is_ex_of_type(self->op(0), su3f));
+ GINAC_ASSERT(is_a<su3f>(self->op(0)));
if (is_ex_exactly_of_type(other->op(0), su3f)) { // f*d is handled by su3d class
exvector v1;
v1.reserve(num - 2);
- for (int i=0; i<num-2; i++)
+ for (unsigned i=0; i<num-2; i++)
v1.push_back(e.op(i));
exvector v2 = v1;