Mercurial > repos > public > sbplib_julia
changeset 1230:723a583cef96 refactor/LazyTensors/tuple_manipulation
Improve examples for split_index and split_tuple
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 19 Feb 2023 11:45:48 +0100 |
parents | 8f4259fbd39c |
children | de6a9635f293 |
files | src/LazyTensors/tuple_manipulation.jl |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/LazyTensors/tuple_manipulation.jl Sun Feb 19 11:43:29 2023 +0100 +++ b/src/LazyTensors/tuple_manipulation.jl Sun Feb 19 11:45:48 2023 +0100 @@ -4,8 +4,9 @@ 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. -``` -split_index(1, 3, 2, 1, (1,2,3,4)) -> (1,:,:,:,4), (2,3) +```julia-repl +julia> LazyTensors.split_index(1, 3, 2, 1, (1,2,3,4)...) +((1, Colon(), Colon(), Colon(), 4), (2, 3)) ``` `dim_view` controls how many colons are in the view, and `dim_index` controls @@ -35,8 +36,9 @@ `sum(szs)` should equal `lenght(t)`. E.g -```julia -split_tuple((1,2,3,4,5,6), (3,1,2)) -> (1,2,3),(4,),(5,6) +```julia-repl +julia> LazyTensors.split_tuple((1,2,3,4,5,6), (3,1,2)) +((1, 2, 3), (4,), (5, 6)) ``` """ function split_tuple(t, szs)