Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/LazyTensors.jl @ 1047:d12ab8120d29 feature/first_derivative
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 23 Mar 2022 12:43:03 +0100 |
parents | 9e76bf19904c |
children | 93f87d5d9fbb |
comparison
equal
deleted
inserted
replaced
1046:e00eb000346e | 1047:d12ab8120d29 |
---|---|
1 module LazyTensors | 1 module LazyTensors |
2 | 2 |
3 include("tensor_mapping.jl") | 3 export TensorApplication |
4 export TensorTranspose | |
5 export TensorComposition | |
6 export DenseTensor | |
7 export IdentityTensor | |
8 export ScalingTensor | |
9 export InflatedTensor | |
10 export LazyOuterProduct | |
11 export ⊗ | |
12 export DomainSizeMismatch | |
13 export RangeSizeMismatch | |
14 | |
15 include("lazy_tensor.jl") | |
16 include("tensor_types.jl") | |
4 include("lazy_array.jl") | 17 include("lazy_array.jl") |
5 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) = TensorApplication(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) = ElementwiseTensorOperation{:+}(s,t) | |
28 Base.:-(s::LazyTensor, t::LazyTensor) = ElementwiseTensorOperation{:-}(s,t) | |
29 | |
30 # Composing lazy tensors | |
31 Base.:∘(s::LazyTensor, t::LazyTensor) = TensorComposition(s,t) | |
32 | |
33 # Outer products of tensors | |
34 ⊗(a::LazyTensor, b::LazyTensor) = LazyOuterProduct(a,b) | |
6 | 35 |
7 end # module | 36 end # module |