Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/lazy_tensor.jl @ 996:aa72f067e771 refactor/lazy_tensors
Rename file
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 18 Mar 2022 21:17:01 +0100 |
parents | src/LazyTensors/tensor_mapping.jl@1ba8a398af9c |
children | 7ef605b8f132 |
comparison
equal
deleted
inserted
replaced
995:1ba8a398af9c | 996:aa72f067e771 |
---|---|
1 export LazyTensor | |
2 export apply | |
3 export apply_transpose | |
4 export range_dim, domain_dim | |
5 export range_size, domain_size | |
6 | |
7 """ | |
8 LazyTensor{T,R,D} | |
9 | |
10 Describes a mapping of a `D` dimension tensor to an `R` dimension tensor. | |
11 The action of the mapping is implemented through the method | |
12 ```julia | |
13 apply(t::LazyTensor{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg) where {R,D,T} | |
14 ``` | |
15 | |
16 The size of the range and domain that the operator works with should be returned by | |
17 the functions | |
18 ```julia | |
19 range_size(::LazyTensor) | |
20 domain_size(::LazyTensor) | |
21 ``` | |
22 to allow querying for one or the other. | |
23 | |
24 Optionally the action of the transpose may be defined through | |
25 ```julia | |
26 apply_transpose(t::LazyTensor{T,R,D}, v::AbstractArray{T,D}, I::Vararg) where {R,D,T} | |
27 ``` | |
28 """ | |
29 abstract type LazyTensor{T,R,D} end | |
30 | |
31 """ | |
32 apply(t::LazyTensor{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg) where {R,D,T} | |
33 | |
34 Return the result of the mapping for a given index. | |
35 """ | |
36 function apply end | |
37 | |
38 """ | |
39 apply_transpose(t::LazyTensor{T,R,D}, v::AbstractArray{<:Any,R}, I::Vararg) where {R,D,T} | |
40 | |
41 Return the result of the transposed mapping for a given index. | |
42 """ | |
43 function apply_transpose end | |
44 | |
45 """ | |
46 range_dim(::LazyTensor) | |
47 Return the dimension of the range space of a given mapping | |
48 """ | |
49 range_dim(::LazyTensor{T,R,D}) where {T,R,D} = R | |
50 | |
51 """ | |
52 domain_dim(::LazyTensor) | |
53 Return the dimension of the domain space of a given mapping | |
54 """ | |
55 domain_dim(::LazyTensor{T,R,D}) where {T,R,D} = D | |
56 | |
57 | |
58 """ | |
59 range_size(M::LazyTensor) | |
60 | |
61 Return the range size for the mapping. | |
62 """ | |
63 function range_size end | |
64 | |
65 """ | |
66 domain_size(M::LazyTensor) | |
67 | |
68 Return the domain size for the mapping. | |
69 """ | |
70 function domain_size end | |
71 | |
72 | |
73 """ | |
74 eltype(::LazyTensor{T}) | |
75 | |
76 The type of elements the LazyTensor acts on. | |
77 """ | |
78 Base.eltype(::LazyTensor{T}) where T = T | |
79 | |
80 # TODO: Think about boundschecking! |