Mercurial > repos > public > sbplib_julia
changeset 531:36dfc57e8e0b feature/inflated_tensormapping_transpose
Write out some more documentation for split_index
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 25 Nov 2020 22:03:26 +0100 |
parents | 7f969ea03a01 |
children | 588a843907de |
files | src/LazyTensors/lazy_tensor_operations.jl |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/LazyTensors/lazy_tensor_operations.jl Wed Nov 25 21:00:31 2020 +0100 +++ b/src/LazyTensors/lazy_tensor_operations.jl Wed Nov 25 22:03:26 2020 +0100 @@ -284,21 +284,22 @@ """ - split_index(:Val{A}, ::Val{B_view}, ::Val{B_middle}, ::Val{C}, I...) + split_index(::Val{A}, ::Val{B_view}, ::Val{B_middle}, ::Val{C}, I...) -Splits the multi-index `I` into two parts. One part which is expected to be used as a view, which is expected to be used as an index. +Splits the multi-index `I` into two parts. One part which is expected to be used as a view, and one which is expected to be used as an index. Eg. ``` (1,2,3,4) -> (1,:,:,:,4), (2,3) ``` `B_view` controls how many colons are in the view, and `B_middle` controls how many elements are extracted from the middle. -`A` and `C` decides the length of the parts before and after the colons in the view index. -length(I) == A+B_domain+C -length(I_middle) == B_domain -length(I_view) == A + B_range + C +`A` and `C` decides the length of the index parts before and after the colons in the view index. + +Arguments should satisfy `length(I) == A+B_domain+C`. -TODO: Finish documentation. +The returned values satisfy + * `length(view_index) == A + B_view + C` + * `length(I_middle) == B_middle` """ function split_index(::Val{A}, ::Val{B_view}, ::Val{B_middle}, ::Val{C}, I...) where {A,B_view, B_middle,C} I_before = slice_tuple(I, Val(1), Val(A))