For every model that we test we manually write directional derivative tests like shown below. This can most likely be unified in a little test suite implemented within ACE.Testing.
import Base.*
struct __TestSVec{T}
val::T
end
*(a::Number, u::__TestSVec) = a * u.val
*(a::SMatrix, u::__TestSVec) = a * u.val
*(a::SArray{Tuple{N1,N2,N3}}, u::__TestSVec) where {N1, N2,N3} =
reshape(reshape(a, Size(N1*N2, N3)) * u.val, Size(N1, N2))
Us = __TestSVec.(randn(SVector{3, Float64}, length(Xs)))
C = randn(typeof(φ.val), length(basis))
F = t -> sum( sum(c .* b.val)
for (c, b) in zip(C, ACE.evaluate(basis, ACEConfig(Xs + t[1] * Us))) )
dF = t -> [ sum( sum(c .* db)
for (c, db) in zip(C, ACE.evaluate_d(basis, ACEConfig(Xs + t[1] * Us)) * Us) ) ]
fdtest(F, dF, [0.0], verbose=true)
For every model that we test we manually write directional derivative tests like shown below. This can most likely be unified in a little test suite implemented within
ACE.Testing
.