Skip to content

Commit a265122

Browse files
committed
avoid calling TensorAlgebra.MATRIXFUNCTION
1 parent 16bf1be commit a265122

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed

src/fusiontensor/tensor_algebra_interface.jl

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,38 @@ using TensorAlgebra:
1717
matricize,
1818
unmatricize
1919

20+
const MATRIX_FUNCTIONS = [
21+
:exp,
22+
:cis,
23+
:log,
24+
:sqrt,
25+
:cbrt,
26+
:cos,
27+
:sin,
28+
:tan,
29+
:csc,
30+
:sec,
31+
:cot,
32+
:cosh,
33+
:sinh,
34+
:tanh,
35+
:csch,
36+
:sech,
37+
:coth,
38+
:acos,
39+
:asin,
40+
:atan,
41+
:acsc,
42+
:asec,
43+
:acot,
44+
:acosh,
45+
:asinh,
46+
:atanh,
47+
:acsch,
48+
:asech,
49+
:acoth,
50+
]
51+
2052
function TensorAlgebra.output_axes(
2153
::typeof(contract),
2254
biperm_dest::AbstractBlockPermutation{2},
@@ -72,7 +104,7 @@ function TensorAlgebra.unmatricizeadd!(a_dest::FusionTensor, a_dest_mat, invbipe
72104
return a_dest
73105
end
74106

75-
for f in TensorAlgebra.MATRIX_FUNCTIONS
107+
for f in MATRIX_FUNCTIONS
76108
@eval begin
77109
function TensorAlgebra.$f(
78110
a::FusionTensor, biperm::AbstractBlockPermutation{2}; kwargs...

test/test_contraction.jl

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -44,35 +44,7 @@ end
4444
t = reshape(sds22, (2, 2, 2, 2))
4545
g2 = gradedrange([SU2(1//2) => 1])
4646
ft = to_fusiontensor(t, (g2, g2), (dual(g2), dual(g2)))
47-
for f in [
48-
:exp,
49-
:cis,
50-
:log,
51-
:sqrt,
52-
:cos,
53-
:sin,
54-
:tan,
55-
:csc,
56-
:sec,
57-
:cot,
58-
:cosh,
59-
:sinh,
60-
:tanh,
61-
:csch,
62-
:sech,
63-
:coth,
64-
:acos,
65-
:asin,
66-
:atan,
67-
:acsc,
68-
:asec,
69-
:acot,
70-
:acosh,
71-
:asinh,
72-
:atanh,
73-
:acsch,
74-
:asech,
75-
]
47+
for f in setdiff(FusionTensors.MATRIX_FUNCTIONS, [:acoth, :cbrt])
7648
t2 = reshape((@eval Base.$f)(sds22), (2, 2, 2, 2))
7749
ft2 = to_fusiontensor(t2, (g2, g2), (dual(g2), dual(g2)))
7850
@test (@eval TensorAlgebra.$f)(ft, (1, 2, 3, 4), (1, 2), (3, 4)) ft2

0 commit comments

Comments
 (0)