Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/LazyTensors.jl @ 1045:0e31b9901160 feature/dissipation_operators
Merge refactor/sbpoperators/inflation
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 22 Mar 2022 22:11:11 +0100 |
parents | 9e76bf19904c |
children | 93f87d5d9fbb |
comparison
equal
deleted
inserted
replaced
1035:ceda69b8f27a | 1045:0e31b9901160 |
---|---|
1 module LazyTensors | 1 module LazyTensors |
2 | 2 |
3 export LazyTensorApplication | 3 export TensorApplication |
4 export LazyTensorTranspose | 4 export TensorTranspose |
5 export LazyTensorComposition | 5 export TensorComposition |
6 export LazyLinearMap | 6 export DenseTensor |
7 export IdentityTensor | 7 export IdentityTensor |
8 export ScalingTensor | 8 export ScalingTensor |
9 export InflatedLazyTensor | 9 export InflatedTensor |
10 export LazyOuterProduct | 10 export LazyOuterProduct |
11 export ⊗ | 11 export ⊗ |
12 export DomainSizeMismatch | 12 export DomainSizeMismatch |
13 export RangeSizeMismatch | 13 export RangeSizeMismatch |
14 | 14 |
17 include("lazy_array.jl") | 17 include("lazy_array.jl") |
18 include("lazy_tensor_operations.jl") | 18 include("lazy_tensor_operations.jl") |
19 include("tuple_manipulation.jl") | 19 include("tuple_manipulation.jl") |
20 | 20 |
21 # Applying lazy tensors to vectors | 21 # Applying lazy tensors to vectors |
22 Base.:*(a::LazyTensor, v::AbstractArray) = LazyTensorApplication(a,v) | 22 Base.:*(a::LazyTensor, v::AbstractArray) = TensorApplication(a,v) |
23 Base.:*(a::LazyTensor, b::LazyTensor) = throw(MethodError(Base.:*,(a,b))) | 23 Base.:*(a::LazyTensor, b::LazyTensor) = throw(MethodError(Base.:*,(a,b))) |
24 Base.:*(a::LazyTensor, args::Union{LazyTensor, AbstractArray}...) = foldr(*,(a,args...)) | 24 Base.:*(a::LazyTensor, args::Union{LazyTensor, AbstractArray}...) = foldr(*,(a,args...)) |
25 | 25 |
26 # Addition and subtraction of lazy tensors | 26 # Addition and subtraction of lazy tensors |
27 Base.:+(s::LazyTensor, t::LazyTensor) = LazyTensorBinaryOperation{:+}(s,t) | 27 Base.:+(s::LazyTensor, t::LazyTensor) = ElementwiseTensorOperation{:+}(s,t) |
28 Base.:-(s::LazyTensor, t::LazyTensor) = LazyTensorBinaryOperation{:-}(s,t) | 28 Base.:-(s::LazyTensor, t::LazyTensor) = ElementwiseTensorOperation{:-}(s,t) |
29 | 29 |
30 # Composing lazy tensors | 30 # Composing lazy tensors |
31 Base.:∘(s::LazyTensor, t::LazyTensor) = LazyTensorComposition(s,t) | 31 Base.:∘(s::LazyTensor, t::LazyTensor) = TensorComposition(s,t) |
32 | 32 |
33 # Outer products of tensors | 33 # Outer products of tensors |
34 ⊗(a::LazyTensor, b::LazyTensor) = LazyOuterProduct(a,b) | 34 ⊗(a::LazyTensor, b::LazyTensor) = LazyOuterProduct(a,b) |
35 | 35 |
36 end # module | 36 end # module |