1 /** @file exam_color.cpp
2  *
3  *  Here we test GiNaC's color objects (su(3) Lie algebra). */
5 /*
6  *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  */
23 #include "exams.h"
25 static unsigned check_equal(const ex &e1, const ex &e2)
26 {
27         ex e = e1 - e2;
28         if (!e.is_zero()) {
29                 clog << e1 << "-" << e2 << " erroneously returned "
30                      << e << " instead of 0" << endl;
31                 return 1;
32         }
33         return 0;
34 }
36 static unsigned check_equal_simplify(const ex &e1, const ex &e2)
37 {
38         ex e = simplify_indexed(e1) - e2;
39         if (!e.is_zero()) {
40                 clog << "simplify_indexed(" << e1 << ")-" << e2 << " erroneously returned "
41                      << e << " instead of 0" << endl;
42                 return 1;
43         }
44         return 0;
45 }
47 static unsigned color_check1(void)
48 {
49         // checks general identities and contractions
51         unsigned result = 0;
53         idx a(symbol("a"), 8), b(symbol("b"), 8), c(symbol("c"), 8), d(symbol("d"), 8);
55         // structure constants
56         result += check_equal(color_d(a, c, a), 0);
57         result += check_equal_simplify(color_d(a, b, c) * color_d(b, d, c), numeric(5,3) * delta_tensor(a, d));
58         result += check_equal_simplify(color_d(idx(5, 8), b, c) * color_d(b, idx(5, 8), c), numeric(5,3));
59         result += check_equal_simplify(color_d(a, b, c) * color_d(b, c, a), numeric(40,3));
60         result += check_equal_simplify(color_d(a, b, c) * color_f(b, d, c), 0);
61         result += check_equal_simplify(color_d(a, b, c) * color_f(b, c, a), 0);
62         result += check_equal_simplify(color_f(a, b, c) * color_f(b, c, a), 24);
63         result += check_equal_simplify(color_f(a, b, c) * color_f(b, d, c), -3 * delta_tensor(a, d));
64         result += check_equal_simplify(color_h(a, b, c) * color_h(a, b, c), numeric(-32,3));
65         result += check_equal_simplify(color_h(a, b, c) * color_h(b, a, c), numeric(112,3));
67     ex e = color_h(a, b, c) * color_h(a, b, c);
68     ex sum = 0;
69         for (int i=1; i<9; i++)
70             for (int j=1; j<9; j++)
71                 for (int k=1; k<9; k++)
72                 sum += e.subs(lst(a == i, b == j, c == k));
73         if (!sum.is_equal(numeric(-32,3))) {
74                 clog << "numeric contraction of " << e << " erroneously returned "
75                      << sum << " instead of -32/3" << endl;
76                 result++;
77         }
79         return result;
80 }
82 unsigned exam_color(void)
83 {
84         unsigned result = 0;
86         cout << "examining color objects" << flush;
87         clog << "----------color objects:" << endl;
89         result += color_check1();  cout << '.' << flush;
91         if (!result) {
92                 cout << " passed " << endl;
93                 clog << "(no output)" << endl;
94         } else {
95                 cout << " failed " << endl;
96         }
98         return result;
99 }
{"ft_lang_label":"__label__en","ft_lang_prob":0.5947113,"math_prob":0.9792842,"size":2897,"snap":"2022-05-2022-21","text_gpt3_token_len":942,"char_repetition_ratio":0.17006567,"word_repetition_ratio":0.112474434,"special_character_ratio":0.41146013,"punctuation_ratio":0.21131447,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9956268,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-28T02:00:45Z\",\"WARC-Record-ID\":\"<urn:uuid:932b9d0a-60f3-4711-9cb1-bc9916952233>\",\"Content-Length\":\"30855\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6e7a4cc5-3573-422b-9992-cc577944a1be>\",\"WARC-Concurrent-To\":\"<urn:uuid:2c255c7d-3c49-44a1-92d0-9ce60f497fb8>\",\"WARC-IP-Address\":\"188.68.41.94\",\"WARC-Target-URI\":\"https://www.ginac.de/ginac.git/?p=ginac.git;a=blob;f=check/exam_color.cpp;hb=ea924f534d741945cabe3df7d9981f592c46013f\",\"WARC-Payload-Digest\":\"sha1:VPU2NKMY4ZVESAL5O7L2TYA5VWDXLWPQ\",\"WARC-Block-Digest\":\"sha1:RU3ZPCGOQYLR5LNFVEI56H3XKBZ5J2SB\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652663011588.83_warc_CC-MAIN-20220528000300-20220528030300-00385.warc.gz\"}"}