From 2aa72f70a402922480a6eade780f66e15ca14e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefanos=20Carlstr=C3=B6m?= Date: Mon, 27 Nov 2023 13:13:15 +0100 Subject: [PATCH] Implemented product of NBodyMatrixElements --- src/nbody_matrix_elements.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nbody_matrix_elements.jl b/src/nbody_matrix_elements.jl index 34eb686..1f3bff6 100644 --- a/src/nbody_matrix_elements.jl +++ b/src/nbody_matrix_elements.jl @@ -353,6 +353,9 @@ Base.:(*)(a::NBodyMatrixElement, b::Union{Number,NBodyTerm,NBodyTermFactor}) = Base.:(*)(a::Union{Number,NBodyTerm,NBodyTermFactor}, b::NBodyMatrixElement) = NBodyMatrixElement([a*t for t in b.terms]) +Base.:(*)(a::NBodyMatrixElement, b::NBodyMatrixElement) = + NBodyMatrixElement(vec(map(prod, Iterators.product(a.terms, b.terms)))) + Base.:(-)(f::NBodyMatrixElement) = (-1)*f Base.:(-)(a::Union{NBodyTerm,NBodyTermFactor,NBodyMatrixElement},