Skip to content
Snippets Groups Projects
Commit 8ed9b47b authored by Joseph Weston's avatar Joseph Weston Committed by Christoph Groth
Browse files

add support for *args to HermConjOfFunc

parent 798fe150
No related branches found
No related tags found
No related merge requests found
......@@ -373,8 +373,8 @@ class HermConjOfFunc(object):
def __init__(self, function):
self.function = function
def __call__(self, i, j):
return herm_conj(self.function(j, i))
def __call__(self, i, j, *args):
return herm_conj(self.function(j, i, *args))
################ Leads
......
......@@ -141,10 +141,10 @@ def test_construction_and_indexing():
def test_hermitian_conjugation():
def f(i, j):
def f(i, j, arg):
i, j = i.tag, j.tag
if j[0] == i[0] + 1:
return ta.array([[1, 2j], [3 + 1j, 4j]])
return arg * ta.array([[1, 2j], [3 + 1j, 4j]])
else:
raise ValueError
......@@ -155,8 +155,8 @@ def test_hermitian_conjugation():
sys[sg(0), sg(1)] = f
assert sys[sg(0), sg(1)] is f
assert isinstance(sys[sg(1), sg(0)], builder.HermConjOfFunc)
assert_equal(sys[sg(1), sg(0)](sg(1), sg(0)),
sys[sg(0), sg(1)](sg(0), sg(1)).conjugate().transpose())
assert_equal(sys[sg(1), sg(0)](sg(1), sg(0), 2),
sys[sg(0), sg(1)](sg(0), sg(1), 2).conjugate().transpose())
sys[sg(0), sg(1)] = sys[sg(1), sg(0)]
assert isinstance(sys[sg(0), sg(1)], builder.HermConjOfFunc)
assert sys[sg(1), sg(0)] is f
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment