Mercurial > repos > public > sbplib_julia
view src/LazyTensors/LazyTensors.jl @ 1064:a601427023e3 feature/nested_stencils
Add type stability tests for nested stencil application
(grafted from 47f5451cdfc4ad3d070c6f017c88644746e17669)
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 15 Feb 2022 07:54:52 +0100 |
parents | 9e76bf19904c |
children | 93f87d5d9fbb |
line wrap: on
line source
module LazyTensors export TensorApplication export TensorTranspose export TensorComposition export DenseTensor export IdentityTensor export ScalingTensor export InflatedTensor export LazyOuterProduct export ⊗ export DomainSizeMismatch export RangeSizeMismatch include("lazy_tensor.jl") include("tensor_types.jl") include("lazy_array.jl") include("lazy_tensor_operations.jl") include("tuple_manipulation.jl") # Applying lazy tensors to vectors Base.:*(a::LazyTensor, v::AbstractArray) = TensorApplication(a,v) Base.:*(a::LazyTensor, b::LazyTensor) = throw(MethodError(Base.:*,(a,b))) Base.:*(a::LazyTensor, args::Union{LazyTensor, AbstractArray}...) = foldr(*,(a,args...)) # Addition and subtraction of lazy tensors Base.:+(s::LazyTensor, t::LazyTensor) = ElementwiseTensorOperation{:+}(s,t) Base.:-(s::LazyTensor, t::LazyTensor) = ElementwiseTensorOperation{:-}(s,t) # Composing lazy tensors Base.:∘(s::LazyTensor, t::LazyTensor) = TensorComposition(s,t) # Outer products of tensors ⊗(a::LazyTensor, b::LazyTensor) = LazyOuterProduct(a,b) end # module