Skip to content

Commit

Permalink
update quat(::Array) to return Array{<:Quaternion}
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrodium committed Dec 1, 2022
1 parent fe16ec7 commit 1f9759b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Quaternion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ julia> quat([1, 2, 3])
quat(p, v1, v2, v3) = Quaternion(p, v1, v2, v3)
quat(x) = Quaternion(x)
quat(s, a) = Quaternion(s, a)
function quat(A::AbstractArray{T}) where T
if !isconcretetype(T)
error("`quat` not defined on abstractly-typed arrays; please convert to a more specific type")
end
convert(AbstractArray{typeof(quat(zero(T)))}, A)
end

"""
real(T::Type{<:Quaternion})
Expand Down

0 comments on commit 1f9759b

Please sign in to comment.