Skip to content

Commit

Permalink
Merge pull request #90 from efaulhaber/fix-limits
Browse files Browse the repository at this point in the history
Allow arrays of different types to be passed to `limits`
  • Loading branch information
lmiq authored Jun 3, 2023
2 parents bcbf56e + 7373dc8 commit 44cd69d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/CellOperations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,15 @@ Returns the lengths of a orthorhombic box that encompasses all the particles def
and `y`, to used to set a box without effective periodic boundary conditions.
"""
function limits(x::T, y::T) where {T<:AbstractVector{<:AbstractVector}}
function limits(x::AbstractVector{<:AbstractVector}, y::AbstractVector{<:AbstractVector})
xmin, xmax = _minmax(x)
ymin, ymax = _minmax(y)
xymin = min.(xmin, ymin)
xymax = max.(xmax, ymax)
return Limits(xymax .- xymin)
end

function limits(x::T, y::T) where {T<:AbstractMatrix}
function limits(x::AbstractMatrix, y::AbstractMatrix)
N = size(x, 1)
M = size(y, 1)
N == M || throw(DimensionMismatch("The first dimension of the input matrices must be equal. "))
Expand Down

0 comments on commit 44cd69d

Please sign in to comment.