| 32 |
namespace GiNaC { |
namespace GiNaC { |
| 33 |
#endif // ndef NO_NAMESPACE_GINAC |
#endif // ndef NO_NAMESPACE_GINAC |
| 34 |
|
|
| 35 |
|
|
| 36 |
|
/** This class holds one index of an indexed object. Indices can be symbolic |
| 37 |
|
* (e.g. "mu", "i") or numeric (unsigned integer), and they can be contravariant |
| 38 |
|
* (the default) or covariant. */ |
| 39 |
class idx : public basic |
class idx : public basic |
| 40 |
{ |
{ |
| 41 |
GINAC_DECLARE_REGISTERED_CLASS(idx, basic) |
GINAC_DECLARE_REGISTERED_CLASS(idx, basic) |
| 42 |
|
|
|
// member functions |
|
|
|
|
| 43 |
// default constructor, destructor, copy constructor assignment operator and helpers |
// default constructor, destructor, copy constructor assignment operator and helpers |
| 44 |
public: |
public: |
| 45 |
idx(); |
idx(); |
| 77 |
|
|
| 78 |
// non-virtual functions in this class |
// non-virtual functions in this class |
| 79 |
public: |
public: |
| 80 |
bool is_symbolic(void) const; |
/** Check whether index is symbolic (not numeric). */ |
| 81 |
unsigned get_value(void) const; |
bool is_symbolic(void) const {return symbolic;} |
| 82 |
bool is_covariant(void) const; |
|
| 83 |
|
/** Get numeric value of index. Undefined for symbolic indices. */ |
| 84 |
|
unsigned get_value(void) const {return value;} |
| 85 |
|
|
| 86 |
|
/** Check whether index is covariant (not contravariant). */ |
| 87 |
|
bool is_covariant(void) const {return covariant;} |
| 88 |
|
|
| 89 |
void setname(const std::string & n) {name=n;} |
void setname(const std::string & n) {name=n;} |
| 90 |
std::string getname(void) const {return name;} |
std::string getname(void) const {return name;} |
| 91 |
|
|
| 92 |
// member variables |
// member variables |
| 93 |
protected: |
protected: |
| 94 |
unsigned serial; |
unsigned serial; |
| 95 |
bool symbolic; |
bool symbolic; /**< Is index symbolic? */ |
| 96 |
std::string name; |
std::string name; /**< Symbolic name (if symbolic == true) */ |
| 97 |
unsigned value; |
unsigned value; /**< Numeric value (if symbolic == false) */ |
| 98 |
static unsigned next_serial; |
static unsigned next_serial; |
| 99 |
bool covariant; // x_mu, default is contravariant: x~mu |
bool covariant; /**< x_mu, default is contravariant: x~mu */ |
| 100 |
}; |
}; |
| 101 |
|
|
| 102 |
// global constants |
// global constants |
| 114 |
|
|
| 115 |
int canonicalize_indices(exvector & iv, bool antisymmetric=false); |
int canonicalize_indices(exvector & iv, bool antisymmetric=false); |
| 116 |
exvector idx_intersect(const exvector & iv1, const exvector & iv2); |
exvector idx_intersect(const exvector & iv1, const exvector & iv2); |
| 117 |
ex permute_free_index_to_front(const exvector & iv3, const exvector & iv2, |
ex permute_free_index_to_front(const exvector & iv3, const exvector & iv2, int * sig); |
|
bool antisymmetric, int * sig); |
|
| 118 |
unsigned subs_index_in_exvector(exvector & v, const ex & is, const ex & ir); |
unsigned subs_index_in_exvector(exvector & v, const ex & is, const ex & ir); |
| 119 |
ex subs_indices(const ex & e, const exvector & idxv_contra, |
ex subs_indices(const ex & e, const exvector & idxv_contra, const exvector & idxv_co); |
|
const exvector & idxv_co); |
|
| 120 |
unsigned count_index(const ex & e, const ex & i); |
unsigned count_index(const ex & e, const ex & i); |
| 121 |
|
|
| 122 |
#ifndef NO_NAMESPACE_GINAC |
#ifndef NO_NAMESPACE_GINAC |