Skip to content

Commit

Permalink
bugfix formatdims
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Jan 25, 2020
1 parent 1aa7d66 commit fabe74d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ hasdim(A, lookup::Type) = hasdim(typeof(dims(A)), lookup)
end
end

setdim(A, newdim::AbDim) = rebuild(A; dims=setdim(dims(A), newdim))
setdim(A, newdim::AbDim) = rebuild(A; dims=setdim(dims(A), newdim))
setdim(dims::AbDimTuple, newdim::AbDim) = map(d -> setdim(d, newdim), dims)
setdim(dim::AbDim, newdim::AbDim) =
basetypeof(dim) <: basetypeof(newdim) ? newdim : dim
Expand All @@ -203,7 +203,7 @@ formatdims(A::AbstractArray{T,N}, dims::Tuple) where {T,N} = begin
dimlen == N || throw(ArgumentError("dims ($dimlen) don't match array dimensions $(N)"))
formatdims(axes(A), dims)
end
formatdims(axes::Tuple, dims::AbDimTuple) where N = map(formatdims, axes, dims)
formatdims(axes::Tuple, dims::Tuple) where N = map(formatdims, axes, dims)
formatdims(axis::AbstractRange, dim::AbDim{<:AbstractArray}) = begin
checklen(dim, axis)
rebuild(dim, val(dim), identify(grid(dim), val(dim)))
Expand Down

0 comments on commit fabe74d

Please sign in to comment.