Skip to content

Commit

Permalink
Implemented product of NBodyMatrixElements
Browse files Browse the repository at this point in the history
  • Loading branch information
jagot committed Nov 27, 2023
1 parent 232504c commit 2aa72f7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/nbody_matrix_elements.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit 2aa72f7

Please sign in to comment.