3 * Implementation of GiNaC's clifford objects.
4 * No real implementation yet, to be done. */
12 // default constructor, destructor, copy constructor assignment operator and helpers
19 debugmsg("clifford default constructor",LOGLEVEL_CONSTRUCT);
21 name=autoname_prefix()+ToString(serial);
22 tinfo_key=TINFO_CLIFFORD;
27 debugmsg("clifford destructor",LOGLEVEL_DESTRUCT);
31 clifford::clifford(clifford const & other)
33 debugmsg("clifford copy constructor",LOGLEVEL_CONSTRUCT);
37 clifford const & clifford::operator=(clifford const & other)
39 debugmsg("clifford operator=",LOGLEVEL_ASSIGNMENT);
49 void clifford::copy(clifford const & other)
56 void clifford::destroy(bool call_parent)
59 indexed::destroy(call_parent);
69 clifford::clifford(string const & initname)
71 debugmsg("clifford constructor from string",LOGLEVEL_CONSTRUCT);
74 tinfo_key=TINFO_CLIFFORD;
78 // functions overriding virtual functions from bases classes
83 basic * clifford::duplicate() const
85 debugmsg("clifford duplicate",LOGLEVEL_DUPLICATE);
86 return new clifford(*this);
89 void clifford::printraw(ostream & os) const
91 debugmsg("clifford printraw",LOGLEVEL_PRINT);
92 os << "clifford(" << "name=" << name << ",serial=" << serial
95 os << ",hash=" << hashvalue << ",flags=" << flags << ")";
98 void clifford::printtree(ostream & os, unsigned indent) const
100 debugmsg("clifford printtree",LOGLEVEL_PRINT);
101 os << string(indent,' ') << name << " (clifford): "
102 << "serial=" << serial << ","
103 << seq.size() << "indices=";
104 printtreeindices(os,indent);
105 os << ", hash=" << hashvalue << " (0x" << hex << hashvalue << dec << ")"
106 << ", flags=" << flags << endl;
109 void clifford::print(ostream & os, unsigned upper_precedence) const
111 debugmsg("clifford print",LOGLEVEL_PRINT);
116 void clifford::printcsrc(ostream & os, unsigned type, unsigned upper_precedence) const
118 debugmsg("clifford print csrc",LOGLEVEL_PRINT);
119 print(os,upper_precedence);
122 bool clifford::info(unsigned inf) const
124 return indexed::info(inf);
129 int clifford::compare_same_type(basic const & other) const
131 ASSERT(other.tinfo() == TINFO_CLIFFORD);
132 const clifford *o = static_cast<const clifford *>(&other);
133 if (serial==o->serial) {
134 return indexed::compare_same_type(other);
136 return serial < o->serial ? -1 : 1;
139 ex clifford::simplify_ncmul(exvector const & v) const
141 return simplified_ncmul(v);
144 unsigned clifford::calchash(void) const
146 hashvalue=golden_ratio_hash(golden_ratio_hash(0x55555556U ^
147 golden_ratio_hash(tinfo_key) ^
149 setflag(status_flags::hash_calculated);
154 // virtual functions which can be overridden by derived classes
160 // non-virtual functions in this class
163 void clifford::setname(string const & n)
170 string & clifford::autoname_prefix(void)
172 static string * s=new string("clifford");
177 // static member variables
182 unsigned clifford::next_serial=0;
188 const clifford some_clifford;
189 type_info const & typeid_clifford=typeid(some_clifford);