From 030b4a6e6f05002e73885653743ce107b059ff73 Mon Sep 17 00:00:00 2001 From: Reno <25192197+singularitti@users.noreply.github.com> Date: Fri, 28 Aug 2020 20:32:41 -0400 Subject: [PATCH 1/2] Update examples of `otherdims` --- src/primitives.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/primitives.jl b/src/primitives.jl index 341a2274a..2015beb64 100644 --- a/src/primitives.jl +++ b/src/primitives.jl @@ -332,6 +332,14 @@ julia> using DimensionalData julia> A = DimArray(ones(10, 10, 10), (X, Y, Z)); +julia> otherdims(A, X) +(Y: Base.OneTo(10) (NoIndex), Z: Base.OneTo(10) (NoIndex)) + +julia> otherdims(A, (Y, Z)) +(X: Base.OneTo(10) (NoIndex),) + +julia> otherdims(A, Ti) +(X: Base.OneTo(10) (NoIndex), Y: Base.OneTo(10) (NoIndex), Z: Base.OneTo(10) (NoIndex)) ``` """ @inline otherdims(A::AbstractArray, lookup) = otherdims(dims(A), lookup) From c06fb5ecbf304c9b180eaceb1f25abb7e7918071 Mon Sep 17 00:00:00 2001 From: Reno <25192197+singularitti@users.noreply.github.com> Date: Fri, 28 Aug 2020 20:35:15 -0400 Subject: [PATCH 2/2] Update doc examples of `commondims` --- src/primitives.jl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/primitives.jl b/src/primitives.jl index 2015beb64..e54a12cb5 100644 --- a/src/primitives.jl +++ b/src/primitives.jl @@ -76,6 +76,20 @@ This is basically `dims(x, lookup)` where the order of the original is kept, unlike [`dims`](@ref) where the lookup tuple determines the order Also unlike `dims`,`commondims` always returns a `Tuple`, no matter the input. +```jldoctest +julia> using DimensionalData + +julia> A = DimArray(ones(10, 10, 10), (X, Y, Z)); + +julia> commondims(A, X) +(X: Base.OneTo(10) (NoIndex),) + +julia> commondims(A, (X, Z)) +(X: Base.OneTo(10) (NoIndex), Z: Base.OneTo(10) (NoIndex)) + +julia> commondims(A, Ti) +() +``` """ @inline commondims(A::AbstractArray, B::AbstractArray) = commondims(dims(A), dims(B)) @inline commondims(A::AbstractArray, lookup) = commondims(dims(A), lookup)