Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow arrays of different types to be passed to limits #90

Merged
merged 1 commit into from
Jun 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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