Skip to content

Commit

Permalink
Implemented CachedVertices[]
Browse files Browse the repository at this point in the history
  • Loading branch information
iolojz committed Jan 26, 2017
1 parent d8f6770 commit e6f905a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions meta/EDM.m
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,14 @@ If you add new kinds of vertices (e.g for new diagram types):
Return[newVertex];
];

CachedVertex[particles_List, options : OptionsPattern[SARAH`Vertex]] :=
Module[{vertexPattern = ReplacePart[({#, ___} &) /@
Permutations[(#[___] &) /@ particles],
0 -> Alternatives],
vertexList = Symbol["SARAH`VertexList" <> ToString @ Length[particles]]},
FirstCase[vertexList, vertexPattern];
];

(* MemoizingVertex[] works just like SARAH`Vertex[], but it caches the results *)
(* MemoizingVertex[] only works when __no__ indices are specified!!! *)
(* Use of memoization gives ~30% speedup for the MSSM! *)
Expand Down

0 comments on commit e6f905a

Please sign in to comment.