Mercurial > repos > public > sbplib_julia
view src/LazyTensors/lazy_tensor.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 | 7ef605b8f132 |
children | dfb43fdac9fc |
line wrap: on
line source
export LazyTensor export apply export apply_transpose export range_dim, domain_dim export range_size, domain_size """ LazyTensor{T,R,D} Describes a mapping of a `D` dimension tensor to an `R` dimension tensor. The action of the mapping is implemented through the method ```julia apply(t::LazyTensor{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg) where {R,D,T} ``` The size of the range and domain that the operator works with should be returned by the functions ```julia range_size(::LazyTensor) domain_size(::LazyTensor) ``` to allow querying for one or the other. Optionally the action of the transpose may be defined through ```julia apply_transpose(t::LazyTensor{T,R,D}, v::AbstractArray{T,D}, I::Vararg) where {R,D,T} ``` """ abstract type LazyTensor{T,R,D} end """ apply(t::LazyTensor{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg) where {R,D,T} Return the result of the mapping for a given index. """ function apply end """ apply_transpose(t::LazyTensor{T,R,D}, v::AbstractArray{<:Any,R}, I::Vararg) where {R,D,T} Return the result of the transposed mapping for a given index. """ function apply_transpose end """ range_dim(::LazyTensor) Return the dimension of the range space of a given mapping """ range_dim(::LazyTensor{T,R,D}) where {T,R,D} = R """ domain_dim(::LazyTensor) Return the dimension of the domain space of a given mapping """ domain_dim(::LazyTensor{T,R,D}) where {T,R,D} = D """ range_size(M::LazyTensor) Return the range size for the mapping. """ function range_size end """ domain_size(M::LazyTensor) Return the domain size for the mapping. """ function domain_size end """ eltype(::LazyTensor{T}) The type of elements the LazyTensor acts on. """ Base.eltype(::LazyTensor{T}) where T = T