Skip to content

Commit b6917fd

Browse files
committed
revised tensor dispatch
1 parent c0d29f0 commit b6917fd

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Project.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ version = "0.6.3"
77
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
88
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
99
AbstractLattices = "398f06c4-4d28-53ec-89ca-5b2656b7603d"
10-
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1110

1211
[compat]
1312
julia = "1"
1413
AbstractLattices = "v0.2"
15-
StaticArrays = "0"
1614

1715
[extras]
1816
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1917
DirectSum = "22fd7b30-a8c0-5bf2-aabe-97783860d07c"
18+
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2019

2120
[targets]
2221
test = ["Test","DirectSum"]

src/AbstractTensors.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,16 @@ const ⊖ = *
197197
@inline Base.:\(a::A,b::B) where {A<:TensorAlgebra,B<:TensorAlgebra} = Base.inv(a)*b
198198
@inline Base.:\(a::UniformScaling,b::B) where B<:TensorAlgebra = Base.inv(Manifold(b)(a))*b
199199
@inline Base.:\(a::A,b::UniformScaling) where A<:TensorAlgebra = Base.inv(a)*Manifold(a)(b)
200+
@inline (a::A,b::B) where {A<:TensorAlgebra,B<:Real} = a*b
201+
@inline (a::A,b::B) where {A<:TensorAlgebra,B<:Complex} = a*b
202+
@inline (a::A,b::B) where {A<:Real,B<:TensorAlgebra} = a*b
203+
@inline (a::A,b::B) where {A<:Complex,B<:TensorAlgebra} = a*b
204+
Base.:(a::A,b::B) where {A<:TensorAlgebra,B<:TensorAlgebra} = contraction(a,b)
200205

201206
for op (:(Base.:+),:(Base.:*))
202207
@eval $op(t::T) where T<:TensorAlgebra = t
203208
end
204-
for op (:,:,:,:¬,:,:clifford,:basis,:complementleft,:complementlefthodge)
209+
for op (:,:,:¬,:,:clifford,:basis,:complementleft,:complementlefthodge)
205210
@eval function $op end
206211
end
207212
for op (:scalar,:involute,:even)
@@ -293,6 +298,7 @@ signbit(x::Symbol) = false
293298
signbit(x::Expr) = x.head == :call && x.args[1] == :-
294299
-(x) = Base.:-(x)
295300
-(x::Symbol) = :(-$x)
301+
@inline dot(x,y) = LinearAlgebra.dot(x,y)
296302

297303
for op (:conj,:inv,:sqrt,:abs,:exp,:expm1,:log,:log1p,:sin,:cos,:sinh,:cosh,:signbit)
298304
@eval @inline $op(z) = Base.$op(z)

0 commit comments

Comments
 (0)