comparison src/LazyTensors/LazyTensors.jl @ 1207:f1c2a4fa0ee1 performance/get_region_type_inference

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 03 Feb 2023 22:14:47 +0100
parents 93f87d5d9fbb
children
comparison
equal deleted inserted replaced
919:b41180efb6c2 1207:f1c2a4fa0ee1
1 module LazyTensors 1 module LazyTensors
2
2 using Sbplib.RegionIndices 3 using Sbplib.RegionIndices
3 include("tensor_mapping.jl") 4
5 export TensorApplication
6 export TensorTranspose
7 export TensorComposition
8 export IdentityTensor
9 export ScalingTensor
10 export DiagonalTensor
11 export DenseTensor
12 export InflatedTensor
13 export LazyOuterProduct
14 export ⊗
15 export DomainSizeMismatch
16 export RangeSizeMismatch
17
18 include("lazy_tensor.jl")
19 include("tensor_types.jl")
4 include("lazy_array.jl") 20 include("lazy_array.jl")
5 include("lazy_tensor_operations.jl") 21 include("lazy_tensor_operations.jl")
22 include("tuple_manipulation.jl")
23
24 # Applying lazy tensors to vectors
25 Base.:*(a::LazyTensor, v::AbstractArray) = TensorApplication(a,v)
26 Base.:*(a::LazyTensor, b::LazyTensor) = throw(MethodError(Base.:*,(a,b)))
27 Base.:*(a::LazyTensor, args::Union{LazyTensor, AbstractArray}...) = foldr(*,(a,args...))
28
29 # Addition and subtraction of lazy tensors
30 Base.:+(s::LazyTensor, t::LazyTensor) = ElementwiseTensorOperation{:+}(s,t)
31 Base.:-(s::LazyTensor, t::LazyTensor) = ElementwiseTensorOperation{:-}(s,t)
32
33 # Composing lazy tensors
34 Base.:∘(s::LazyTensor, t::LazyTensor) = TensorComposition(s,t)
35
36 # Outer products of tensors
37 ⊗(a::LazyTensor, b::LazyTensor) = LazyOuterProduct(a,b)
6 38
7 end # module 39 end # module