comparison src/LazyTensors/tensor_mapping.jl @ 944:4a4ef4bf6cb9 feature/tensormapping_application_promotion

Move exports to the top of the files
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 10 Mar 2022 16:59:43 +0100
parents fb060e98ac0a
children 1f41cf9454f2
comparison
equal deleted inserted replaced
943:fb060e98ac0a 944:4a4ef4bf6cb9
1 export TensorMapping
2 export apply
3 export apply_transpose
4 export range_dim, domain_dim
5 export range_size, domain_size
6
1 """ 7 """
2 TensorMapping{T,R,D} 8 TensorMapping{T,R,D}
3 9
4 Describes a mapping of a `D` dimension tensor to an `R` dimension tensor. 10 Describes a mapping of a `D` dimension tensor to an `R` dimension tensor.
5 The action of the mapping is implemented through the method 11 The action of the mapping is implemented through the method
19 ```julia 25 ```julia
20 apply_transpose(t::TensorMapping{T,R,D}, v::AbstractArray{T,D}, I::Vararg) where {R,D,T} 26 apply_transpose(t::TensorMapping{T,R,D}, v::AbstractArray{T,D}, I::Vararg) where {R,D,T}
21 ``` 27 ```
22 """ 28 """
23 abstract type TensorMapping{T,R,D} end 29 abstract type TensorMapping{T,R,D} end
24 export TensorMapping
25 30
26 """ 31 """
27 apply(t::TensorMapping{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg) where {R,D,T} 32 apply(t::TensorMapping{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg) where {R,D,T}
28 33
29 Return the result of the mapping for a given index. 34 Return the result of the mapping for a given index.
30 """ 35 """
31 function apply end 36 function apply end
32 export apply
33 37
34 """ 38 """
35 apply_transpose(t::TensorMapping{T,R,D}, v::AbstractArray{<:Any,R}, I::Vararg) where {R,D,T} 39 apply_transpose(t::TensorMapping{T,R,D}, v::AbstractArray{<:Any,R}, I::Vararg) where {R,D,T}
36 40
37 Return the result of the transposed mapping for a given index. 41 Return the result of the transposed mapping for a given index.
38 """ 42 """
39 function apply_transpose end 43 function apply_transpose end
40 export apply_transpose
41 44
42 """ 45 """
43 range_dim(::TensorMapping) 46 range_dim(::TensorMapping)
44 Return the dimension of the range space of a given mapping 47 Return the dimension of the range space of a given mapping
45 """ 48 """
49 domain_dim(::TensorMapping) 52 domain_dim(::TensorMapping)
50 Return the dimension of the domain space of a given mapping 53 Return the dimension of the domain space of a given mapping
51 """ 54 """
52 domain_dim(::TensorMapping{T,R,D}) where {T,R,D} = D 55 domain_dim(::TensorMapping{T,R,D}) where {T,R,D} = D
53 56
54 export range_dim, domain_dim
55 57
56 """ 58 """
57 range_size(M::TensorMapping) 59 range_size(M::TensorMapping)
58 60
59 Return the range size for the mapping. 61 Return the range size for the mapping.
65 67
66 Return the domain size for the mapping. 68 Return the domain size for the mapping.
67 """ 69 """
68 function domain_size end 70 function domain_size end
69 71
70 export range_size, domain_size
71 72
72 """ 73 """
73 eltype(::TensorMapping{T}) 74 eltype(::TensorMapping{T})
74 75
75 The type of elements the TensorMapping acts on. 76 The type of elements the TensorMapping acts on.