[GiNaC-devel] Minor clifford.cpp patch

Vladimir Kisil kisilv at maths.leeds.ac.uk
Fri Apr 28 14:05:23 CEST 2006


		Dear All,

		Here is a minor patch to clifford.cpp. Besides a typo in
  lst_to_clifford() it makes clifford_moebius_map() behaviour more
  intelligent. This function accepts both lst and matrix as input
  argument v but returned always a lst. Now it returns an object of the
  same class as it get in. This is reflected in the tutorial as well.

  Best wishes,
  Vladimir 
-- 
Vladimir V. Kisil     email: kisilv at maths.leeds.ac.uk
--                      www: http://maths.leeds.ac.uk/~kisilv/

-------------- next part --------------
/home/amsta/kisilv/GiNaC
Index: debian/changelog
===================================================================
RCS file: /home/cvs/GiNaC/debian/changelog,v
retrieving revision 1.36
diff -u -r1.36 changelog
--- debian/changelog	20 Apr 2006 22:59:39 -0000	1.36
+++ debian/changelog	28 Apr 2006 11:52:14 -0000
@@ -3,7 +3,7 @@
   * New upstream release; binary incompatible, so it's libginac1.4 now.
   * debian/*: Streamlining by Peter Eisentraut <petere at debian.org>.
 
- -- Richard Kreckel <kreckel at ginac.de>  <DATE>
+ -- Richard Kreckel <kreckel at ginac.de>  Mon, 17 Apr 2006 22:25:48 +0200
 
 ginac (1.3.4-1) unstable; urgency=low
 
Index: doc/tutorial/ginac.texi
===================================================================
RCS file: /home/cvs/GiNaC/doc/tutorial/ginac.texi,v
retrieving revision 1.185
diff -u -r1.185 ginac.texi
--- doc/tutorial/ginac.texi	22 Apr 2006 15:42:57 -0000	1.185
+++ doc/tutorial/ginac.texi	28 Apr 2006 11:52:15 -0000
@@ -3545,9 +3545,10 @@
 the matrix @samp{M = [[a, b], [c, d]]}. The parameter @code{G} defines
 the metric of the surrounding (pseudo-)Euclidean space. This can be an
 indexed object, tensormetric, matrix or a Clifford unit, in the later
-case the optional parameters @code{rl} and @code{anticommuting} are ignored
-even if supplied.  The returned value of this function is a list of
-components of the resulting vector.
+case the optional parameters @code{rl} and @code{anticommuting} are
+ignored even if supplied.  Depending from the type of @code{v} the
+returned value of this function is either a vector or a list holding vector's
+components.
 
 @cindex @code{clifford_max_label()}
 Finally the function
Index: ginac/clifford.cpp
===================================================================
RCS file: /home/cvs/GiNaC/ginac/clifford.cpp,v
retrieving revision 1.95
diff -u -r1.95 clifford.cpp
--- ginac/clifford.cpp	22 Feb 2006 14:52:07 -0000	1.95
+++ ginac/clifford.cpp	28 Apr 2006 11:52:15 -0000
@@ -1227,7 +1227,7 @@
 				else
 					throw(std::invalid_argument("lst_to_clifford(): dimensions of vector and clifford unit mismatch"));
 			} else
-				throw(std::invalid_argument("lst_to_clifford(): first argument should be a vector vector"));
+				throw(std::invalid_argument("lst_to_clifford(): first argument should be a vector (nx1 or 1xn matrix)"));
 		} else if (is_a<lst>(v)) {
 			if (dim == ex_to<lst>(v).nops())
 				return indexed(matrix(dim, 1, ex_to<lst>(v)), ex_to<varidx>(mu).toggle_variance()) * e;
@@ -1352,8 +1352,8 @@
 	}
 	
 	x = lst_to_clifford(v, cu); 
-	ex e = simplify_indexed(canonicalize_clifford((a * x + b) * clifford_inverse(c * x + d)));
-	return clifford_to_lst(e, cu, false);
+	ex e = clifford_to_lst(simplify_indexed(canonicalize_clifford((a * x + b) * clifford_inverse(c * x + d))), cu, false);
+	return (is_a<matrix>(v) ? matrix(ex_to<matrix>(v).rows(), ex_to<matrix>(v).cols(), ex_to<lst>(e)) : e);
 }
 
 ex clifford_moebius_map(const ex & M, const ex & v, const ex & G, unsigned char rl, bool anticommuting)


More information about the GiNaC-devel mailing list