comparison src/LazyTensors/LazyTensors.jl @ 1049:3bb94ce74697 feature/variable_derivatives

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 23 Mar 2022 12:54:45 +0100
parents 9e76bf19904c
children 93f87d5d9fbb
comparison
equal deleted inserted replaced
1048:86aa69ad3304 1049:3bb94ce74697
1 module LazyTensors 1 module LazyTensors
2 2
3 export LazyTensorMappingApplication 3 export TensorApplication
4 export LazyTensorMappingTranspose 4 export TensorTranspose
5 export TensorMappingComposition 5 export TensorComposition
6 export LazyLinearMap 6 export DenseTensor
7 export IdentityMapping 7 export IdentityTensor
8 export InflatedTensorMapping 8 export ScalingTensor
9 export InflatedTensor
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) = 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)
16 35
17 end # module 36 end # module