comparison TensorMappings.jl @ 158:a3fac8298e3c boundary_conditions

Add domain_size() method
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 10 May 2019 15:04:54 +0200
parents 63b495d5dbc7
children b790082032da
comparison
equal deleted inserted replaced
157:63b495d5dbc7 158:a3fac8298e3c
6 6
7 range_dim(::TensorMapping{T,R,D}) where {T,R,D} = R 7 range_dim(::TensorMapping{T,R,D}) where {T,R,D} = R
8 domain_dim(::TensorMapping{T,R,D}) where {T,R,D} = D 8 domain_dim(::TensorMapping{T,R,D}) where {T,R,D} = D
9 9
10 range_size(::TensorOperator{T,D}, domain_size::NTuple{D,Integer}) where {T,D} = domain_size 10 range_size(::TensorOperator{T,D}, domain_size::NTuple{D,Integer}) where {T,D} = domain_size
11 # More prciese domain_size type? 11 domain_size(::TensorOperator{T,D}, range_size::NTuple{D,Integer}) where {T,D} = range_size
12 # More precise domain_size/range_size type?
12 13
13 # Should be implemented by a TensorMapping 14 # Should be implemented by a TensorMapping
14 # ======================================== 15 # ========================================
15 # apply(t::TensorMapping{T,R,D}, v::AbstractArray{T,D}, I::Vararg) where {R,D,T} = 16 # apply(t::TensorMapping{T,R,D}, v::AbstractArray{T,D}, I::Vararg) where {R,D,T} =
16 # apply_transpose(t::TensorMapping{T,R,D}, v::AbstractArray{T,D}, I::Vararg) where {R,D,T} = 17 # apply_transpose(t::TensorMapping{T,R,D}, v::AbstractArray{T,D}, I::Vararg) where {R,D,T} =
17 # Does it make sense that apply should work for any size of v? And the application adapts? 18 # Does it make sense that apply should work for any size of v? And the application adapts?
18 # Think about boundschecking! 19 # Think about boundschecking!
19 20
20 # range_size(::TensorMapping{T,R,D}, domain_size::NTuple{D,Integer}) where {T,R,D} = 21 # range_size(::TensorMapping{T,R,D}, domain_size::NTuple{D,Integer}) where {T,R,D} =
21 # More prciese domain_size type? 22 # More prciese domain_size type?
22 # range_size_of_transpose()??? 23 # domain_size(::TensorMapping{T,R,D}, range_size::NTuple{R,Integer}) where {T,R,D} =
24
25 # Implementing apply_transpose and domain_size is only needed if you want to take transposes of the TensorMapping.
23 26
24 27
25 28
26 # Allow using the ' operator: 29 # Allow using the ' operator:
27 struct TensorMappingTranspose{T,R,D} <: TensorMapping{T,D,R} 30 struct TensorMappingTranspose{T,R,D} <: TensorMapping{T,D,R}