[GiNaC-devel] End of the patch
Vladimir Kisil
kisilv at maths.leeds.ac.uk
Thu Apr 28 18:18:37 CEST 2005
This is the end of previous patch.
--
Vladimir V. Kisil email: kisilv at maths.leeds.ac.uk
-- www: http://maths.leeds.ac.uk/~kisilv/
Index: check/exam_clifford.cpp
===================================================================
RCS file: /home/cvs/GiNaC/check/exam_clifford.cpp,v
retrieving revision 1.24
diff -r1.24 exam_clifford.cpp
24a25,26
> const numeric half(1, 2);
>
27c29
< ex e = e1 - e2;
---
> ex e = normal(e1 - e2);
29,30c31,32
< clog << e1 << "-" << e2 << " erroneously returned "
< << e << " instead of 0" << endl;
---
> clog << "(" << e1 << ") - (" << e2 << ") erroneously returned "
> << e << " instead of 0" << endl;
38c40
< ex e = simplify_indexed(e1) - e2;
---
> ex e = normal(simplify_indexed(e1) - e2);
40,41c42,43
< clog << "simplify_indexed(" << e1 << ")-" << e2 << " erroneously returned "
< << e << " instead of 0" << endl;
---
> clog << "simplify_indexed(" << e1 << ") - (" << e2 << ") erroneously returned "
> << e << " instead of 0" << endl;
46a49,88
> static unsigned check_equal_lst(const ex &e1, const ex &e2)
> {
> for(int i = 0; i++; i < e1.nops()) {
> ex e = e1.op(i) - e2.op(i);
> if (!e.is_zero()) {
> clog << "(" << e1 << ") - (" << e2 << ") erroneously returned "
> << e << " instead of 0 (in the entry " << i << ")" << endl;
> return 1;
> }
> }
> return 0;
> }
>
> static unsigned check_equal_simplify_term(const ex &e1, const ex &e2, varidx &mu)
> {
> ex e = expand_dummy_sum(normal(simplify_indexed(e1) - e2), true);
>
> for (int j=0; j<4; j++) {
> ex esub = e.subs(lst(mu == idx(j, mu.get_dim()), mu.toggle_variance() == idx(j, mu.get_dim())));
> if (!(canonicalize_clifford(esub).is_zero())) {
> clog << "simplify_indexed(" << e1 << ") - (" << e2 << ") erroneously returned "
> << canonicalize_clifford(esub) << " instead of 0 for mu=" << j << endl;
> return 1;
> }
> }
> return 0;
> }
>
> static unsigned check_equal_simplify_term2(const ex &e1, const ex &e2)
> {
> ex e = expand_dummy_sum(normal(simplify_indexed(e1) - e2), true);
> if (!(canonicalize_clifford(e).is_zero())) {
> clog << "simplify_indexed(" << e1 << ") - (" << e2 << ") erroneously returned "
> << canonicalize_clifford(e) << " instead of 0" << endl;
> return 1;
> }
> return 0;
> }
>
>
264a307
>
271c314,316
< ex G = A;
---
> matrix A_symm(4,4), A2(4, 4);
> A_symm = A.add(A.transpose()).mul(half);
> A2 = A_symm.mul(A_symm);
273,274d317
< matrix A2(4, 4);
< A2 = A.mul(A);
276c319
<
---
> bool anticommuting = ex_to<clifford>(clifford_unit(nu, A)).is_anticommuting();
280,281c323,324
< e = dirac_ONE() * clifford_unit(mu, G) * dirac_ONE();
< result += check_equal(e, clifford_unit(mu, G));
---
> e = dirac_ONE(2) * clifford_unit(mu, A, 2) * dirac_ONE(2);
> result += check_equal(e, clifford_unit(mu, A, 2));
283,284c326,327
< e = clifford_unit(varidx(2, 4), G) * clifford_unit(varidx(1, 4), G)
< * clifford_unit(varidx(1, 4), G) * clifford_unit(varidx(2, 4), G);
---
> e = clifford_unit(idx(2, 4), A) * clifford_unit(idx(1, 4), A)
> * clifford_unit(idx(1, 4), A) * clifford_unit(idx(2, 4), A);
287c330,334
< e = clifford_unit(nu, G) * clifford_unit(nu.toggle_variance(), G);
---
> e = clifford_unit(varidx(2, 4), A) * clifford_unit(varidx(1, 4), A)
> * clifford_unit(varidx(1, 4), A) * clifford_unit(varidx(2, 4), A);
> result += check_equal(e, A(1, 1) * A(2, 2) * dirac_ONE());
>
> e = clifford_unit(nu, A) * clifford_unit(nu.toggle_variance(), A);
290,291c337,338
< e = clifford_unit(nu, G) * clifford_unit(nu, G);
< result += check_equal_simplify(e, indexed(G, sy_symm(), nu, nu) * dirac_ONE());
---
> e = clifford_unit(nu, A) * clifford_unit(nu, A);
> result += check_equal_simplify(e, indexed(A_symm, sy_symm(), nu, nu) * dirac_ONE());
293,294c340,341
< e = clifford_unit(nu, G) * clifford_unit(nu.toggle_variance(), G) * clifford_unit(mu, G);
< result += check_equal_simplify(e, A.trace() * clifford_unit(mu, G));
---
> e = clifford_unit(nu, A) * clifford_unit(nu.toggle_variance(), A) * clifford_unit(mu, A);
> result += check_equal_simplify(e, A.trace() * clifford_unit(mu, A));
296,297c343,347
< e = clifford_unit(nu, G) * clifford_unit(mu, G) * clifford_unit(nu.toggle_variance(), G);
< result += check_equal_simplify(e, 2*indexed(G, sy_symm(), mu, mu)*clifford_unit(mu, G) - A.trace()*clifford_unit(mu, G));
---
> e = clifford_unit(nu, A) * clifford_unit(mu, A) * clifford_unit(nu.toggle_variance(), A);
> if (anticommuting)
> result += check_equal_simplify(e, 2*indexed(A_symm, sy_symm(), mu, mu)*clifford_unit(mu, A) - A.trace()*clifford_unit(mu, A));
>
> result += check_equal_simplify_term(e, 2 * indexed(A_symm, sy_symm(), nu.toggle_variance(), mu) *clifford_unit(nu, A)-A.trace()*clifford_unit(mu, A), mu);
299,300c349,350
< e = clifford_unit(nu, G) * clifford_unit(nu.toggle_variance(), G)
< * clifford_unit(mu, G) * clifford_unit(mu.toggle_variance(), G);
---
> e = clifford_unit(nu, A) * clifford_unit(nu.toggle_variance(), A)
> * clifford_unit(mu, A) * clifford_unit(mu.toggle_variance(), A);
303,304c353,354
< e = clifford_unit(mu, G) * clifford_unit(nu, G)
< * clifford_unit(nu.toggle_variance(), G) * clifford_unit(mu.toggle_variance(), G);
---
> e = clifford_unit(mu, A) * clifford_unit(nu, A)
> * clifford_unit(nu.toggle_variance(), A) * clifford_unit(mu.toggle_variance(), A);
307,323c357,370
< e = clifford_unit(mu, G) * clifford_unit(nu, G)
< * clifford_unit(mu.toggle_variance(), G) * clifford_unit(nu.toggle_variance(), G);
< result += check_equal_simplify(e, 2*A2.trace()*dirac_ONE() - pow(A.trace(), 2)*dirac_ONE());
<
< e = clifford_unit(mu.toggle_variance(), G) * clifford_unit(nu, G)
< * clifford_unit(mu, G) * clifford_unit(nu.toggle_variance(), G);
< result += check_equal_simplify(e, 2*A2.trace()*dirac_ONE() - pow(A.trace(), 2)*dirac_ONE());
<
< e = clifford_unit(nu.toggle_variance(), G) * clifford_unit(rho.toggle_variance(), G)
< * clifford_unit(mu, G) * clifford_unit(rho, G) * clifford_unit(nu, G);
< e = e.simplify_indexed().collect(clifford_unit(mu, G));
< result += check_equal(e, (pow(A.trace(), 2)+4-4*A.trace()*indexed(A, mu, mu)) * clifford_unit(mu, G));
<
< e = clifford_unit(nu.toggle_variance(), G) * clifford_unit(rho, G)
< * clifford_unit(mu, G) * clifford_unit(rho.toggle_variance(), G) * clifford_unit(nu, G);
< e = e.simplify_indexed().collect(clifford_unit(mu, G));
< result += check_equal(e, (pow(A.trace(), 2)+4-4*A.trace()*indexed(A, mu, mu))* clifford_unit(mu, G));
---
> e = clifford_unit(mu, A) * clifford_unit(nu, A)
> * clifford_unit(mu.toggle_variance(), A) * clifford_unit(nu.toggle_variance(), A);
> if (anticommuting)
> result += check_equal_simplify(e, 2*A2.trace()*dirac_ONE() - pow(A.trace(), 2)*dirac_ONE());
>
> result += check_equal_simplify_term2(e, 2*indexed(A_symm, sy_symm(), nu.toggle_variance(), mu.toggle_variance()) * clifford_unit(mu, A) * clifford_unit(nu, A) - pow(A.trace(), 2)*dirac_ONE());
>
> e = clifford_unit(mu.toggle_variance(), A) * clifford_unit(nu, A)
> * clifford_unit(mu, A) * clifford_unit(nu.toggle_variance(), A);
> if (anticommuting) {
> result += check_equal_simplify(e, 2*A2.trace()*dirac_ONE() - pow(A.trace(), 2)*dirac_ONE());
> e1 = remove_dirac_ONE(simplify_indexed(e));
> result += check_equal(e1, 2*A2.trace() - pow(A.trace(), 2));
> }
325,327c372
< // canonicalize_clifford() checks
< e = clifford_unit(mu, G) * clifford_unit(nu, G) + clifford_unit(nu, G) * clifford_unit(mu, G);
< result += check_equal(canonicalize_clifford(e), 2*dirac_ONE()*indexed(G, sy_symm(), mu, nu));
---
> result += check_equal_simplify_term2(e, 2*indexed(A_symm, nu, mu) * clifford_unit(mu.toggle_variance(), A) * clifford_unit(nu.toggle_variance(), A) - pow(A.trace(), 2)*dirac_ONE());
329,338c374,406
< e = (clifford_unit(mu, G) * clifford_unit(nu, G) * clifford_unit(lam, G)
< + clifford_unit(nu, G) * clifford_unit(lam, G) * clifford_unit(mu, G)
< + clifford_unit(lam, G) * clifford_unit(mu, G) * clifford_unit(nu, G)
< - clifford_unit(nu, G) * clifford_unit(mu, G) * clifford_unit(lam, G)
< - clifford_unit(lam, G) * clifford_unit(nu, G) * clifford_unit(mu, G)
< - clifford_unit(mu, G) * clifford_unit(lam, G) * clifford_unit(nu, G)) / 6
< + indexed(G, sy_symm(), mu, nu) * clifford_unit(lam, G)
< - indexed(G, sy_symm(), mu, lam) * clifford_unit(nu, G)
< + indexed(G, sy_symm(), nu, lam) * clifford_unit(mu, G)
< - clifford_unit(mu, G) * clifford_unit(nu, G) * clifford_unit(lam, G);
---
> e = clifford_unit(nu.toggle_variance(), A) * clifford_unit(rho.toggle_variance(), A)
> * clifford_unit(mu, A) * clifford_unit(rho, A) * clifford_unit(nu, A);
> e = e.simplify_indexed().collect(clifford_unit(mu, A));
> if (anticommuting)
> result += check_equal(e, (4*indexed(A2, sy_symm(), mu, mu) - 4 * indexed(A_symm, sy_symm(), mu, mu)*A.trace() +pow(A.trace(), 2)) * clifford_unit(mu, A));
>
> result += check_equal_simplify_term(e, 4* indexed(A_symm, sy_symm(), nu.toggle_variance(), rho)*indexed(A_symm, sy_symm(), rho.toggle_variance(), mu) *clifford_unit(nu, A)
> - 2*A.trace() * (clifford_unit(rho, A) * indexed(A_symm, sy_symm(), rho.toggle_variance(), mu)
> +clifford_unit(nu, A) * indexed(A_symm, sy_symm(), nu.toggle_variance(), mu)) + pow(A.trace(),2)* clifford_unit(mu, A), mu);
>
> e = clifford_unit(nu.toggle_variance(), A) * clifford_unit(rho, A)
> * clifford_unit(mu, A) * clifford_unit(rho.toggle_variance(), A) * clifford_unit(nu, A);
> e = e.simplify_indexed().collect(clifford_unit(mu, A));
> if (anticommuting)
> result += check_equal(e, (4*indexed(A2, sy_symm(), mu, mu) - 4*indexed(A_symm, sy_symm(), mu, mu)*A.trace() +pow(A.trace(), 2))* clifford_unit(mu, A));
>
> result += check_equal_simplify_term(e, 4* indexed(A_symm, sy_symm(), nu.toggle_variance(), rho)*indexed(A_symm, sy_symm(), rho.toggle_variance(), mu) *clifford_unit(nu, A)
> - 2*A.trace() * (clifford_unit(rho, A) * indexed(A_symm, sy_symm(), rho.toggle_variance(), mu)
> +clifford_unit(nu, A) * indexed(A_symm, sy_symm(), nu.toggle_variance(), mu)) + pow(A.trace(),2)* clifford_unit(mu, A), mu);
>
> e = clifford_unit(mu, A) * clifford_unit(nu, A) + clifford_unit(nu, A) * clifford_unit(mu, A);
> result += check_equal(canonicalize_clifford(e), 2*dirac_ONE()*indexed(A_symm, sy_symm(), mu, nu));
>
> e = (clifford_unit(mu, A) * clifford_unit(nu, A) * clifford_unit(lam, A)
> + clifford_unit(nu, A) * clifford_unit(lam, A) * clifford_unit(mu, A)
> + clifford_unit(lam, A) * clifford_unit(mu, A) * clifford_unit(nu, A)
> - clifford_unit(nu, A) * clifford_unit(mu, A) * clifford_unit(lam, A)
> - clifford_unit(lam, A) * clifford_unit(nu, A) * clifford_unit(mu, A)
> - clifford_unit(mu, A) * clifford_unit(lam, A) * clifford_unit(nu, A)) / 6
> + indexed(A_symm, sy_symm(), mu, nu) * clifford_unit(lam, A)
> - indexed(A_symm, sy_symm(), mu, lam) * clifford_unit(nu, A)
> + indexed(A_symm, sy_symm(), nu, lam) * clifford_unit(mu, A)
> - clifford_unit(mu, A) * clifford_unit(nu, A) * clifford_unit(lam, A);
344,345c412,413
< ex c = clifford_unit(nu, G, 1);
< e = lst_to_clifford(lst(t, x, y, z), mu, G, 1) * lst_to_clifford(lst(1, 2, 3, 4), c);
---
> ex c = clifford_unit(nu, A, 1);
> e = lst_to_clifford(lst(t, x, y, z), mu, A, 1) * lst_to_clifford(lst(1, 2, 3, 4), c);
347c415,443
< result += check_equal((e*e1).simplify_indexed().normal(), dirac_ONE(1));
---
> result += check_equal_lst((e*e1).simplify_indexed(), dirac_ONE(1));
>
> // Moebius map (both forms) checks for symmetric metrics only
> matrix M1(2, 2), M2(2, 2);
> c = clifford_unit(nu, A);
>
> e = clifford_moebius_map(0, dirac_ONE(),
> dirac_ONE(), 0, lst(t, x, y, z), A); // this is just the inversion
> M1 = 0, dirac_ONE(),
> dirac_ONE(), 0;
> e1 = clifford_moebius_map(M1, lst(t, x, y, z), A); // the inversion again
> result += check_equal_lst(e, e1);
>
> e1 = clifford_to_lst(clifford_inverse(lst_to_clifford(lst(t, x, y, z), mu, A)), c);
> result += check_equal_lst(e, e1);
>
> e = clifford_moebius_map(dirac_ONE(), lst_to_clifford(lst(1, 2, 3, 4), nu, A),
> 0, dirac_ONE(), lst(t, x, y, z), A); //this is just a shift
> M2 = dirac_ONE(), lst_to_clifford(lst(1, 2, 3, 4), c),
> 0, dirac_ONE();
> e1 = clifford_moebius_map(M2, lst(t, x, y, z), c); // the same shift
> result += check_equal_lst(e, e1);
>
> result += check_equal(e, lst(t+1, x+2, y+3, z+4));
>
> // Check the group law for Moebius maps
> e = clifford_moebius_map(M1, ex_to<lst>(e1), c); //composition of M1 and M2
> e1 = clifford_moebius_map(M1.mul(M2), lst(t, x, y, z), c); // the product M1*M2
> result += check_equal_lst(e, e1);
352c448,449
< static unsigned clifford_check7()
---
>
> static unsigned clifford_check7(const ex & G, const symbol & dim)
358d454
< symbol dim("D");
362c458
< ex e;
---
> ex e, G_base;
364c460,463
< ex G = minkmetric();
---
> if (is_a<indexed>(G))
> G_base = G.op(0);
> else
> G_base = G;
389,404c488,519
< // canonicalize_clifford() checks
< e = clifford_unit(mu, G) * clifford_unit(nu, G) + clifford_unit(nu, G) * clifford_unit(mu, G);
< result += check_equal(canonicalize_clifford(e), 2*dirac_ONE()*indexed(G, sy_symm(), mu, nu));
<
< e = (clifford_unit(mu, G) * clifford_unit(nu, G) * clifford_unit(lam, G)
< + clifford_unit(nu, G) * clifford_unit(lam, G) * clifford_unit(mu, G)
< + clifford_unit(lam, G) * clifford_unit(mu, G) * clifford_unit(nu, G)
< - clifford_unit(nu, G) * clifford_unit(mu, G) * clifford_unit(lam, G)
< - clifford_unit(lam, G) * clifford_unit(nu, G) * clifford_unit(mu, G)
< - clifford_unit(mu, G) * clifford_unit(lam, G) * clifford_unit(nu, G)) / 6
< + indexed(G, sy_symm(), mu, nu) * clifford_unit(lam, G)
< - indexed(G, sy_symm(), mu, lam) * clifford_unit(nu, G)
< + indexed(G, sy_symm(), nu, lam) * clifford_unit(mu, G)
< - clifford_unit(mu, G) * clifford_unit(nu, G) * clifford_unit(lam, G);
< result += check_equal(canonicalize_clifford(e), 0);
<
---
> // canonicalize_clifford() checks, only for symmetric metrics
> if (ex_to<symmetry>(ex_to<indexed>(ex_to<clifford>(clifford_unit(mu, G)).get_metric()).get_symmetry()).has_symmetry()) {
> e = clifford_unit(mu, G) * clifford_unit(nu, G) + clifford_unit(nu, G) * clifford_unit(mu, G);
> result += check_equal(canonicalize_clifford(e), 2*dirac_ONE()*indexed(G_base, sy_symm(), nu, mu));
>
> e = (clifford_unit(mu, G) * clifford_unit(nu, G) * clifford_unit(lam, G)
> + clifford_unit(nu, G) * clifford_unit(lam, G) * clifford_unit(mu, G)
> + clifford_unit(lam, G) * clifford_unit(mu, G) * clifford_unit(nu, G)
> - clifford_unit(nu, G) * clifford_unit(mu, G) * clifford_unit(lam, G)
> - clifford_unit(lam, G) * clifford_unit(nu, G) * clifford_unit(mu, G)
> - clifford_unit(mu, G) * clifford_unit(lam, G) * clifford_unit(nu, G)) / 6
> + indexed(G_base, sy_symm(), mu, nu) * clifford_unit(lam, G)
> - indexed(G_base, sy_symm(), mu, lam) * clifford_unit(nu, G)
> + indexed(G_base, sy_symm(), nu, lam) * clifford_unit(mu, G)
> - clifford_unit(mu, G) * clifford_unit(nu, G) * clifford_unit(lam, G);
> result += check_equal(canonicalize_clifford(e), 0);
> } else {
> e = clifford_unit(mu, G) * clifford_unit(nu, G) + clifford_unit(nu, G) * clifford_unit(mu, G);
> result += check_equal(canonicalize_clifford(e), dirac_ONE()*(indexed(G_base, mu, nu) + indexed(G_base, nu, mu)));
>
> e = (clifford_unit(mu, G) * clifford_unit(nu, G) * clifford_unit(lam, G)
> + clifford_unit(nu, G) * clifford_unit(lam, G) * clifford_unit(mu, G)
> + clifford_unit(lam, G) * clifford_unit(mu, G) * clifford_unit(nu, G)
> - clifford_unit(nu, G) * clifford_unit(mu, G) * clifford_unit(lam, G)
> - clifford_unit(lam, G) * clifford_unit(nu, G) * clifford_unit(mu, G)
> - clifford_unit(mu, G) * clifford_unit(lam, G) * clifford_unit(nu, G)) / 6
> + half * (indexed(G_base, mu, nu) + indexed(G_base, nu, mu)) * clifford_unit(lam, G)
> - half * (indexed(G_base, mu, lam) + indexed(G_base, lam, mu)) * clifford_unit(nu, G)
> + half * (indexed(G_base, nu, lam) + indexed(G_base, lam, nu)) * clifford_unit(mu, G)
> - clifford_unit(mu, G) * clifford_unit(nu, G) * clifford_unit(lam, G);
> result += check_equal(canonicalize_clifford(e), 0);
> }
420a536,545
> // anticommuting, symmetric examples
> result += clifford_check6(ex_to<matrix>(diag_matrix(lst(-1, 1, 1, 1)))); cout << '.' << flush;
> result += clifford_check6(ex_to<matrix>(diag_matrix(lst(-1, -1, -1, -1)))); cout << '.' << flush;
> result += clifford_check6(ex_to<matrix>(diag_matrix(lst(-1, 1, 1, -1)))); cout << '.' << flush;
> result += clifford_check6(ex_to<matrix>(diag_matrix(lst(-1, 0, 1, -1)))); cout << '.' << flush;
> result += clifford_check6(ex_to<matrix>(diag_matrix(lst(-3, 0, 2, -1)))); cout << '.' << flush;
>
> realsymbol s("s"), t("t"); // symbolic entries in matric
> result += clifford_check6(ex_to<matrix>(diag_matrix(lst(-1, 1, s, t)))); cout << '.' << flush;
>
422,425c547,550
< A = -1, 0, 0, 0,
< 0, 1, 0, 0,
< 0, 0, 1, 0,
< 0, 0, 0, 1;
---
> A = 1, 0, 0, 0, // anticommuting, not symmetric, Tr=0
> 0, -1, 0, 0,
> 0, 0, 0, -1,
> 0, 0, 1, 0;
428,431c553,556
< A = -1, 0, 0, 0,
< 0,-1, 0, 0,
< 0, 0,-1, 0,
< 0, 0, 0,-1;
---
> A = 1, 0, 0, 0, // anticommuting, not symmetric, Tr=2
> 0, 1, 0, 0,
> 0, 0, 0, -1,
> 0, 0, 1, 0;
433,437c558,562
<
< A = -1, 0, 0, 0,
< 0, 1, 0, 0,
< 0, 0, 1, 0,
< 0, 0, 0,-1;
---
>
> A = 1, 0, 0, 0, // not anticommuting, symmetric, Tr=0
> 0, -1, 0, 0,
> 0, 0, 0, -1,
> 0, 0, -1, 0;
440,443c565,568
< A = -1, 0, 0, 0,
< 0, 0, 0, 0,
< 0, 0, 1, 0,
< 0, 0, 0,-1;
---
> A = 1, 0, 0, 0, // not anticommuting, symmetric, Tr=2
> 0, 1, 0, 0,
> 0, 0, 0, -1,
> 0, 0, -1, 0;
446c571,581
< result += clifford_check7(); cout << '.' << flush;
---
> A = 1, 1, 0, 0, // not anticommuting, not symmetric, Tr=4
> 0, 1, 1, 0,
> 0, 0, 1, 1,
> 0, 0, 0, 1;
> result += clifford_check6(A); cout << '.' << flush;
>
> symbol dim("D");
> result += clifford_check7(minkmetric(), dim); cout << '.' << flush;
>
> varidx chi(symbol("chi"), dim), xi(symbol("xi"), dim);
> result += clifford_check7(lorentz_g(xi, chi), dim); cout << '.' << flush;
More information about the GiNaC-devel
mailing list