[GiNaC-devel] printing of Dirac-slash objects.

Chris Dams C.Dams at science.ru.nl
Mon Apr 18 18:30:17 CEST 2005


Dear developers,

I found out that dirac_slash(p+q,4) is printed as "q+p\". I think this is
confusing and that "(q+p)\" would be much clearer. A patch is attached.

Best wishes,
Chris
-------------- next part --------------
Index: clifford.h
===================================================================
RCS file: /home/cvs/GiNaC/ginac/clifford.h,v
retrieving revision 1.56
diff -c -r1.56 clifford.h
*** clifford.h	1 Apr 2005 14:23:40 -0000	1.56
--- clifford.h	18 Apr 2005 16:29:24 -0000
***************
*** 52,57 ****
--- 52,59 ----
  	clifford(unsigned char rl, const ex & metr, std::auto_ptr<exvector> vp);
  
  	// functions overriding virtual functions from base classes
+ public:
+ 	unsigned precedence() const {return 65;}
  protected:
  	ex eval_ncmul(const exvector & v) const;
  	bool match_same_type(const basic & other) const;
Index: clifford.cpp
===================================================================
RCS file: /home/cvs/GiNaC/ginac/clifford.cpp,v
retrieving revision 1.85
diff -c -r1.85 clifford.cpp
*** clifford.cpp	1 Apr 2005 14:23:40 -0000	1.85
--- clifford.cpp	18 Apr 2005 16:29:24 -0000
***************
*** 200,206 ****
  {
  	// dirac_slash() object is printed differently
  	if (is_dirac_slash(seq[0])) {
! 		seq[0].print(c, level);
  		c.s << "\\";
  	} else
  		this->print_dispatch<inherited>(c, level);
--- 200,206 ----
  {
  	// dirac_slash() object is printed differently
  	if (is_dirac_slash(seq[0])) {
! 		seq[0].print(c, precedence());
  		c.s << "\\";
  	} else
  		this->print_dispatch<inherited>(c, level);
***************
*** 211,217 ****
  	// dirac_slash() object is printed differently
  	if (is_dirac_slash(seq[0])) {
  		c.s << "{";
! 		seq[0].print(c, level);
  		c.s << "\\hspace{-1.0ex}/}";
  	} else {
  		c.s << "\\clifford[" << int(representation_label) << "]";
--- 211,217 ----
  	// dirac_slash() object is printed differently
  	if (is_dirac_slash(seq[0])) {
  		c.s << "{";
! 		seq[0].print(c, precedence());
  		c.s << "\\hspace{-1.0ex}/}";
  	} else {
  		c.s << "\\clifford[" << int(representation_label) << "]";


More information about the GiNaC-devel mailing list