Mercurial > repos > public > sbplib_julia
changeset 1094:672610322206 feature/dissipation_operators
Add docs for left_pad_tuple and right_pad_tuple
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 10 May 2022 20:41:35 +0200 |
parents | 423a6442efc3 |
children | 2be39d485221 |
files | src/LazyTensors/tuple_manipulation.jl |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/LazyTensors/tuple_manipulation.jl Sun May 08 12:15:32 2022 +0200 +++ b/src/LazyTensors/tuple_manipulation.jl Tue May 10 20:41:35 2022 +0200 @@ -75,7 +75,11 @@ flatten_tuple(t::Tuple) = ((flatten_tuple.(t)...)...,) # simplify? flatten_tuple(ts::Vararg) = flatten_tuple(ts) -# REVIEW: Add documentation +""" + left_pad_tuple(t, val, N) + +Left pad the `t` to length `N` using the value `val`. +""" function left_pad_tuple(t, val, N) if N < length(t) throw(DomainError(N, "Can't pad tuple of length $(length(t)) to $N elements")) @@ -85,7 +89,11 @@ return (padding..., t...) end -# REVIEW: Add documentation +""" + right_pad_tuple(t, val, N) + +Right pad the `t` to length `N` using the value `val`. +""" function right_pad_tuple(t, val, N) if N < length(t) throw(DomainError(N, "Can't pad tuple of length $(length(t)) to $N elements"))