Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/LazyTensors.jl @ 1858:4a9be96f2569 feature/documenter_logo
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 12 Jan 2025 21:18:44 +0100 |
parents | dfb43fdac9fc |
children | b8cb38fd67ff |
comparison
equal
deleted
inserted
replaced
1857:ffde7dad9da5 | 1858:4a9be96f2569 |
---|---|
1 module LazyTensors | 1 module LazyTensors |
2 using Sbplib.RegionIndices | 2 |
3 include("tensor_mapping.jl") | 3 export LazyTensor |
4 export apply | |
5 export apply_transpose | |
6 export range_dim, domain_dim | |
7 export range_size, domain_size | |
8 | |
9 export TensorApplication | |
10 export TensorTranspose | |
11 export TensorComposition | |
12 export IdentityTensor | |
13 export ScalingTensor | |
14 export DiagonalTensor | |
15 export DenseTensor | |
16 export InflatedTensor | |
17 export LazyOuterProduct | |
18 export ⊗ | |
19 export DomainSizeMismatch | |
20 export RangeSizeMismatch | |
21 | |
22 export LazyArray | |
23 export LazyFunctionArray | |
24 export +̃, -̃, *̃, /̃ | |
25 | |
26 include("lazy_tensor.jl") | |
27 include("tensor_types.jl") | |
4 include("lazy_array.jl") | 28 include("lazy_array.jl") |
5 include("lazy_tensor_operations.jl") | 29 include("lazy_tensor_operations.jl") |
30 include("tuple_manipulation.jl") | |
31 | |
32 # Applying lazy tensors to vectors | |
33 Base.:*(a::LazyTensor, v::AbstractArray) = TensorApplication(a,v) | |
34 Base.:*(a::LazyTensor, b::LazyTensor) = throw(MethodError(Base.:*,(a,b))) | |
35 Base.:*(a::LazyTensor, args::Union{LazyTensor, AbstractArray}...) = foldr(*,(a,args...)) | |
36 | |
37 # Addition and subtraction of lazy tensors | |
38 Base.:+(s::LazyTensor, t::LazyTensor) = ElementwiseTensorOperation{:+}(s,t) | |
39 Base.:-(s::LazyTensor, t::LazyTensor) = ElementwiseTensorOperation{:-}(s,t) | |
40 | |
41 # Composing lazy tensors | |
42 Base.:∘(s::LazyTensor, t::LazyTensor) = TensorComposition(s,t) | |
43 Base.:∘(s::TensorComposition, t::LazyTensor) = s.t1∘(s.t2∘t) | |
44 | |
45 # Outer products of tensors | |
46 ⊗(a::LazyTensor, b::LazyTensor) = LazyOuterProduct(a,b) | |
6 | 47 |
7 end # module | 48 end # module |