Skip to content

Commit 53d9c1a

Browse files
authored
Concrete fields for Transformation (#54)
`Array{Float64}` is an abstract type, best to make it a `Vector{Float64}`.
1 parent 020b97e commit 53d9c1a

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/spatial.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ first centred set onto the second centred set, and the indices of the aligned
4747
residues in the first and second elements if relevant.
4848
"""
4949
struct Transformation
50-
trans1::Array{Float64}
51-
trans2::Array{Float64}
52-
rot::Array{Float64, 2}
50+
trans1::Vector{Float64}
51+
trans2::Vector{Float64}
52+
rot::Matrix{Float64}
5353
inds1::Vector{Int}
5454
inds2::Vector{Int}
5555
end
5656

57-
function Transformation(trans1::AbstractArray{<:Real},
58-
trans2::AbstractArray{<:Real},
59-
rot::AbstractArray{<:Real, 2})
60-
return Transformation(trans1, trans2, rot, [], [])
57+
function Transformation(trans1::AbstractVector{<:Real},
58+
trans2::AbstractVector{<:Real},
59+
rot::AbstractMatrix{<:Real})
60+
return Transformation(trans1, trans2, rot, Int[], Int[])
6161
end
6262

6363
Base.show(io::IO, trans::Transformation) = print("3D transformation with ",
@@ -135,8 +135,8 @@ function superimpose!(el1::StructuralElementOrList,
135135
return el1
136136
end
137137

138-
function Transformation(coords1::AbstractArray{<:Real, 2},
139-
coords2::AbstractArray{<:Real, 2},
138+
function Transformation(coords1::AbstractMatrix{<:Real},
139+
coords2::AbstractMatrix{<:Real},
140140
inds1::AbstractVector{<:Integer}=Int[],
141141
inds2::AbstractVector{<:Integer}=Int[])
142142
if size(coords1) != size(coords2)
@@ -154,7 +154,7 @@ function Transformation(coords1::AbstractArray{<:Real, 2},
154154
d = sign(det(svd_res.V * Ut))
155155
@view(svd_res.V[:, end]) .*= d
156156
rot = svd_res.V * Ut
157-
return Transformation(trans1, trans2, rot, inds1, inds2)
157+
return Transformation(vec(trans1), vec(trans2), rot, inds1, inds2)
158158
end
159159

160160
"""

0 commit comments

Comments
 (0)