Skip to content

Commit 66d2aca

Browse files
author
Kasper Peeters
committed
Fix bug that would incorrectly assume a spinor line in things of the form \psi_a ... \bar{\psi_b}.
1 parent 55e6de6 commit 66d2aca

File tree

11 files changed

+114
-21
lines changed

11 files changed

+114
-21
lines changed

client_server/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ include_directories(
9999
add_definitions(
100100
-D_WEBSOCKETPP_CPP11_STL_
101101
-DBOOST_ASIO_HAS_STD_CHRONO
102+
-DBOOST_BIND_GLOBAL_PLACEHOLDERS
102103
)
103104

104105
#---------------------------------------------------------------------------

cmake/version.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
set(CADABRA_VERSION_MAJOR 2)
22
set(CADABRA_VERSION_MINOR 4)
33
set(CADABRA_VERSION_PATCH 5)
4-
set(CADABRA_VERSION_TWEAK 2)
5-
set(COPYRIGHT_YEARS "2001-2023")
4+
set(CADABRA_VERSION_TWEAK 4)
5+
set(COPYRIGHT_YEARS "2001-2024")
66
math(EXPR SYSTEM_BITS "${CMAKE_SIZEOF_VOID_P} * 8")
77
find_program(GIT git PATHS ${GIT_DIR})
88
if(GIT)

config/buildbot.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@ runbuild "Mint_21" ".deb" 7035 mint21
7777
runbuild "Mint_20" ".deb" 7026 mint20
7878
runbuild "Ubuntu_22.04" ".deb" 7033 ubuntu2204
7979
runbuild "Ubuntu_20.04" ".deb" 7030 ubuntu2004
80-
runbuild "Ubuntu_18.04" ".deb" 7017 ubuntu1804
81-
runbuild "Fedora_28" ".rpm" 7020 fedora28
82-
runbuild "Fedora_29" ".rpm" 7025 fedora29
83-
runbuild "Fedora_32" ".rpm" 7027 fedora32
84-
runbuild "Fedora_33" ".rpm" 7031 fedora33
80+
#runbuild "Ubuntu_18.04" ".deb" 7017 ubuntu1804
81+
#runbuild "Fedora_28" ".rpm" 7020 fedora28
82+
#runbuild "Fedora_29" ".rpm" 7025 fedora29
83+
#runbuild "Fedora_32" ".rpm" 7027 fedora32
84+
#runbuild "Fedora_33" ".rpm" 7031 fedora33
8585
runbuild "Fedora_35" ".rpm" 7032 fedora35
86-
runbuild "Mint_19" ".deb" 7022 mint19
87-
runbuild "OpenSUSE_15" ".rpm" 7024 opensuse150
86+
#runbuild "Mint_19" ".deb" 7022 mint19
87+
#runbuild "OpenSUSE_15" ".rpm" 7024 opensuse150
8888
runbuild "OpenSUSE_Tumbleweed" ".rpm" 7023 opensusetw
89-
runbuild "Debian_921" ".deb" 7014 debian9
90-
runbuild "Debian_Buster" ".deb" 7021 debian10
89+
#runbuild "Debian_921" ".deb" 7014 debian9
90+
#runbuild "Debian_Buster" ".deb" 7021 debian10
9191
# runbuild "CentOS_7" ".rpm" 7004 centos7 cmake/packaging clash
9292
# runbuild "Scientific_Linux_74" ".rpm" 7013 scientific7x
9393

core/Exchange.cc

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License
1818
1919
*/
2020

21+
// #define XPERM_DEBUG 1
22+
2123
#include <map>
2224

2325
#include "Exchange.hh"
@@ -79,9 +81,19 @@ int exchange::collect_identical_tensors(const Properties& properties, Ex& tr, Ex
7981
++tmpit;
8082
gmnxt=properties.get<GammaMatrix>(tmpit);
8183
spnxt=properties.get<Spinor>(tmpit);
82-
}
83-
while(gmnxt==0 && spnxt==0);
84+
} while(gmnxt==0 && spnxt==0);
85+
8486
if(tmpit==sib) {
87+
// Found a pair of adjacent spinors with the same name.
88+
// Now make sure that it is *not* of the type \psi^a\bar{\psi^b},
89+
// because that's not a contracted spinor line!
90+
// Note: db2 is the DiracBar property of the *previously*
91+
// found spinor, so of the first one, not the second.
92+
// std::cerr << "DiracBar: " << db2 << ", " << db << std::endl;
93+
if(! ((db2!=0 && db==0) || (db2==0 && db==0)) ) {
94+
i=idts.size();
95+
break;
96+
}
8597
// txtout << "using fermi exchange" << std::endl;
8698
idts[i].extra_sign++;
8799
break;
@@ -94,10 +106,16 @@ int exchange::collect_identical_tensors(const Properties& properties, Ex& tr, Ex
94106
++tmpit;
95107
gmnxt=properties.get<GammaMatrix>(tmpit);
96108
spnxt=properties.get<Spinor>(tmpit);
97-
}
98-
while(gmnxt==0 && spnxt==0);
109+
} while(gmnxt==0 && spnxt==0);
110+
99111
if(tmpit==sib) { // yes, it's a proper Majorana spinor pair.
100-
// txtout << "using fermi exchange with gamma " << numind << std::endl;
112+
// Again, it has to be \bar{...}\gamma{...}, the bar
113+
// should *not* sit on the 2nd object.
114+
if(! ((db2!=0 && db==0) || (db2==0 && db==0)) ) {
115+
i=idts.size();
116+
break;
117+
}
118+
// txtout << "using fermi exchange with gamma " << numind << std::endl;
101119
if( ((numind*(numind+1))/2)%2 == 0 )
102120
idts[i].extra_sign++;
103121
break;
@@ -139,6 +157,10 @@ bool exchange::get_node_gs(const Properties& properties, Ex& tr, Ex::iterator it
139157
{
140158
std::vector<identical_tensors_t> idts;
141159
int total_number_of_indices=collect_identical_tensors(properties, tr, it, idts);
160+
#ifdef XPERM_DEBUG
161+
std::cerr << "exchange::get_node_gs: indices returned by collect_identical_tensors = "
162+
<< total_number_of_indices << std::endl;
163+
#endif
142164
if(idts.size()==0) return true; // no indices, so nothing to permute
143165

144166
// Make a strong generating set for the permutation of identical tensors.

libs/websocketpp/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ endif ()
2424
############ Project name and version
2525
set (WEBSOCKETPP_MAJOR_VERSION 0)
2626
set (WEBSOCKETPP_MINOR_VERSION 8)
27-
set (WEBSOCKETPP_PATCH_VERSION 1)
27+
set (WEBSOCKETPP_PATCH_VERSION 2)
2828
set (WEBSOCKETPP_VERSION ${WEBSOCKETPP_MAJOR_VERSION}.${WEBSOCKETPP_MINOR_VERSION}.${WEBSOCKETPP_PATCH_VERSION})
2929

3030
if(POLICY CMP0048)
@@ -123,7 +123,11 @@ if (BUILD_TESTS OR BUILD_EXAMPLES)
123123

124124
# g++
125125
if (CMAKE_COMPILER_IS_GNUCXX)
126-
set (WEBSOCKETPP_PLATFORM_LIBS pthread rt)
126+
if (NOT APPLE)
127+
set (WEBSOCKETPP_PLATFORM_LIBS pthread rt)
128+
else()
129+
set (WEBSOCKETPP_PLATFORM_LIBS pthread)
130+
endif()
127131
set (WEBSOCKETPP_PLATFORM_TLS_LIBS ssl crypto)
128132
set (WEBSOCKETPP_BOOST_LIBS system thread)
129133
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")

libs/websocketpp/websocketpp/version.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static int const major_version = 0;
4444
/// Library minor version number
4545
static int const minor_version = 8;
4646
/// Library patch version number
47-
static int const patch_version = 1;
47+
static int const patch_version = 2;
4848
/// Library pre-release flag
4949
/**
5050
* This is a textual flag indicating the type and number for pre-release
@@ -54,7 +54,7 @@ static int const patch_version = 1;
5454
static char const prerelease_flag[] = "";
5555

5656
/// Default user agent string
57-
static char const user_agent[] = "WebSocket++/0.8.1";
57+
static char const user_agent[] = "WebSocket++/0.8.2";
5858

5959
} // namespace websocketpp
6060

tests/canonicalise.cdb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,3 +932,28 @@ def test62():
932932

933933
test62()
934934

935+
def test63():
936+
__cdbkernel__=create_scope()
937+
{a, b}::Indices(position=independent).
938+
\psi^a::SelfAntiCommuting.
939+
{\psi^a, \rho, \chi}::Spinor(dimension=10).
940+
{\psi^a, \rho, \chi}::AntiCommuting.
941+
\bar{#}::DiracBar.
942+
A{#}::AntiSymmetric.
943+
ex := A_{a b} \psi^b\bar{\psi^a};
944+
canonicalise(_)
945+
tst:= - A_{a b} \psi^a\bar{\psi^b} - @(ex);
946+
assert(tst==0)
947+
print("Test 63a passed")
948+
ex := A_{a b} \bar{\rho} \psi^b\bar{\psi^a} \chi.
949+
canonicalise(_)
950+
tst:= -A_{a b} \bar{\rho} \psi^a\bar{\psi^b} \chi - @(ex).
951+
assert(tst==0)
952+
print("Test 63b passed")
953+
ex := A_{a b} \bar{\psi^b} \rho \bar{\psi^a} \chi.
954+
canonicalise(_)
955+
tst:=-A_{a b} \bar{\psi^a} \rho \bar{\psi^b} \chi - @(ex).
956+
assert(tst==0)
957+
print("Test 63c passed")
958+
959+
test63()

tests/programming.cdb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,3 +416,14 @@ def test18():
416416
print("Test 18e passed")
417417

418418
test18()
419+
420+
#
421+
# import numpy as np
422+
# a = np.array([[1,2],[3,4]])
423+
# a[0,1]=3
424+
# print(a)
425+
#
426+
# ex:=[[1,2],[3,4]];
427+
# ex[0][1]=3
428+
# ex;
429+
#

tests/substitute.cdb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,3 +558,32 @@ def test127():
558558
print("Test 127b passed")
559559

560560
test127()
561+
562+
def test128():
563+
# FIXME: adding create_scope here makes things fail, why?
564+
# __cdbkernel__=create_scope()
565+
a::Symbol;
566+
b::Symbol;
567+
568+
{a**m?, b**n?, a, b}::NonCommuting;
569+
570+
r1 := {
571+
a b**m? -> (1+b a) b**{m?-1},
572+
a b -> 1 + b a,
573+
};
574+
575+
def act(ex):
576+
converge(ex):
577+
substitute(ex,r1)
578+
distribute(ex)
579+
collect_factors(ex)
580+
print(ex)
581+
return ex
582+
583+
ex:=a b**5;
584+
act(ex);
585+
tst:= 5 b**4 + b**5 a - @(ex);
586+
assert(tst==0)
587+
print("Test 128 passed")
588+
589+
test128()

web2/cadabra2/source/changelog.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ <h3>github master (2.4.5)</h3>
2525
<li>Make <tt>zoom</tt> accept a list of patterns (Daniel).</li>
2626
<li>Fix bugs in getting Weight values from Python, and setting multipliers in Python.</li>
2727
<li>Add <tt>LaTeXString</tt> object to display LaTeX formatted strings on capable frontends.</li>
28+
<li>Fix a <a href="https://cadabra.science/qa/2723/interaction-between-canonicalise-and-vector-spinors">bug</a> with <tt>canonicalise</tt> acting on vector-spinor objects.</li>
2829
</ul>
2930

3031
<h3>2.4.4 (released 20-Sep-2023)</h3>

0 commit comments

Comments
 (0)