I am almost there, but this is my first time using `StaticArrays.jl`

and I am not sure I got the concepts right:

```
using StaticArrays: SMatrix
"""
EllipsoidDistance([a₁, a₂, ...], [θ₁, θ₂, ...])
A distance defined by an ellipsoid with given semiaxes `a₁, a₂, ...`
and rotation angles `θ₁, θ₂, ...`.
The positive definite matrix A = PΛP' representing the ellipsoid is
assembled once and cached in the object as an static array. Calls to
(x-y)'*A*(x-y) are therefore very efficient.
"""
immutable EllipsoidDistance{N,T<:Real} <: AbstractDistance
# state fields
A::SMatrix{N}
function EllipsoidDistance{N,T}(as, θs) where {N,T<:Real}
@assert length(as) == length(θs) == N "number of semiaxes and rotations must match spatial dimension"
Λ = spdiagm(one(T)./as.^2)
P = eye(T, N) # TODO: define rotation matrix, probably using Rotations.jl
A = P*Λ*P'
new(A) # this is causing the error as expected since the local variable A is not static
end
end
EllipsoidDistance(as::Vector{T}, θs::Vector{T}) where {T<:Real} = EllipsoidDistance{length(as),T}(as, θs)
(d::EllipsoidDistance)(x, y) = begin
z = x - y
z'*A*z
end
```

The error is caused by the `new`

operator because I am passing a non-static array to it. What would be the appropriate way of caching `A`

?