Mercurial > repos > public > sbplib_julia
view src/LazyTensors/LazyTensors.jl @ 1354:150313ed2cae
Merge refactor/grids (missed delete of a note)
Changes from previous merge:
* `EquidistantGrid` is now only a 1D thing.
* Higher dimensions are supported through `TensorGrid`.
* The old behavior of `EquidistantGrid` has been moved to the function `equidistant_grid`.
* Grids embedded in higher dimensions are now supported through tensor products with `ZeroDimGrid`s.
* Vector valued grid functions are now supported and the default element type is `SVector`.
* Grids are now expected to support Julia's indexing and iteration interface.
* `eval_on` can be called with both `f(x,y,...)` and `f(x̄)`.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 20 May 2023 14:19:20 +0200 |
parents | a922aa69eb83 |
children | dfb43fdac9fc 8b64df6cadba |
line wrap: on
line source
module LazyTensors export TensorApplication export TensorTranspose export TensorComposition export IdentityTensor export ScalingTensor export DiagonalTensor export DenseTensor 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) Base.:∘(s::TensorComposition, t::LazyTensor) = s.t1∘(s.t2∘t) # Outer products of tensors ⊗(a::LazyTensor, b::LazyTensor) = LazyOuterProduct(a,b) end # module