Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/LazyTensors.jl @ 1023:52f07c77299d refactor/sbpoperators/inflation
Merge refactor/lazy_tensors
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 21 Mar 2022 09:51:07 +0100 |
parents | d9476fede83d |
children | 6abbb2c6c3e4 |
comparison
equal
deleted
inserted
replaced
1022:bbbc31953367 | 1023:52f07c77299d |
---|---|
1 module LazyTensors | 1 module LazyTensors |
2 | 2 |
3 export LazyTensorMappingApplication | 3 export LazyTensorApplication |
4 export LazyTensorMappingTranspose | 4 export LazyTensorTranspose |
5 export TensorMappingComposition | 5 export LazyTensorComposition |
6 export LazyLinearMap | 6 export LazyLinearMap |
7 export IdentityMapping | 7 export IdentityTensor |
8 export InflatedTensorMapping | 8 export ScalingTensor |
9 export InflatedLazyTensor | |
9 export LazyOuterProduct | 10 export LazyOuterProduct |
10 export ⊗ | 11 export ⊗ |
11 export SizeMismatch | 12 export DomainSizeMismatch |
13 export RangeSizeMismatch | |
12 | 14 |
13 include("tensor_mapping.jl") | 15 include("lazy_tensor.jl") |
16 include("tensor_types.jl") | |
14 include("lazy_array.jl") | 17 include("lazy_array.jl") |
15 include("lazy_tensor_operations.jl") | 18 include("lazy_tensor_operations.jl") |
19 include("tuple_manipulation.jl") | |
20 | |
21 # Applying lazy tensors to vectors | |
22 Base.:*(a::LazyTensor, v::AbstractArray) = LazyTensorApplication(a,v) | |
23 Base.:*(a::LazyTensor, b::LazyTensor) = throw(MethodError(Base.:*,(a,b))) | |
24 Base.:*(a::LazyTensor, args::Union{LazyTensor, AbstractArray}...) = foldr(*,(a,args...)) | |
25 | |
26 # Addition and subtraction of lazy tensors | |
27 Base.:+(s::LazyTensor, t::LazyTensor) = LazyTensorBinaryOperation{:+}(s,t) | |
28 Base.:-(s::LazyTensor, t::LazyTensor) = LazyTensorBinaryOperation{:-}(s,t) | |
29 | |
30 # Composing lazy tensors | |
31 Base.:∘(s::LazyTensor, t::LazyTensor) = LazyTensorComposition(s,t) | |
32 | |
33 # Outer products of tensors | |
34 ⊗(a::LazyTensor, b::LazyTensor) = LazyOuterProduct(a,b) | |
16 | 35 |
17 end # module | 36 end # module |