From 371d363d149d42d9fda51b70a78bc4101bc75e2a Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Thu, 31 Oct 2024 06:55:03 +0000 Subject: [PATCH] build based on fe64f55 --- previews/PR186/.documenter-siteinfo.json | 2 +- previews/PR186/index.html | 2 +- previews/PR186/lib/GV/index.html | 6 +- previews/PR186/lib/backend/index.html | 14 +- previews/PR186/lib/computgraph/index.html | 144 +++++++++--------- previews/PR186/lib/frontend/index.html | 14 +- previews/PR186/lib/operator/index.html | 14 +- previews/PR186/lib/parquet/index.html | 24 +-- previews/PR186/lib/taylorseries/index.html | 36 ++--- previews/PR186/lib/utility/index.html | 12 +- previews/PR186/manual/counterterms/index.html | 2 +- previews/PR186/manual/feynman_rule/index.html | 2 +- previews/PR186/manual/hubbard_atom/index.html | 2 +- previews/PR186/manual/interaction/index.html | 2 +- 14 files changed, 138 insertions(+), 138 deletions(-) diff --git a/previews/PR186/.documenter-siteinfo.json b/previews/PR186/.documenter-siteinfo.json index 3a4f16c4..5af0537a 100644 --- a/previews/PR186/.documenter-siteinfo.json +++ b/previews/PR186/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-31T06:14:31","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-31T06:54:56","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/previews/PR186/index.html b/previews/PR186/index.html index f33c9dff..471f452e 100644 --- a/previews/PR186/index.html +++ b/previews/PR186/index.html @@ -1,2 +1,2 @@ -Home · FeynmanDiagram.jl

FeynmanDiagram

Documentation for FeynmanDiagram.

Library Outline

+Home · FeynmanDiagram.jl

FeynmanDiagram

Documentation for FeynmanDiagram.

Library Outline

diff --git a/previews/PR186/lib/GV/index.html b/previews/PR186/lib/GV/index.html index 9c8bedf7..a9a5135e 100644 --- a/previews/PR186/lib/GV/index.html +++ b/previews/PR186/lib/GV/index.html @@ -5,12 +5,12 @@ Generates a `Vector{FeynmanGraph}`: the given-`type` diagrams with static interactions of a given order, where the actual order of diagrams equals to `order + VerOrder + 2 * GOrder`. Generates a `LabelProduct`: `labelProd` with inputs `tau_labels` and all the possible momenta-loop basis. -Generates external tau labels Vector{Vector{Int}}. The i-th labels (Vector{Int}) corresponds to the i-th `FeynmanGraph` in `Vector{FeynmanGraph}`.

Arguments:

Returns

A tuple (diagrams, fermi_labelProd, bose_labelProd, extT_labels) where

source
FeynmanDiagram.FrontEnds.GV.diagsGV_ver4Method
function diagsGV_ver4(order::Int; spinPolarPara::Float64=0.0, filter::Vector{Filter}=[NoHartree], channels=[PHr, PHEr, PPr, Alli])
+Generates external tau labels Vector{Vector{Int}}. The i-th labels (Vector{Int}) corresponds to the i-th `FeynmanGraph` in `Vector{FeynmanGraph}`.

Arguments:

  • type (Symbol): The type of the diagrams, including :spinPolar, :chargePolar, :sigma, :green, or :freeEnergy.
  • order (Int): The order of the diagrams without counterterms.
  • GOrder (Int): The order of self-energy counterterms.
  • VerOrder (Int): The order of interaction counterterms.
  • labelProd (Union{Nothing,LabelProduct}=nothing, optional): The initial cartesian QuantumOperator.label product (defaults to nothing).
  • spinPolarPara (Float64, optional): The spin-polarization parameter (nup - ndown) / (nup + ndown) (defaults to 0.0).
  • tau_labels(Union{Nothing, Vector{Int}}, optional): The labels for the discrete time of each vertex. (defaults to nothing).

Returns

A tuple (diagrams, fermi_labelProd, bose_labelProd, extT_labels) where

  • diagrams is a Vector{FeynmanGraph} object representing the diagrams,
  • labelProd is a LabelProduct object containing the labels for the leaves of graphs,
  • extT_labels is a Vector{Union{Tuple,Vector{Int}}} object containing the external tau labels for each FeynmanGraph in diagrams.
source
FeynmanDiagram.FrontEnds.GV.diagsGV_ver4Method
function diagsGV_ver4(order::Int; spinPolarPara::Float64=0.0, filter::Vector{Filter}=[NoHartree], channels=[PHr, PHEr, PPr, Alli])
 
-Generates a `Vector{Graph}`: the 4-point vertex diagrams with static interactions of a given order.

Arguments:

  • order (Int): The order of the diagrams without counterterms.
  • spinPolarPara (Float64, optional): The spin-polarization parameter (nup - ndown) / (nup + ndown) (defaults to 0.0).
  • channels (optional): The channels for the diagrams, defaults to [PHr, PHEr, PPr, Alli].
  • filter (optional): Filter criteria for the diagrams, defaults to [NoHartree].
source
FeynmanDiagram.FrontEnds.GV.read_diagramsMethod
function read_diagrams(filename::AbstractString; loopPool::Union{LoopPool,Nothing}=nothing,
+Generates a `Vector{Graph}`: the 4-point vertex diagrams with static interactions of a given order.

Arguments:

  • order (Int): The order of the diagrams without counterterms.
  • spinPolarPara (Float64, optional): The spin-polarization parameter (nup - ndown) / (nup + ndown) (defaults to 0.0).
  • channels (optional): The channels for the diagrams, defaults to [PHr, PHEr, PPr, Alli].
  • filter (optional): Filter criteria for the diagrams, defaults to [NoHartree].
source
FeynmanDiagram.FrontEnds.GV.read_diagramsMethod
function read_diagrams(filename::AbstractString; loopPool::Union{LoopPool,Nothing}=nothing,
     dim::Int=3, tau_labels::Union{Nothing,Vector{Int}}=nothing, GTypes=[0, 1], VTypes=[0, 1, 2],
     keywords::Vector{String}=["Polarization", "DiagNum", "Order", "GNum", "Ver4Num", "LoopNum", "ExtLoopIndex",
         "DummyLoopIndex", "TauNum", "ExtTauIndex", "DummyTauIndex"])
 
 Reads a GV_diagrams file and returns FeynmanGraph of diagrams in this file 
-and the corresponding `LabelProduct` objects, which are used to keep track of QuantumOperator.label.

Arguments:

  • filename (AbstractString): The path to the file containing the diagrams.
  • loopPool (Union{LoopPool,Nothing}): An optional LoopPool object. If not provided, a new one will be created.
  • spinPolarPara (Float64): The spin-polarization parameter (nup - ndown) / (nup + ndown) (defaults to 0.0).
  • dim (Int): The dimension of the system, used to initialize the LoopPool object. Default is 3.
  • tau_labels (Union{Nothing,Vector{Int}}): The labels for the Tau objects in the diagrams. If not provided, they will be set to the integers from 1 to tauNum.
  • GTypes (Vector{Int}): The labels for the fermionic G objects in the diagrams. Default is [0, 1].
  • VTypes (Vector{Int}): The labels for the bosonic V objects in the diagrams. Default is [0, 1, 2].
  • keywords (Vector{String}): A set of keywords used to extract information from the file. Default is ["Polarization", "DiagNum", "Order", "GNum", "Ver4Num", "LoopNum", "ExtLoopIndex", "DummyLoopIndex", "TauNum", "ExtTauIndex", "DummyTauIndex"].

Returns

A tuple (diagrams, fermi_labelProd, bose_labelProd) where

  • diagrams is a FeynmanGraph object representing the diagrams,
  • fermi_labelProd is a LabelProduct object containing the labels for the fermionic G objects in the diagrams,
  • bose_labelProd is a LabelProduct object containing the labels for the bosonic W objects in the diagrams.
source
+and the corresponding `LabelProduct` objects, which are used to keep track of QuantumOperator.label.

Arguments:

Returns

A tuple (diagrams, fermi_labelProd, bose_labelProd) where

source diff --git a/previews/PR186/lib/backend/index.html b/previews/PR186/lib/backend/index.html index 1b1c0d8d..2cf1a302 100644 --- a/previews/PR186/lib/backend/index.html +++ b/previews/PR186/lib/backend/index.html @@ -8,21 +8,21 @@ root = [0.0,] leaf = [1.0, 2.0] -@assert eval_graph!(root, leaf) ≈ (leaf[1] + leaf[2]) * factorsource
FeynmanDiagram.Compilers.compile_CMethod
function compile_C(graphs::AbstractVector{<:AbstractGraph}, filename::String; 
+@assert eval_graph!(root, leaf) ≈ (leaf[1] + leaf[2]) * factor
source
FeynmanDiagram.Compilers.compile_CMethod
function compile_C(graphs::AbstractVector{<:AbstractGraph}, filename::String; 
     datatype::DataType=_dtype.weight, root::AbstractVector{Int}=[id(g) for g in graphs], func_name="eval_graph")
 
-Compiles a set of graphs into C language code and append the generated code to a specified file.

Arguments

  • datatype::DataType: This type is used for variables types in the generated C code.
  • graphs::AbstractVector{<:AbstractGraph}: An array of graph objects. These graphs are processed to generate Julia code.
  • filename::String: The name of the file to which the generated code will be appended. The file is created if it does not exist.
  • root::AbstractVector{Int} (keyword): An array of integers representing root nodes for each graph in graphs. By default, it is an array of IDs obtained by calling id(g) for each graph g in graphs.
  • func_name::String (keyword): The base name for the function(s) to be generated. Defaults to "eval_graph".

Returns

  • A dictionary (leafmap) that maps the index of the leaf weight's table leafVal to the leaf graph.
source
FeynmanDiagram.Compilers.compile_JuliaMethod
function compile_Julia(graphs::AbstractVector{<:AbstractGraph}, filename::String; 
+Compiles a set of graphs into C language code and append the generated code to a specified file.

Arguments

  • datatype::DataType: This type is used for variables types in the generated C code.
  • graphs::AbstractVector{<:AbstractGraph}: An array of graph objects. These graphs are processed to generate Julia code.
  • filename::String: The name of the file to which the generated code will be appended. The file is created if it does not exist.
  • root::AbstractVector{Int} (keyword): An array of integers representing root nodes for each graph in graphs. By default, it is an array of IDs obtained by calling id(g) for each graph g in graphs.
  • func_name::String (keyword): The base name for the function(s) to be generated. Defaults to "eval_graph".

Returns

  • A dictionary (leafmap) that maps the index of the leaf weight's table leafVal to the leaf graph.
source
FeynmanDiagram.Compilers.compile_JuliaMethod
function compile_Julia(graphs::AbstractVector{<:AbstractGraph}, filename::String; 
     root::AbstractVector{Int}=[id(g) for g in graphs], func_name="eval_graph!")
 
-Compiles a set of graphs into Julia code and append the generated code to a specified file.

Arguments

  • graphs::AbstractVector{<:AbstractGraph}: An array of graph objects. These graphs are processed to generate Julia code.
  • filename::String: The name of the file to which the generated code will be appended. The file is created if it does not exist.
  • root::AbstractVector{Int} (keyword): An array of integers representing root nodes for each graph in graphs. By default, it is an array of IDs obtained by calling id(g) for each graph g in graphs.
  • func_name::String (keyword): The base name for the function(s) to be generated. Defaults to "eval_graph!".

Returns

  • A dictionary (leafmap) that maps the index of the leaf weight's table leafVal to the leaf graph.
source
FeynmanDiagram.Compilers.to_dot_strFunction
function to_dot_str(graphs::AbstractVector{<:AbstractGraph}, name::String="")
+Compiles a set of graphs into Julia code and append the generated code to a specified file.

Arguments

  • graphs::AbstractVector{<:AbstractGraph}: An array of graph objects. These graphs are processed to generate Julia code.
  • filename::String: The name of the file to which the generated code will be appended. The file is created if it does not exist.
  • root::AbstractVector{Int} (keyword): An array of integers representing root nodes for each graph in graphs. By default, it is an array of IDs obtained by calling id(g) for each graph g in graphs.
  • func_name::String (keyword): The base name for the function(s) to be generated. Defaults to "eval_graph!".

Returns

  • A dictionary (leafmap) that maps the index of the leaf weight's table leafVal to the leaf graph.
source
FeynmanDiagram.Compilers.to_dot_strFunction
function to_dot_str(graphs::AbstractVector{<:AbstractGraph}, name::String="")
 
 Compile a list of graphs into a string for dot language.
 
 # Arguments:
 - `graphs`  vector of computational graphs
-- `title`   The name of the compiled function (defaults to nothing)
source
FeynmanDiagram.Compilers.to_julia_strMethod
function to_julia_str(graphs::AbstractVector{<:AbstractGraph}, leafMap::Dict{Int,Int}; root::AbstractVector{Int}=[id(g) for g in graphs],
-    name::String="eval_graph!")

Compile a list of Feynman graphs into a string for a julia static function. The complied function takes two arguments: root and leafVal. root is a vector of the root node ids of the graphs, and leafVal is a vector of the leaf nodes' weights of the graphs.

Arguments:

  • graphs (AbstractVector{G}): The vector object representing the Feynman graphs,
  • root (AbstractVector{Int}, optional): The vector of the root node ids of the graphs (defaults to [id(g) for g in graphs]).
  • name (String,optional): The name of the complied function (defaults to "eval_graph!").

Returns:

  • A String representing the compiled Julia function.
  • leafMap (Dict{Int,G}): A dictionary that maps the index of the leaf weight's table leafVal to the leaf graph.
source
FeynmanDiagram.Compilers.to_python_strMethod
function to_python_str(graphs::AbstractVector{<:AbstractGraph})
+- `title`   The name of the compiled function (defaults to nothing)
source
FeynmanDiagram.Compilers.to_julia_strMethod
function to_julia_str(graphs::AbstractVector{<:AbstractGraph}, leafMap::Dict{Int,Int}; root::AbstractVector{Int}=[id(g) for g in graphs],
+    name::String="eval_graph!")

Compile a list of Feynman graphs into a string for a julia static function. The complied function takes two arguments: root and leafVal. root is a vector of the root node ids of the graphs, and leafVal is a vector of the leaf nodes' weights of the graphs.

Arguments:

  • graphs (AbstractVector{G}): The vector object representing the Feynman graphs,
  • root (AbstractVector{Int}, optional): The vector of the root node ids of the graphs (defaults to [id(g) for g in graphs]).
  • name (String,optional): The name of the complied function (defaults to "eval_graph!").

Returns:

  • A String representing the compiled Julia function.
  • leafMap (Dict{Int,G}): A dictionary that maps the index of the leaf weight's table leafVal to the leaf graph.
source
FeynmanDiagram.Compilers.to_python_strMethod
function to_python_str(graphs::AbstractVector{<:AbstractGraph})
 
-Compile a list of graphs into a string for a python static function and output a python script.

Arguments:

  • graphs vector of computational graphs
source
FeynmanDiagram.Compilers.to_staticMethod
function to_static(operator::Type, subgraphs::AbstractVector{<:AbstractGraph}, subgraph_factors::AbstractVector)
+Compile a list of graphs into a string for a python static function and output a python script.

Arguments:

  • graphs vector of computational graphs
source
FeynmanDiagram.Compilers.to_staticMethod
function to_static(operator::Type, subgraphs::AbstractVector{<:AbstractGraph}, subgraph_factors::AbstractVector)
 
-Returns the static representation of a computational graph node `g` with operator `operator`, subgraphs `subgraphs`, and subgraph factors `subgraph_factors`.
source
+Returns the static representation of a computational graph node `g` with operator `operator`, subgraphs `subgraphs`, and subgraph factors `subgraph_factors`.source diff --git a/previews/PR186/lib/computgraph/index.html b/previews/PR186/lib/computgraph/index.html index de11319e..1433201a 100644 --- a/previews/PR186/lib/computgraph/index.html +++ b/previews/PR186/lib/computgraph/index.html @@ -8,43 +8,43 @@ 2:f⁺(3)|f⁻(4)=0.0 julia> g = FeynmanGraph([g1,g2]; vertices=[𝑓⁺(1),𝑓⁻(2),𝑓⁺(3),𝑓⁻(4)], operator=ComputationalGraphs.Prod(), external_indices=[1,2,3,4], external_legs=[true,true,true,true]) -3:f⁺(1)|f⁻(2)|f⁺(3)|f⁻(4)=0.0=Ⓧ (1,2)source
FeynmanDiagram.ComputationalGraphs.GraphType
mutable struct Graph{F<:Number,W}

A representation of a computational graph, e.g., an expression tree, with type stable node data.

Members:

  • id::Int the unique hash id to identify the diagram
  • name::Symbol name of the diagram
  • orders::Vector{Int} orders associated with the graph, e.g., derivative orders
  • subgraphs::Vector{Graph{F,W}} vector of sub-diagrams
  • subgraph_factors::Vector{F} scalar multiplicative factors associated with each subgraph. Note that the subgraph factors may be manipulated algebraically. To associate a fixed multiplicative factor with this graph which carries some semantic meaning, use the factor argument instead.
  • operator::DataType node operation. Addition and multiplication are natively supported via operators Sum and Prod, respectively. Should be a concrete subtype of AbstractOperator.
  • weight::W the weight of this node
  • properties::Any extra information of Green's functions.

Example:

julia> g1 = Graph([])
+3:f⁺(1)|f⁻(2)|f⁺(3)|f⁻(4)=0.0=Ⓧ (1,2)
source
FeynmanDiagram.ComputationalGraphs.GraphType
mutable struct Graph{F<:Number,W}

A representation of a computational graph, e.g., an expression tree, with type stable node data.

Members:

  • id::Int the unique hash id to identify the diagram
  • name::Symbol name of the diagram
  • orders::Vector{Int} orders associated with the graph, e.g., derivative orders
  • subgraphs::Vector{Graph{F,W}} vector of sub-diagrams
  • subgraph_factors::Vector{F} scalar multiplicative factors associated with each subgraph. Note that the subgraph factors may be manipulated algebraically. To associate a fixed multiplicative factor with this graph which carries some semantic meaning, use the factor argument instead.
  • operator::DataType node operation. Addition and multiplication are natively supported via operators Sum and Prod, respectively. Should be a concrete subtype of AbstractOperator.
  • weight::W the weight of this node
  • properties::Any extra information of Green's functions.

Example:

julia> g1 = Graph([])
 1=0.0
 
 julia> g2 = Graph([]; factor=2)
 2⋅2.0=0.0
 
 julia> g = Graph([g1, g2]; operator=ComputationalGraphs.Sum())
-3=0.0=⨁ (1,2)
source
Base.:*Method
function Base.:*(c1, g2::Graph{F,W}) where {F,W}

Returns a graph representing the scalar multiplication c1*g2.

Arguments:

  • c1 scalar multiple
  • g2 Feynman graph
source
Base.:*Method
function Base.:*(c1, g2::Graph{F,W}) where {F,W}

Returns a graph representing the scalar multiplication c1*g2.

Arguments:

  • c1 scalar multiple
  • g2 computational graph
source
Base.:*Method
function Base.:*(g1::Graph{F,W}, c2) where {F,W}

Returns a graph representing the scalar multiplication g1*c2.

Arguments:

  • g1 Feynman graph
  • c2 scalar multiple
source
Base.:*Method
function Base.:*(g1::Graph{F,W}, c2) where {F,W}

Returns a graph representing the scalar multiplication g1*c2.

Arguments:

  • g1 computational graph
  • c2 scalar multiple
source
Base.:*Method
function Base.:*(g1::Graph{F,W}, g2::Graph{F,W}) where {F,W}

Returns a graph g1 * g2 representing the graph product between g1 and g2.

Arguments:

  • g1 first computational graph
  • g2 second computational graph
source
Base.:+Method
function Base.:+(g1::Graph{F,W}, g2::Graph{F,W}) where {F,W}

Returns a graph g1 + g2 representing the addition of two Feynman diagrams g2 with g1. Diagrams g1 and g2 must have the same diagram type, orders, and external vertices.

Arguments:

  • g1 first Feynman graph
  • g2 second Feynman graph
source
Base.:+Method
function Base.:+(g1::Graph{F,W}, g2::Graph{F,W}) where {F,W}

Returns a graph g1 + g2 representing the addition of g2 with g1. Graphs g1 and g2 must have the same orders.

Arguments:

  • g1 first computational graph
  • g2 second computational graph
source
Base.:-Method
function Base.:-(g1::Graph{F,W}, g2::Graph{F,W}) where {F,W}

Returns a graph g1 - g2 representing the subtraction of g2 from g1. Diagrams g1 and g2 must have the same diagram type, orders, and external vertices.

Arguments:

  • g1 first Feynman graph
  • g2 second Feynman graph
source
Base.:-Method
function Base.:-(g1::Graph{F,W}, g2::Graph{F,W}) where {F,W}

Returns a graph g1 - g2 representing the subtraction of g2 from g1. Graphs g1 and g2 must have the same orders.

Arguments:

  • g1 first computational graph
  • g2 second computational graph
source
Base.convertMethod
function Base.convert(::Type{G}, g::FeynmanGraph{F,W}) where {F,W,G<:Graph}
+3=0.0=⨁ (1,2)
source
Base.:*Method
function Base.:*(c1, g2::Graph{F,W}) where {F,W}

Returns a graph representing the scalar multiplication c1*g2.

Arguments:

  • c1 scalar multiple
  • g2 Feynman graph
source
Base.:*Method
function Base.:*(c1, g2::Graph{F,W}) where {F,W}

Returns a graph representing the scalar multiplication c1*g2.

Arguments:

  • c1 scalar multiple
  • g2 computational graph
source
Base.:*Method
function Base.:*(g1::Graph{F,W}, c2) where {F,W}

Returns a graph representing the scalar multiplication g1*c2.

Arguments:

  • g1 Feynman graph
  • c2 scalar multiple
source
Base.:*Method
function Base.:*(g1::Graph{F,W}, c2) where {F,W}

Returns a graph representing the scalar multiplication g1*c2.

Arguments:

  • g1 computational graph
  • c2 scalar multiple
source
Base.:*Method
function Base.:*(g1::Graph{F,W}, g2::Graph{F,W}) where {F,W}

Returns a graph g1 * g2 representing the graph product between g1 and g2.

Arguments:

  • g1 first computational graph
  • g2 second computational graph
source
Base.:+Method
function Base.:+(g1::Graph{F,W}, g2::Graph{F,W}) where {F,W}

Returns a graph g1 + g2 representing the addition of two Feynman diagrams g2 with g1. Diagrams g1 and g2 must have the same diagram type, orders, and external vertices.

Arguments:

  • g1 first Feynman graph
  • g2 second Feynman graph
source
Base.:+Method
function Base.:+(g1::Graph{F,W}, g2::Graph{F,W}) where {F,W}

Returns a graph g1 + g2 representing the addition of g2 with g1. Graphs g1 and g2 must have the same orders.

Arguments:

  • g1 first computational graph
  • g2 second computational graph
source
Base.:-Method
function Base.:-(g1::Graph{F,W}, g2::Graph{F,W}) where {F,W}

Returns a graph g1 - g2 representing the subtraction of g2 from g1. Diagrams g1 and g2 must have the same diagram type, orders, and external vertices.

Arguments:

  • g1 first Feynman graph
  • g2 second Feynman graph
source
Base.:-Method
function Base.:-(g1::Graph{F,W}, g2::Graph{F,W}) where {F,W}

Returns a graph g1 - g2 representing the subtraction of g2 from g1. Graphs g1 and g2 must have the same orders.

Arguments:

  • g1 first computational graph
  • g2 second computational graph
source
Base.convertMethod
function Base.convert(::Type{G}, g::FeynmanGraph{F,W}) where {F,W,G<:Graph}
 
 Converts a FeynmanGraph `g` into a Graph, discarding its Feynman properties.
 After conversion, graph `g` is no longer guaranteed to be a valid (group of) Feynman diagram(s).
 
 # Arguments:
-- `g`  computational graph
source
Base.printMethod
print(io::IO, graph::AbstractGraph)
+- `g`  computational graph
source
Base.printMethod
print(io::IO, graph::AbstractGraph)
 
-Write an un-decorated text representation of an AbstractGraph `graph` to the output stream `io`.
source
Base.showMethod
show(io::IO, graph::AbstractGraph; kwargs...)
+Write an un-decorated text representation of an AbstractGraph `graph` to the output stream `io`.
source
Base.showMethod
show(io::IO, graph::AbstractGraph; kwargs...)
 
-Write a text representation of an AbstractGraph `graph` to the output stream `io`.
source
FeynmanDiagram.ComputationalGraphs.alleqMethod

Checks that all elements of an iterable x are equal.

source
FeynmanDiagram.ComputationalGraphs.build_derivative_graphMethod
function build_derivative_graph(graphs::AbstractVector{G}, orders::NTuple{N,Int};
+Write a text representation of an AbstractGraph `graph` to the output stream `io`.
source
FeynmanDiagram.ComputationalGraphs.alleqMethod

Checks that all elements of an iterable x are equal.

source
FeynmanDiagram.ComputationalGraphs.build_derivative_graphMethod
function build_derivative_graph(graphs::AbstractVector{G}, orders::NTuple{N,Int};
     nodes_id=nothing) where {G<:Graph,N}
 
-Constructs a derivative graph using forward automatic differentiation with given graphs and derivative orders.

Arguments:

  • graphs: A vector of graphs.
  • orders::NTuple{N,Int}: A tuple indicating the orders of differentiation. N represents the number of independent variables to be differentiated.
  • nodes_id: Optional node IDs to indicate saving their derivative graph.

Returns:

  • A dictionary containing the dual derivative graphs for all indicated nodes.

If isnothing(nodes_id), indicated nodes include all leaf and root nodes. Otherwise, indicated nodes include all root nodes and other nodes from nodes_id.

source
FeynmanDiagram.ComputationalGraphs.burn_from_targetleaves!Method
function burn_from_targetleaves!(graphs::AbstractVector{G}, targetleaves_id::AbstractVector{Int}; verbose=0) where {G <: AbstractGraph}
+Constructs a derivative graph using forward automatic differentiation with given graphs and derivative orders.

Arguments:

  • graphs: A vector of graphs.
  • orders::NTuple{N,Int}: A tuple indicating the orders of differentiation. N represents the number of independent variables to be differentiated.
  • nodes_id: Optional node IDs to indicate saving their derivative graph.

Returns:

  • A dictionary containing the dual derivative graphs for all indicated nodes.

If isnothing(nodes_id), indicated nodes include all leaf and root nodes. Otherwise, indicated nodes include all root nodes and other nodes from nodes_id.

source
FeynmanDiagram.ComputationalGraphs.burn_from_targetleaves!Method
function burn_from_targetleaves!(graphs::AbstractVector{G}, targetleaves_id::AbstractVector{Int}; verbose=0) where {G <: AbstractGraph}
 
-Removes all nodes connected to the target leaves in-place via "Prod" operators.

Arguments:

  • graphs: A vector of graphs.
  • targetleaves_id::AbstractVector{Int}: Vector of target leafs' id.
  • verbose: Level of verbosity (default: 0).

Returns:

  • The id of a constant graph with a zero factor if any graph in graphs was completely burnt; otherwise, nothing.
source
FeynmanDiagram.ComputationalGraphs.collect_labelsMethod
function collect_labels(g::FeynmanGraph)
+Removes all nodes connected to the target leaves in-place via "Prod" operators.

Arguments:

  • graphs: A vector of graphs.
  • targetleaves_id::AbstractVector{Int}: Vector of target leafs' id.
  • verbose: Level of verbosity (default: 0).

Returns:

  • The id of a constant graph with a zero factor if any graph in graphs was completely burnt; otherwise, nothing.
source
FeynmanDiagram.ComputationalGraphs.collect_labelsMethod
function collect_labels(g::FeynmanGraph)
 
-Returns the list of sorted unique labels in graph `g`.

Arguments:

  • g::FeynmanGraph: graph to find labels for
source
FeynmanDiagram.ComputationalGraphs.constant_graphFunction
function constant_graph(factor=one(_dtype.factor))

Returns a graph that represents a constant equal to f, where f is the factor with default value 1.

Arguments:

  • f: constant factor
source
FeynmanDiagram.ComputationalGraphs.count_expanded_operationMethod
function count_expanded_operation(g::G) where {G<:AbstractGraph}
+Returns the list of sorted unique labels in graph `g`.

Arguments:

  • g::FeynmanGraph: graph to find labels for
source
FeynmanDiagram.ComputationalGraphs.constant_graphFunction
function constant_graph(factor=one(_dtype.factor))

Returns a graph that represents a constant equal to f, where f is the factor with default value 1.

Arguments:

  • f: constant factor
source
FeynmanDiagram.ComputationalGraphs.count_expanded_operationMethod
function count_expanded_operation(g::G) where {G<:AbstractGraph}
 
-Returns the total number of operations in the totally expanded version (without any parentheses in the mathematical expression) of the graph.

Arguments:

  • g::Graph: graph for which to find the total number of operations in its expanded version.
source
FeynmanDiagram.ComputationalGraphs.count_leavesMethod
function count_leaves(g::G) where {G<:AbstractGraph}
+Returns the total number of operations in the totally expanded version (without any parentheses in the mathematical expression) of the graph.

Arguments:

  • g::Graph: graph for which to find the total number of operations in its expanded version.
source
FeynmanDiagram.ComputationalGraphs.count_leavesMethod
function count_leaves(g::G) where {G<:AbstractGraph}
 
-Returns the total number of leaves with unique id in the graph.

Arguments:

  • g::Graph: graph for which to find the total number of leaves.
source
FeynmanDiagram.ComputationalGraphs.count_operationMethod
function count_operation(g::G) where {G<:AbstractGraph}
+Returns the total number of leaves with unique id in the graph.

Arguments:

  • g::Graph: graph for which to find the total number of leaves.
source
FeynmanDiagram.ComputationalGraphs.count_operationMethod
function count_operation(g::G) where {G<:AbstractGraph}
 
-Returns the total number of  additions and multiplications in the graph.

Arguments:

  • g::Graph: graph for which to find the total number of operations.
source
FeynmanDiagram.ComputationalGraphs.diagram_typeMethod
function diagram_type(g::FeynmanGraph)

Returns the diagram type (::DiagramType) of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.disconnect_subgraphs!Method

function disconnect_subgraphs!(g::G) where {G<:AbstractGraph}

Empty the subgraphs and subgraph_factors of graph `g`. Any child nodes of g
-not referenced elsewhere in the full computational graph are effectively deleted.
source
FeynmanDiagram.ComputationalGraphs.drop_topologyMethod
function drop_topology(p::FeynmanProperties)
+Returns the total number of  additions and multiplications in the graph.

Arguments:

  • g::Graph: graph for which to find the total number of operations.
source
FeynmanDiagram.ComputationalGraphs.diagram_typeMethod
function diagram_type(g::FeynmanGraph)

Returns the diagram type (::DiagramType) of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.disconnect_subgraphs!Method

function disconnect_subgraphs!(g::G) where {G<:AbstractGraph}

Empty the subgraphs and subgraph_factors of graph `g`. Any child nodes of g
+not referenced elsewhere in the full computational graph are effectively deleted.
source
FeynmanDiagram.ComputationalGraphs.drop_topologyMethod
function drop_topology(p::FeynmanProperties)
 
-Returns a copy of the given FeynmanProperties `p` modified to have no topology.
source
FeynmanDiagram.ComputationalGraphs.eldestMethod
function eldest(g::AbstractGraph)
+Returns a copy of the given FeynmanProperties `p` modified to have no topology.
source
FeynmanDiagram.ComputationalGraphs.eldestMethod
function eldest(g::AbstractGraph)
 
-Returns the first child (subgraph) of a graph g.

Arguments:

  • g::AbstractGraph: graph for which to find the first child
source
FeynmanDiagram.ComputationalGraphs.external_indicesMethod
function external_indices(g::FeynmanGraph)

Returns a list of indices (::Vector{Int}}) to the external vertices of the FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.external_labelsMethod
function external_labels(g::FeynmanGraph)

Returns the labels of all physical external vertices of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.external_legsMethod
function external_legs(g::FeynmanGraph)

Returns a list of Boolean indices external_legs (::Vector{Bool}) indicating which external vertices of FeynmanGraph g have real legs (true: real leg, false: fake leg).

source
FeynmanDiagram.ComputationalGraphs.external_operatorsMethod
function external_operators(g::FeynmanGraph)

Returns all physical external operators (::OperatorProduct}) of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.external_vertexMethod
function external_vertex(ops::OperatorProduct;
-    name="", factor=one(_dtype.factor), weight=zero(_dtype.weight), operator=Sum())

Create a ExternalVertex-type FeynmanGraph from given OperatorProduct ops, including several quantum operators for an purely external vertex.

source
FeynmanDiagram.ComputationalGraphs.feynman_diagramMethod
function feynman_diagram(subgraphs::Vector{FeynmanGraph{F,W}}, topology::Vector{Vector{Int}}, perm_noleg::Union{Vector{Int},Nothing}=nothing;
+Returns the first child (subgraph) of a graph g.

Arguments:

  • g::AbstractGraph: graph for which to find the first child
source
FeynmanDiagram.ComputationalGraphs.external_indicesMethod
function external_indices(g::FeynmanGraph)

Returns a list of indices (::Vector{Int}}) to the external vertices of the FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.external_labelsMethod
function external_labels(g::FeynmanGraph)

Returns the labels of all physical external vertices of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.external_legsMethod
function external_legs(g::FeynmanGraph)

Returns a list of Boolean indices external_legs (::Vector{Bool}) indicating which external vertices of FeynmanGraph g have real legs (true: real leg, false: fake leg).

source
FeynmanDiagram.ComputationalGraphs.external_operatorsMethod
function external_operators(g::FeynmanGraph)

Returns all physical external operators (::OperatorProduct}) of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.external_vertexMethod
function external_vertex(ops::OperatorProduct;
+    name="", factor=one(_dtype.factor), weight=zero(_dtype.weight), operator=Sum())

Create a ExternalVertex-type FeynmanGraph from given OperatorProduct ops, including several quantum operators for an purely external vertex.

source
FeynmanDiagram.ComputationalGraphs.feynman_diagramMethod
function feynman_diagram(subgraphs::Vector{FeynmanGraph{F,W}}, topology::Vector{Vector{Int}}, perm_noleg::Union{Vector{Int},Nothing}=nothing;
     factor=one(_dtype.factor), weight=zero(_dtype.weight), name="", diagtype::DiagramType=GenericDiag()) where {F,W}

Create a FeynmanGraph representing feynman diagram from all subgraphs and topology (connections between vertices), where each ExternalVertex is given in vertices, while internal vertices are constructed with external legs of graphs in vertices, or simply OperatorProduct in vertices.

Arguments:

  • subgraphs::Vector{FeynmanGraph{F,W}} all subgraphs of the diagram. All external operators of subgraphs constitute all operators of the new diagram.
  • topology::Vector{Vector{Int}} topology of the diagram. Each Vector{Int} stores operators' index connected with each other (as a propagator).
  • perm_noleg::Union{Vector{Int},Nothing}=nothing permutation of all the nonleg external operators. By default, setting nothing means to use the default order from subgraphs.
  • factor::F overall scalar multiplicative factor for this diagram (e.g., permutation sign)
  • weight weight of the diagram
  • name name of the diagram
  • diagtype type of the diagram

Example:

julia> V = [𝑓⁺(1)𝑓⁻(2)𝜙(3), 𝑓⁺(4)𝑓⁻(5)𝜙(6), 𝑓⁺(7)𝑓⁻(8)𝜙(9)];
 julia> g = feynman_diagram(interaction.(V), [[1, 5], [3, 9], [4, 8]], [3, 1, 2])
 7:f⁺(1)f⁻(2)ϕ(3)|f⁺(4)f⁻(5)ϕ(6)|f⁺(7)f⁻(8)ϕ(9)=0.0=Ⓧ (1,2,3,4,5,6)
@@ -56,29 +56,29 @@
  3:f⁺(7)f⁻(8)ϕ(9)=0.0
  4:f⁺(1)|f⁻(5)⋅-1.0=0.0
  5:ϕ(3)|ϕ(9)=0.0
- 6:f⁺(4)|f⁻(8)⋅-1.0=0.0
source
FeynmanDiagram.ComputationalGraphs.flatten_all_chains!Method
function flatten_all_chains!(g::AbstractGraph; verbose=0)

F Flattens all nodes representing trivial unary chains in-place in the given graph g.

Arguments:

  • graphs: The graph to be processed.
  • verbose: Level of verbosity (default: 0).

Returns:

  • The mutated graph g with all chains flattened.
source
FeynmanDiagram.ComputationalGraphs.flatten_all_chains!Method
function flatten_all_chains!(graphs::Union{Tuple,AbstractVector{<:AbstractGraph}}; verbose=0)
+ 6:f⁺(4)|f⁻(8)⋅-1.0=0.0
source
FeynmanDiagram.ComputationalGraphs.flatten_all_chains!Method
function flatten_all_chains!(g::AbstractGraph; verbose=0)

F Flattens all nodes representing trivial unary chains in-place in the given graph g.

Arguments:

  • graphs: The graph to be processed.
  • verbose: Level of verbosity (default: 0).

Returns:

  • The mutated graph g with all chains flattened.
source
FeynmanDiagram.ComputationalGraphs.flatten_all_chains!Method
function flatten_all_chains!(graphs::Union{Tuple,AbstractVector{<:AbstractGraph}}; verbose=0)
 
-Flattens all nodes representing trivial unary chains in-place in the given graphs.

Arguments:

  • graphs: A collection of graphs to be processed.
  • verbose: Level of verbosity (default: 0).

Returns:

  • The mutated collection graphs with all chains in each graph flattened.
source
FeynmanDiagram.ComputationalGraphs.flatten_chains!Method
function flatten_chains!(g::AbstractGraph)
+Flattens all nodes representing trivial unary chains in-place in the given graphs.

Arguments:

  • graphs: A collection of graphs to be processed.
  • verbose: Level of verbosity (default: 0).

Returns:

  • The mutated collection graphs with all chains in each graph flattened.
source
FeynmanDiagram.ComputationalGraphs.flatten_chains!Method
function flatten_chains!(g::AbstractGraph)
 
 Recursively flattens chains of subgraphs within the given graph `g` by merging certain trivial unary subgraphs 
 into their parent graphs in the in-place form.
 
 Acts only on subgraphs of `g` with the following structure: 𝓞 --- 𝓞' --- ⋯ --- 𝓞'' ⋯ (!),
-where the stop-case (!) represents a leaf, a non-trivial unary operator 𝓞'''(g) != g, or a non-unary operation.

Arguments:

  • g::AbstractGraph: graph to be modified
source
FeynmanDiagram.ComputationalGraphs.flatten_chainsMethod
function flatten_chains(g::AbstractGraph) 
+where the stop-case (!) represents a leaf, a non-trivial unary operator 𝓞'''(g) != g, or a non-unary operation.

Arguments:

  • g::AbstractGraph: graph to be modified
source
FeynmanDiagram.ComputationalGraphs.flatten_chainsMethod
function flatten_chains(g::AbstractGraph) 
 
 Recursively flattens chains of subgraphs within a given graph `g` by merging certain trivial unary subgraphs into their parent graphs,
-This function returns a new graph with flatten chains, derived from the input graph `g` remaining unchanged.

Arguments:

  • g::AbstractGraph: graph to be modified
source
FeynmanDiagram.ComputationalGraphs.flatten_prod!Method
flatten_prod!(graph::G; map::Dict{Int,G}=Dict{Int,G}()) where {G<:AbstractGraph}
+This function returns a new graph with flatten chains, derived from the input graph `g` remaining unchanged.

Arguments:

  • g::AbstractGraph: graph to be modified
source
FeynmanDiagram.ComputationalGraphs.flatten_prod!Method
flatten_prod!(graph::G; map::Dict{Int,G}=Dict{Int,G}()) where {G<:AbstractGraph}
 
 Recursively merge multi-product sub-branches within the given graph `g  by merging  product subgraphs 
-into their parent product graphs in the in-place form.

Arguments:

  • g::AbstractGraph: graph to be modified
  • map::Dict{Int,G}=Dict{Int,G}(): A dictionary that maps the id of an original node with its corresponding new node after transformation.

In recursive transform, nodes can be visited several times by different parents. This map keeps track of those visited, and reuse those transformed sub-branches instead of recreating them.

source
FeynmanDiagram.ComputationalGraphs.flatten_sum!Method
flatten_sum!(graph::G; map::Dict{Int,G}=Dict{Int,G}()) where {G<:AbstractGraph}
+into their parent product graphs in the in-place form.

Arguments:

  • g::AbstractGraph: graph to be modified
  • map::Dict{Int,G}=Dict{Int,G}(): A dictionary that maps the id of an original node with its corresponding new node after transformation.

In recursive transform, nodes can be visited several times by different parents. This map keeps track of those visited, and reuse those transformed sub-branches instead of recreating them.

source
FeynmanDiagram.ComputationalGraphs.flatten_sum!Method
flatten_sum!(graph::G; map::Dict{Int,G}=Dict{Int,G}()) where {G<:AbstractGraph}
 
 Recursively merge multi-product sub-branches within the given graph `g  by merging  sum subgraphs 
-into their parent sum graphs in the in-place form.

Arguments:

  • g::AbstractGraph: graph to be modified
  • map::Dict{Int,G}=Dict{Int,G}(): A dictionary that maps the id of an original node with its corresponding new node after transformation.

In recursive transform, nodes can be visited several times by different parents. This map keeps track of those visited, and reuse those transformed sub-branches instead of recreating them.

source
FeynmanDiagram.ComputationalGraphs.forwardADMethod
function forwardAD(diag::Graph{F,W}, ID::Int) where {F,W}
+into their parent sum graphs in the in-place form.

Arguments:

  • g::AbstractGraph: graph to be modified
  • map::Dict{Int,G}=Dict{Int,G}(): A dictionary that maps the id of an original node with its corresponding new node after transformation.

In recursive transform, nodes can be visited several times by different parents. This map keeps track of those visited, and reuse those transformed sub-branches instead of recreating them.

source
FeynmanDiagram.ComputationalGraphs.forwardADMethod
function forwardAD(diag::Graph{F,W}, ID::Int) where {F,W}
 
-Given a  graph G and an id of graph g, calculate the derivative d G / d g by forward propagation algorithm.

Arguments:

  • diag::Graph{F,W}: Graph G to be differentiated
  • ID::Int: ID of the graph g
source
FeynmanDiagram.ComputationalGraphs.forwardAD_root!Method
function forwardAD_root!(graphs::AbstractVector{G}, idx::Int=1,
+Given a  graph G and an id of graph g, calculate the derivative d G / d g by forward propagation algorithm.

Arguments:

  • diag::Graph{F,W}: Graph G to be differentiated
  • ID::Int: ID of the graph g
source
FeynmanDiagram.ComputationalGraphs.forwardAD_root!Method
function forwardAD_root!(graphs::AbstractVector{G}, idx::Int=1,
     dual::Dict{Tuple{Int,NTuple{N,Bool}},G}=Dict{Tuple{Int,Tuple{Bool}},G}()) where {G<:Graph,N}
 
-Computes the forward automatic differentiation (AD) of the given graphs beginning from the roots.

Arguments:

  • graphs: A vector of graphs.
  • idx: Index for differentiation (default: 1).
  • dual: A dictionary that holds the result of differentiation.

Returns:

  • The dual dictionary populated with all differentiated graphs, including the intermediate AD.
source
FeynmanDiagram.ComputationalGraphs.groupMethod
function group(gv::AbstractVector{G}, indices::Vector{Int}) where {G<:FeynmanGraph}

Group the graphs in gv by the external operators at the indices indices. Return a dictionary of Vector{OperatorProduct} to GraphVector.

Example

julia> p1 = propagator(𝑓⁺(1)𝑓⁻(2));
+Computes the forward automatic differentiation (AD) of the given graphs beginning from the roots.

Arguments:

  • graphs: A vector of graphs.
  • idx: Index for differentiation (default: 1).
  • dual: A dictionary that holds the result of differentiation.

Returns:

  • The dual dictionary populated with all differentiated graphs, including the intermediate AD.
source
FeynmanDiagram.ComputationalGraphs.groupMethod
function group(gv::AbstractVector{G}, indices::Vector{Int}) where {G<:FeynmanGraph}

Group the graphs in gv by the external operators at the indices indices. Return a dictionary of Vector{OperatorProduct} to GraphVector.

Example

julia> p1 = propagator(𝑓⁺(1)𝑓⁻(2));
 
 julia> p2 = propagator(𝑓⁺(1)𝑓⁻(3));
 
@@ -100,117 +100,117 @@
 julia> ComputationalGraphs.group(gv, [2, ])
 Dict{Vector{OperatorProduct}, Vector{FeynmanGraph{Float64, Float64}}} with 2 entries:
   [f⁺(2)] => [3:f⁺(2)|f⁻(3)⋅-1.0=0.0]
-  [f⁺(1)] => [1:f⁺(1)|f⁻(2)⋅-1.0=0.0, 2:f⁺(1)|f⁻(3)⋅-1.0=0.0]
source
FeynmanDiagram.ComputationalGraphs.has_zero_subfactorsMethod
function has_zero_subfactors(g)
+  [f⁺(1)] => [1:f⁺(1)|f⁻(2)⋅-1.0=0.0, 2:f⁺(1)|f⁻(3)⋅-1.0=0.0]
source
FeynmanDiagram.ComputationalGraphs.has_zero_subfactorsMethod
function has_zero_subfactors(g)
 
 Returns whether the graph g has only zero-valued subgraph factor(s). 
 Note that this function does not recurse through subgraphs of g, so that one may have, e.g.,
 `has_zero_subfactors(g) == true` but `has_zero_subfactors(eldest(g)) == false`.
-By convention, returns `false` if g is a leaf.

Arguments:

  • g::AbstractGraph: graph to be analyzed
source
FeynmanDiagram.ComputationalGraphs.haschildrenMethod
function haschildren(g::AbstractGraph)
+By convention, returns `false` if g is a leaf.

Arguments:

  • g::AbstractGraph: graph to be analyzed
source
FeynmanDiagram.ComputationalGraphs.haschildrenMethod
function haschildren(g::AbstractGraph)
 
-Returns whether the graph has any children (subgraphs).

Arguments:

  • g::AbstractGraph: graph to be analyzed
source
FeynmanDiagram.ComputationalGraphs.idMethod
function id(g::AbstractGraph)
+Returns whether the graph has any children (subgraphs).

Arguments:

  • g::AbstractGraph: graph to be analyzed
source
FeynmanDiagram.ComputationalGraphs.idMethod
function id(g::AbstractGraph)
 
-Returns the unique hash id of computational graph `g`.
source
FeynmanDiagram.ComputationalGraphs.interactionMethod
function interaction(ops::OperatorProduct; name="", reorder::Union{Function,Nothing}=nothing,
-    factor=one(_dtype.factor), weight=zero(_dtype.weight), operator=Sum())

Create a Interaction-type FeynmanGraph from given OperatorProduct ops, including several quantum operators for a vertex. One can call a reorder function for the operators ordering.

source
FeynmanDiagram.ComputationalGraphs.is_externalMethod

function isexternaloperators(g::FeynmanGraph, i)

Check if i in the external indices of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.is_internalMethod
function is_internal(g::FeynmanGraph, i)

Check if i in the internal indices of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.isapprox_oneMethod
function isapprox_one(x)

Returns true if x ≈ one(x).

source
FeynmanDiagram.ComputationalGraphs.isassociativeMethod
function isassociative(g::AbstractGraph)
+Returns the unique hash id of computational graph `g`.
source
FeynmanDiagram.ComputationalGraphs.interactionMethod
function interaction(ops::OperatorProduct; name="", reorder::Union{Function,Nothing}=nothing,
+    factor=one(_dtype.factor), weight=zero(_dtype.weight), operator=Sum())

Create a Interaction-type FeynmanGraph from given OperatorProduct ops, including several quantum operators for a vertex. One can call a reorder function for the operators ordering.

source
FeynmanDiagram.ComputationalGraphs.is_externalMethod

function isexternaloperators(g::FeynmanGraph, i)

Check if i in the external indices of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.is_internalMethod
function is_internal(g::FeynmanGraph, i)

Check if i in the internal indices of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.isapprox_oneMethod
function isapprox_one(x)

Returns true if x ≈ one(x).

source
FeynmanDiagram.ComputationalGraphs.isassociativeMethod
function isassociative(g::AbstractGraph)
 
 Returns true if the graph operation of node `g` is associative.
-Otherwise, returns false.
source
FeynmanDiagram.ComputationalGraphs.isbranchMethod
function isbranch(g::AbstractGraph)
+Otherwise, returns false.
source
FeynmanDiagram.ComputationalGraphs.isbranchMethod
function isbranch(g::AbstractGraph)
 
-Returns whether the graph g is a branch-type (depth-1 and one-child) graph.

Arguments:

  • g::AbstractGraph: graph to be analyzed
source
FeynmanDiagram.ComputationalGraphs.ischainMethod
function ischain(g::AbstractGraph)
+Returns whether the graph g is a branch-type (depth-1 and one-child) graph.

Arguments:

  • g::AbstractGraph: graph to be analyzed
source
FeynmanDiagram.ComputationalGraphs.ischainMethod
function ischain(g::AbstractGraph)
 
-Returns whether the graph g is a chain-type graph (i.e., a unary string).

Arguments:

  • g::AbstractGraph: graph to be analyzed
source
FeynmanDiagram.ComputationalGraphs.isequivMethod
function isequiv(a::AbstractGraph, b::AbstractGraph, args...)
+Returns whether the graph g is a chain-type graph (i.e., a unary string).

Arguments:

  • g::AbstractGraph: graph to be analyzed
source
FeynmanDiagram.ComputationalGraphs.isequivMethod
function isequiv(a::AbstractGraph, b::AbstractGraph, args...)
 
-Determine whether graph `a` is equivalent to graph `b` without considering fields in `args`.
source
FeynmanDiagram.ComputationalGraphs.isleafMethod
function isleaf(g::AbstractGraph)
+Determine whether graph `a` is equivalent to graph `b` without considering fields in `args`.
source
FeynmanDiagram.ComputationalGraphs.isleafMethod
function isleaf(g::AbstractGraph)
 
-Returns whether the graph g is a leaf (terminating tree node).

Arguments:

  • g::AbstractGraph: graph to be analyzed
source
FeynmanDiagram.ComputationalGraphs.linear_combinationMethod
function linear_combination(graphs::Vector{FeynmanGraph{F,W}}, constants::AbstractVector=ones(F, length(graphs))) where {F,W}

Given a vector 𝐠 of graphs each with the same type and external/internal vertices and an equally-sized vector 𝐜 of constants, returns a new graph representing the linear combination (𝐜 ⋅ 𝐠). The function identifies unique graphs from the input graphs and sums their associated constants. All input Graphs must have the same diagram type, orders, and external vertices.

Arguments:

  • graphs vector of input FeymanGraphs
  • constants vector of scalar multiples (defaults to ones(F, length(graphs))).

Returns:

  • A new FeynmanGraph{F,W} object representing the linear combination of the unique input graphs weighted by the constants,

where duplicate graphs in the input graphs are combined by summing their associated constants.

Example:

Given graphs `g1`, `g2`, `g1` and constants `c1`, `c2`, `c3`, the function computes `(c1+c3)*g1 + c2*g2`.
source
FeynmanDiagram.ComputationalGraphs.linear_combinationMethod
function linear_combination(graphs::Vector{Graph{F,W}}, constants::AbstractVector=ones(F, length(graphs))) where {F,W}

Given a vector 𝐠 of graphs and an equally-sized vector 𝐜 of constants, returns a new graph representing the linear combination (𝐜 ⋅ 𝐠). The function identifies unique graphs from the input graphs and sums their associated constants. All input graphs must have the same orders.

Arguments:

  • graphs vector of computational graphs
  • constants vector of scalar multiples (defaults to ones(F, length(graphs))).

Returns:

  • A new Graph{F,W} object representing the linear combination of the unique input graphs weighted by the constants,

where duplicate graphs in the input graphs are combined by summing their associated constants.

Example:

Given graphs `g1`, `g2`, `g1` and constants `c1`, `c2`, `c3`, the function computes `(c1+c3)*g1 + c2*g2`.
source
FeynmanDiagram.ComputationalGraphs.linear_combinationMethod
function linear_combination(g1::FeynmanGraph{F,W}, g2::FeynmanGraph{F,W}, c1, c2) where {F,W}

Returns a graph representing the linear combination c1*g1 + c2*g2. If g1 == g2, it will return a graph representing (c1+c2)*g1 Feynman Graphs g1 and g2 must have the same diagram type, orders, and external vertices.

Arguments:

  • g1 first Feynman graph
  • g2 second Feynman graph
  • c1: first scalar multiple (defaults to 1).
  • c2: second scalar multiple (defaults to 1).
source
FeynmanDiagram.ComputationalGraphs.linear_combinationMethod
function linear_combination(g1::Graph{F,W}, g2::Graph{F,W}, c1, c2) where {F,W}

Returns a graph representing the linear combination c1*g1 + c2*g2. If g1 == g2, it will return a graph representing (c1+c2)*g1. Graphs g1 and g2 must have the same orders.

Arguments:

  • g1 first computational graph
  • g2 second computational graph
  • c1 first scalar multiple
  • c2 second scalar multiple
source
FeynmanDiagram.ComputationalGraphs.merge_all_linear_combinations!Method
function merge_all_linear_combinations!(g::AbstractGraph; verbose=0)
+Returns whether the graph g is a leaf (terminating tree node).

Arguments:

  • g::AbstractGraph: graph to be analyzed
source
FeynmanDiagram.ComputationalGraphs.linear_combinationMethod
function linear_combination(graphs::Vector{FeynmanGraph{F,W}}, constants::AbstractVector=ones(F, length(graphs))) where {F,W}

Given a vector 𝐠 of graphs each with the same type and external/internal vertices and an equally-sized vector 𝐜 of constants, returns a new graph representing the linear combination (𝐜 ⋅ 𝐠). The function identifies unique graphs from the input graphs and sums their associated constants. All input Graphs must have the same diagram type, orders, and external vertices.

Arguments:

  • graphs vector of input FeymanGraphs
  • constants vector of scalar multiples (defaults to ones(F, length(graphs))).

Returns:

  • A new FeynmanGraph{F,W} object representing the linear combination of the unique input graphs weighted by the constants,

where duplicate graphs in the input graphs are combined by summing their associated constants.

Example:

Given graphs `g1`, `g2`, `g1` and constants `c1`, `c2`, `c3`, the function computes `(c1+c3)*g1 + c2*g2`.
source
FeynmanDiagram.ComputationalGraphs.linear_combinationMethod
function linear_combination(graphs::Vector{Graph{F,W}}, constants::AbstractVector=ones(F, length(graphs))) where {F,W}

Given a vector 𝐠 of graphs and an equally-sized vector 𝐜 of constants, returns a new graph representing the linear combination (𝐜 ⋅ 𝐠). The function identifies unique graphs from the input graphs and sums their associated constants. All input graphs must have the same orders.

Arguments:

  • graphs vector of computational graphs
  • constants vector of scalar multiples (defaults to ones(F, length(graphs))).

Returns:

  • A new Graph{F,W} object representing the linear combination of the unique input graphs weighted by the constants,

where duplicate graphs in the input graphs are combined by summing their associated constants.

Example:

Given graphs `g1`, `g2`, `g1` and constants `c1`, `c2`, `c3`, the function computes `(c1+c3)*g1 + c2*g2`.
source
FeynmanDiagram.ComputationalGraphs.linear_combinationMethod
function linear_combination(g1::FeynmanGraph{F,W}, g2::FeynmanGraph{F,W}, c1, c2) where {F,W}

Returns a graph representing the linear combination c1*g1 + c2*g2. If g1 == g2, it will return a graph representing (c1+c2)*g1 Feynman Graphs g1 and g2 must have the same diagram type, orders, and external vertices.

Arguments:

  • g1 first Feynman graph
  • g2 second Feynman graph
  • c1: first scalar multiple (defaults to 1).
  • c2: second scalar multiple (defaults to 1).
source
FeynmanDiagram.ComputationalGraphs.linear_combinationMethod
function linear_combination(g1::Graph{F,W}, g2::Graph{F,W}, c1, c2) where {F,W}

Returns a graph representing the linear combination c1*g1 + c2*g2. If g1 == g2, it will return a graph representing (c1+c2)*g1. Graphs g1 and g2 must have the same orders.

Arguments:

  • g1 first computational graph
  • g2 second computational graph
  • c1 first scalar multiple
  • c2 second scalar multiple
source
FeynmanDiagram.ComputationalGraphs.merge_all_linear_combinations!Method
function merge_all_linear_combinations!(g::AbstractGraph; verbose=0)
 
-Merges all nodes representing a linear combination of a non-unique list of subgraphs in-place in the given graph `g`.

Arguments:

  • g: An AbstractGraph.
  • verbose: Level of verbosity (default: 0).

Returns:

  • Optimized graph.

source
FeynmanDiagram.ComputationalGraphs.merge_all_linear_combinations!Method
function merge_all_linear_combinations!(graphs::Union{Tuple,AbstractVector{<:AbstractGraph}}; verbose=0)
+Merges all nodes representing a linear combination of a non-unique list of subgraphs in-place in the given graph `g`.

Arguments:

  • g: An AbstractGraph.
  • verbose: Level of verbosity (default: 0).

Returns:

  • Optimized graph.

source
FeynmanDiagram.ComputationalGraphs.merge_all_linear_combinations!Method
function merge_all_linear_combinations!(graphs::Union{Tuple,AbstractVector{<:AbstractGraph}}; verbose=0)
 
-Merges all nodes representing a linear combination of a non-unique list of subgraphs in-place in the given graphs.

Arguments:

  • graphs: A collection of graphs to be processed.
  • verbose: Level of verbosity (default: 0).

Returns:

  • Optimized graphs.

source
FeynmanDiagram.ComputationalGraphs.merge_all_multi_products!Method
function merge_all_multi_products!(g::Graph; verbose=0)
+Merges all nodes representing a linear combination of a non-unique list of subgraphs in-place in the given graphs.

Arguments:

  • graphs: A collection of graphs to be processed.
  • verbose: Level of verbosity (default: 0).

Returns:

  • Optimized graphs.

source
FeynmanDiagram.ComputationalGraphs.merge_all_multi_products!Method
function merge_all_multi_products!(g::Graph; verbose=0)
 
-Merges all nodes representing a multi product of a non-unique list of subgraphs in-place in the given graph `g`.

Arguments:

  • g::Graph: A Graph.
  • verbose: Level of verbosity (default: 0).

Returns:

  • Optimized graph.

source
FeynmanDiagram.ComputationalGraphs.merge_all_multi_products!Method
function merge_all_multi_products!(graphs::Union{Tuple,AbstractVector{<:Graph}}; verbose=0)
+Merges all nodes representing a multi product of a non-unique list of subgraphs in-place in the given graph `g`.

Arguments:

  • g::Graph: A Graph.
  • verbose: Level of verbosity (default: 0).

Returns:

  • Optimized graph.

source
FeynmanDiagram.ComputationalGraphs.merge_all_multi_products!Method
function merge_all_multi_products!(graphs::Union{Tuple,AbstractVector{<:Graph}}; verbose=0)
 
-Merges all nodes representing a multi product of a non-unique list of subgraphs in-place in the given graphs.

Arguments:

  • graphs: A collection of graphs to be processed.
  • verbose: Level of verbosity (default: 0).

Returns:

  • Optimized graphs.

source
FeynmanDiagram.ComputationalGraphs.merge_linear_combination!Method
function merge_linear_combination!(g::AbstractGraph)
+Merges all nodes representing a multi product of a non-unique list of subgraphs in-place in the given graphs.

Arguments:

  • graphs: A collection of graphs to be processed.
  • verbose: Level of verbosity (default: 0).

Returns:

  • Optimized graphs.

source
FeynmanDiagram.ComputationalGraphs.merge_linear_combination!Method
function merge_linear_combination!(g::AbstractGraph)
 
 Modifies a computational graph `g` by factorizing multiplicative prefactors, e.g.,
 3*g1 + 5*g2 + 7*g1 + 9*g2 ↦ 10*g1 + 14*g2 = linear_combination(g1, g2, 10, 14).
 Returns a linear combination of unique subgraphs and their total prefactors. 
-Does nothing if the graph `g` does not represent a Sum operation.

Arguments:

  • g::AbstractGraph: graph to be modified
source
FeynmanDiagram.ComputationalGraphs.merge_linear_combinationMethod
function merge_linear_combination(g::AbstractGraph)
+Does nothing if the graph `g` does not represent a Sum operation.

Arguments:

  • g::AbstractGraph: graph to be modified
source
FeynmanDiagram.ComputationalGraphs.merge_linear_combinationMethod
function merge_linear_combination(g::AbstractGraph)
 
 Returns a copy of computational graph `g` with multiplicative prefactors factorized,
 e.g., 3*g1 + 5*g2 + 7*g1 + 9*g2 ↦ 10*g1 + 14*g2 = linear_combination(g1, g2, 10, 14).
 Returns a linear combination of unique subgraphs and their total prefactors. 
-Does nothing if the graph `g` does not represent a Sum operation.

Arguments:

  • g::AbstractGraph: graph to be modified
source
FeynmanDiagram.ComputationalGraphs.merge_multi_product!Method
function merge_multi_product!(g::Graph{F,W}) where {F,W}
+Does nothing if the graph `g` does not represent a Sum operation.

Arguments:

  • g::AbstractGraph: graph to be modified
source
FeynmanDiagram.ComputationalGraphs.merge_multi_product!Method
function merge_multi_product!(g::Graph{F,W}) where {F,W}
 
 Merge multiple products within a computational graph `g` if they share the same operator (`Prod`).
 If `g.operator == Prod`, this function will merge `N` identical subgraphs into a single subgraph with a power operator `Power(N)`. 
-The function ensures each unique subgraph is counted and merged appropriately, preserving any distinct subgraph_factors associated with them.

Arguments:

  • g::Graph: graph to be modified

Returns

  • A merged computational graph with potentially fewer subgraphs if there were repeating subgraphs with the Prod operator. If the input graph's operator isn't Prod, the function returns the input graph unchanged.
source
FeynmanDiagram.ComputationalGraphs.merge_multi_productMethod
function merge_multi_product(g::Graph{F,W}) where {F,W}
+The function ensures each unique subgraph is counted and merged appropriately, preserving any distinct subgraph_factors associated with them.

Arguments:

  • g::Graph: graph to be modified

Returns

  • A merged computational graph with potentially fewer subgraphs if there were repeating subgraphs with the Prod operator. If the input graph's operator isn't Prod, the function returns the input graph unchanged.
source
FeynmanDiagram.ComputationalGraphs.merge_multi_productMethod
function merge_multi_product(g::Graph{F,W}) where {F,W}
 
 Returns a copy of computational graph `g` with multiple products merged if they share the same operator (`Prod`).
 If `g.operator == Prod`, this function will merge `N` identical subgraphs into a single subgraph with a power operator `Power(N)`. 
-The function ensures each unique subgraph is counted and merged appropriately, preserving any distinct subgraph_factors associated with them.

Arguments:

  • g::Graph: graph to be modified

Returns

  • A merged computational graph with potentially fewer subgraphs if there were repeating subgraphs with the Prod operator. If the input graph's operator isn't Prod, the function returns the input graph unchanged.
source
FeynmanDiagram.ComputationalGraphs.multi_productMethod
multi_product(graphs::Vector{Graph{F,W}}, constants::AbstractVector=ones(F, length(graphs))) where {F,W,C}

Construct a product graph from multiple input graphs, where each graph can be weighted by a constant. For graphs that are repeated more than once, it adds a power operator to the subgraph to represent the repetition. Moreover, it optimizes any trivial unary operators in the resulting product graph.

Arguments:

  • graphs::Vector{Graph{F,W}}: A vector of input graphs to be multiplied.
  • constants::AbstractVector: A vector of scalar multiples. If not provided, it defaults to a vector of ones of the same length as graphs.

Returns:

  • A new product graph with the unique subgraphs (or powered versions thereof) and the associated constants as subgraph factors.

Example:

Given graphs `g1`, `g2`, `g1` and constants `c1`, `c2`, `c3`, the function computes `(c1*c3)*(g1)^2 * c2*g2`.
source
FeynmanDiagram.ComputationalGraphs.multi_productMethod
function multi_product(g1::Graph{F,W}, g2::Graph{F,W}, c1=F(1), c2=F(1)) where {F,W,C}

Returns a graph representing the multi product c1*g1 * c2*g2. If g1 == g2, it will return a graph representing c1*c2 * (g1)^2 with Power(2) operator.

Arguments:

  • g1: first computational graph
  • g2: second computational graph
  • c1: first scalar multiple (defaults to 1).
  • c2: second scalar multiple (defaults to 1).
source
FeynmanDiagram.ComputationalGraphs.nameMethod
function name(g::AbstractGraph)
+The function ensures each unique subgraph is counted and merged appropriately, preserving any distinct subgraph_factors associated with them.

Arguments:

  • g::Graph: graph to be modified

Returns

  • A merged computational graph with potentially fewer subgraphs if there were repeating subgraphs with the Prod operator. If the input graph's operator isn't Prod, the function returns the input graph unchanged.
source
FeynmanDiagram.ComputationalGraphs.multi_productMethod
multi_product(graphs::Vector{Graph{F,W}}, constants::AbstractVector=ones(F, length(graphs))) where {F,W,C}

Construct a product graph from multiple input graphs, where each graph can be weighted by a constant. For graphs that are repeated more than once, it adds a power operator to the subgraph to represent the repetition. Moreover, it optimizes any trivial unary operators in the resulting product graph.

Arguments:

  • graphs::Vector{Graph{F,W}}: A vector of input graphs to be multiplied.
  • constants::AbstractVector: A vector of scalar multiples. If not provided, it defaults to a vector of ones of the same length as graphs.

Returns:

  • A new product graph with the unique subgraphs (or powered versions thereof) and the associated constants as subgraph factors.

Example:

Given graphs `g1`, `g2`, `g1` and constants `c1`, `c2`, `c3`, the function computes `(c1*c3)*(g1)^2 * c2*g2`.
source
FeynmanDiagram.ComputationalGraphs.multi_productMethod
function multi_product(g1::Graph{F,W}, g2::Graph{F,W}, c1=F(1), c2=F(1)) where {F,W,C}

Returns a graph representing the multi product c1*g1 * c2*g2. If g1 == g2, it will return a graph representing c1*c2 * (g1)^2 with Power(2) operator.

Arguments:

  • g1: first computational graph
  • g2: second computational graph
  • c1: first scalar multiple (defaults to 1).
  • c2: second scalar multiple (defaults to 1).
source
FeynmanDiagram.ComputationalGraphs.nameMethod
function name(g::AbstractGraph)
 
-Returns the name of computational graph `g`.
source
FeynmanDiagram.ComputationalGraphs.onechildMethod
function onechild(g::AbstractGraph)
+Returns the name of computational graph `g`.
source
FeynmanDiagram.ComputationalGraphs.onechildMethod
function onechild(g::AbstractGraph)
 
-Returns whether the graph g has only one child (subgraph).

Arguments:

  • g::AbstractGraph: graph to be analyzed
source
FeynmanDiagram.ComputationalGraphs.open_parenthesis!Method
open_parenthesis!(graph::G; map::Dict{Int,G}=Dict{Int,G}()) where {G<:AbstractGraph}
+Returns whether the graph g has only one child (subgraph).

Arguments:

  • g::AbstractGraph: graph to be analyzed
source
FeynmanDiagram.ComputationalGraphs.open_parenthesis!Method
open_parenthesis!(graph::G; map::Dict{Int,G}=Dict{Int,G}()) where {G<:AbstractGraph}
 
 Recursively open parenthesis of subgraphs within the given graph `g`with in place form.  The graph eventually becomes 
-a single Sum root node with multiple subgraphs that represents multi-product of nodes (not flattened).

Arguments:

  • g::AbstractGraph: graph to be modified
  • map::Dict{Int,G}=Dict{Int,G}(): A dictionary that maps the id of an original node with its corresponding new node after transformation.

In recursive transform, nodes can be visited several times by different parents. This map keeps track of those visited, and reuse those transformed sub-branches instead of recreating them. parents

source
FeynmanDiagram.ComputationalGraphs.operatorMethod

function operator(g::AbstractGraph)

Returns the operation associated with computational graph node `g`.
source
FeynmanDiagram.ComputationalGraphs.optimize!Method
function optimize!(graphs::Union{Tuple,AbstractVector{<:AbstractGraph}}; level=0, verbose=0, normalize=nothing)
+a single Sum root node with multiple subgraphs that represents multi-product of nodes (not flattened).

Arguments:

  • g::AbstractGraph: graph to be modified
  • map::Dict{Int,G}=Dict{Int,G}(): A dictionary that maps the id of an original node with its corresponding new node after transformation.

In recursive transform, nodes can be visited several times by different parents. This map keeps track of those visited, and reuse those transformed sub-branches instead of recreating them. parents

source
FeynmanDiagram.ComputationalGraphs.operatorMethod

function operator(g::AbstractGraph)

Returns the operation associated with computational graph node `g`.
source
FeynmanDiagram.ComputationalGraphs.optimize!Method
function optimize!(graphs::Union{Tuple,AbstractVector{<:AbstractGraph}}; level=0, verbose=0, normalize=nothing)
 
 In-place optimization of given `graphs`. Removes duplicated leaves, flattens chains, 
-merges linear combinations, and removes zero-valued subgraphs. When `level > 0`, also removes duplicated intermediate nodes.

Arguments:

  • graphs: A tuple or vector of graphs.
  • level: Optimization level (default: 0). A value greater than 0 triggers more extensive but slower optimization processes, such as removing duplicated intermediate nodes.
  • verbose: Level of verbosity (default: 0).
  • normalize: Optional function to normalize the graphs (default: nothing).

Returns

  • Returns the optimized graphs. If the input graphs is empty, it returns nothing.
source
FeynmanDiagram.ComputationalGraphs.optimizeMethod
function optimize(graphs::Union{Tuple,AbstractVector{<:AbstractGraph}}; level=0, verbose=0, normalize=nothing)
+merges linear combinations, and removes zero-valued subgraphs. When `level > 0`, also removes duplicated intermediate nodes.

Arguments:

  • graphs: A tuple or vector of graphs.
  • level: Optimization level (default: 0). A value greater than 0 triggers more extensive but slower optimization processes, such as removing duplicated intermediate nodes.
  • verbose: Level of verbosity (default: 0).
  • normalize: Optional function to normalize the graphs (default: nothing).

Returns

  • Returns the optimized graphs. If the input graphs is empty, it returns nothing.
source
FeynmanDiagram.ComputationalGraphs.optimizeMethod
function optimize(graphs::Union{Tuple,AbstractVector{<:AbstractGraph}}; level=0, verbose=0, normalize=nothing)
 
 Optimizes a copy of given `graphs`. Removes duplicated nodes (when `level > 0`) or leaves, flattens chains, 
-merges linear combinations, and removing zero-valued subgraphs.

Arguments:

  • graphs: A tuple or vector of graphs.
  • level: Optimization level (default: 0). A value greater than 0 triggers more extensive but slower optimization processes, such as removing duplicated nodes.
  • verbose: Level of verbosity (default: 0).
  • normalize: Optional function to normalize the graphs (default: nothing).

Returns:

  • A tuple/vector of optimized graphs.
source
FeynmanDiagram.ComputationalGraphs.ordersMethod
function orders(g::AbstractGraph)
+merges linear combinations, and removing zero-valued subgraphs.

Arguments:

  • graphs: A tuple or vector of graphs.
  • level: Optimization level (default: 0). A value greater than 0 triggers more extensive but slower optimization processes, such as removing duplicated nodes.
  • verbose: Level of verbosity (default: 0).
  • normalize: Optional function to normalize the graphs (default: nothing).

Returns:

  • A tuple/vector of optimized graphs.
source
FeynmanDiagram.ComputationalGraphs.ordersMethod
function orders(g::AbstractGraph)
 
-Returns the derivative orders (::Vector{Int}) of computational graph `g`.
source
FeynmanDiagram.ComputationalGraphs.plot_treeMethod
function plot_tree(graph::AbstractGraph; verbose = 0, maxdepth = 6)
+Returns the derivative orders (::Vector{Int}) of computational graph `g`.
source
FeynmanDiagram.ComputationalGraphs.plot_treeMethod
function plot_tree(graph::AbstractGraph; verbose = 0, maxdepth = 6)
 
-Visualize the computational graph as a tree using ete3 python package

#Arguments

  • graph::AbstractGraph : the computational graph struct to visualize
  • verbose=0 : the amount of information to show
  • maxdepth=6 : deepest level of the computational graph to show
source
FeynmanDiagram.ComputationalGraphs.propagatorMethod
function propagator(ops::Union{OperatorProduct,Vector{QuantumOperator}};
-    name="", factor=one(_dtype.factor), weight=zero(_dtype.weight), operator=Sum())

Create a Propagator-type FeynmanGraph from given OperatorProduct or Vector{QuantumOperator} ops, including two quantum operators.

source
FeynmanDiagram.ComputationalGraphs.propertiesMethod
function properties(g::AbstractGraph)
+Visualize the computational graph as a tree using ete3 python package

#Arguments

  • graph::AbstractGraph : the computational graph struct to visualize
  • verbose=0 : the amount of information to show
  • maxdepth=6 : deepest level of the computational graph to show
source
FeynmanDiagram.ComputationalGraphs.propagatorMethod
function propagator(ops::Union{OperatorProduct,Vector{QuantumOperator}};
+    name="", factor=one(_dtype.factor), weight=zero(_dtype.weight), operator=Sum())

Create a Propagator-type FeynmanGraph from given OperatorProduct or Vector{QuantumOperator} ops, including two quantum operators.

source
FeynmanDiagram.ComputationalGraphs.propertiesMethod
function properties(g::AbstractGraph)
 
-Returns additional properties, if any, of the computational graph `g`.
source
FeynmanDiagram.ComputationalGraphs.relabel!Method
function relabel!(g::FeynmanGraph, map::Dict{Int,Int})
+Returns additional properties, if any, of the computational graph `g`.
source
FeynmanDiagram.ComputationalGraphs.relabel!Method
function relabel!(g::FeynmanGraph, map::Dict{Int,Int})
 
 Relabels the quantum operators in `g` and its subgraphs according to `map`.
-For example, `map = {1=>2, 3=>2}`` will find all quantum operators with labels 1 and 3, and then map them to 2.

Arguments:

  • g::FeynmanGraph: graph to be modified
  • map: mapping from old labels to the new ones
source
FeynmanDiagram.ComputationalGraphs.relabelMethod
function relabel(g::FeynmanGraph, map::Dict{Int,Int})
+For example, `map = {1=>2, 3=>2}`` will find all quantum operators with labels 1 and 3, and then map them to 2.

Arguments:

  • g::FeynmanGraph: graph to be modified
  • map: mapping from old labels to the new ones
source
FeynmanDiagram.ComputationalGraphs.relabelMethod
function relabel(g::FeynmanGraph, map::Dict{Int,Int})
 
 Returns a copy of `g` with quantum operators in `g` and its subgraphs relabeled according to `map`.
-For example, `map = {1=>2, 3=>2}` will find all quantum operators with labels 1 and 3, and then map them to 2.

Arguments:

  • g::FeynmanGraph: graph to be modified
  • map: mapping from old labels to the new ones
source
FeynmanDiagram.ComputationalGraphs.remove_all_zero_valued_subgraphs!Method
function remove_all_zero_valued_subgraphs!(g::AbstractGraph; verbose=0)
+For example, `map = {1=>2, 3=>2}` will find all quantum operators with labels 1 and 3, and then map them to 2.

Arguments:

  • g::FeynmanGraph: graph to be modified
  • map: mapping from old labels to the new ones
source
FeynmanDiagram.ComputationalGraphs.remove_all_zero_valued_subgraphs!Method
function remove_all_zero_valued_subgraphs!(g::AbstractGraph; verbose=0)
 
-Recursively removes all zero-valued subgraph(s) in-place in the given graph `g`.

Arguments:

  • g: An AbstractGraph.
  • verbose: Level of verbosity (default: 0).

Returns:

  • Optimized graph.

source
FeynmanDiagram.ComputationalGraphs.remove_all_zero_valued_subgraphs!Method
function remove_all_zero_valued_subgraphs!(graphs::Union{Tuple,AbstractVector{<:AbstractGraph}}; verbose=0)
+Recursively removes all zero-valued subgraph(s) in-place in the given graph `g`.

Arguments:

  • g: An AbstractGraph.
  • verbose: Level of verbosity (default: 0).

Returns:

  • Optimized graph.

source
FeynmanDiagram.ComputationalGraphs.remove_all_zero_valued_subgraphs!Method
function remove_all_zero_valued_subgraphs!(graphs::Union{Tuple,AbstractVector{<:AbstractGraph}}; verbose=0)
 
-Recursively removes all zero-valued subgraph(s) in-place in the given graphs.

Arguments:

  • graphs: A collection of graphs to be processed.
  • verbose: Level of verbosity (default: 0).

Returns:

  • Optimized graphs.

source
FeynmanDiagram.ComputationalGraphs.remove_duplicated_leaves!Method
function remove_duplicated_leaves!(graphs::Union{Tuple,AbstractVector{<:AbstractGraph}}; verbose=0, normalize=nothing, kwargs...)
+Recursively removes all zero-valued subgraph(s) in-place in the given graphs.

Arguments:

  • graphs: A collection of graphs to be processed.
  • verbose: Level of verbosity (default: 0).

Returns:

  • Optimized graphs.

source
FeynmanDiagram.ComputationalGraphs.remove_duplicated_leaves!Method
function remove_duplicated_leaves!(graphs::Union{Tuple,AbstractVector{<:AbstractGraph}}; verbose=0, normalize=nothing, kwargs...)
 
-Removes duplicated leaf nodes in-place from a collection of graphs. It also provides optional normalization for these leaves.

Arguments:

  • graphs: A collection of graphs to be processed.
  • verbose: Level of verbosity (default: 0).
  • normalize: Optional function to normalize the graphs (default: nothing).
source
FeynmanDiagram.ComputationalGraphs.remove_zero_valued_subgraphs!Method
function remove_zero_valued_subgraphs!(g::AbstractGraph)
+Removes duplicated leaf nodes in-place from a collection of graphs. It also provides optional normalization for these leaves.

Arguments:

  • graphs: A collection of graphs to be processed.
  • verbose: Level of verbosity (default: 0).
  • normalize: Optional function to normalize the graphs (default: nothing).
source
FeynmanDiagram.ComputationalGraphs.remove_zero_valued_subgraphs!Method
function remove_zero_valued_subgraphs!(g::AbstractGraph)
 
-Removes zero-valued (zero subgraph_factor) subgraph(s) of a computational graph `g`. If all subgraphs are zero-valued, the first one (`eldest(g)`) will be retained.

Arguments:

  • g::AbstractGraph: graph to be modified
source
FeynmanDiagram.ComputationalGraphs.remove_zero_valued_subgraphsMethod
function remove_zero_valued_subgraphs(g::AbstractGraph)
+Removes zero-valued (zero subgraph_factor) subgraph(s) of a computational graph `g`. If all subgraphs are zero-valued, the first one (`eldest(g)`) will be retained.

Arguments:

  • g::AbstractGraph: graph to be modified
source
FeynmanDiagram.ComputationalGraphs.remove_zero_valued_subgraphsMethod
function remove_zero_valued_subgraphs(g::AbstractGraph)
 
 Returns a copy of graph `g` with zero-valued (zero subgraph_factor) subgraph(s) removed.
-If all subgraphs are zero-valued, the first one (`eldest(g)`) will be retained.

Arguments:

  • g::AbstractGraph: graph to be modified
source
FeynmanDiagram.ComputationalGraphs.replace_subgraph!Method
function replace_subgraph!(g::AbstractGraph, w::AbstractGraph, m::AbstractGraph)
+If all subgraphs are zero-valued, the first one (`eldest(g)`) will be retained.

Arguments:

  • g::AbstractGraph: graph to be modified
source
FeynmanDiagram.ComputationalGraphs.replace_subgraph!Method
function replace_subgraph!(g::AbstractGraph, w::AbstractGraph, m::AbstractGraph)
 
 Modifies `g` by replacing the subgraph `w` with a new graph `m`.
-For Feynman diagrams, subgraphs `w` and `m` should have the same diagram type, orders, and external indices.

Arguments:

  • g::AbstractGraph: graph to be modified
  • w::AbstractGraph: subgraph to replace
  • m::AbstractGraph: new subgraph
source
FeynmanDiagram.ComputationalGraphs.replace_subgraphMethod
function replace_subgraph(g::AbstractGraph, w::AbstractGraph, m::AbstractGraph)
+For Feynman diagrams, subgraphs `w` and `m` should have the same diagram type, orders, and external indices.

Arguments:

  • g::AbstractGraph: graph to be modified
  • w::AbstractGraph: subgraph to replace
  • m::AbstractGraph: new subgraph
source
FeynmanDiagram.ComputationalGraphs.replace_subgraphMethod
function replace_subgraph(g::AbstractGraph, w::AbstractGraph, m::AbstractGraph)
 
 Creates a modified copy of `g` by replacing the subgraph `w` with a new graph `m`.
-For Feynman diagrams, subgraphs `w` and `m` should have the same diagram type, orders, and external indices.

Arguments:

  • g::AbstractGraph: graph to be modified
  • w::AbstractGraph: subgraph to replace
  • m::AbstractGraph: new subgraph
source
FeynmanDiagram.ComputationalGraphs.set_id!Method

function set_id!(g::AbstractGraph, id)

Update the id of graph `g` to `id`.
source
FeynmanDiagram.ComputationalGraphs.set_name!Method

function set_name!(g::AbstractGraph, name::AbstractString)

Update the name of graph `g` to `name`.
source
FeynmanDiagram.ComputationalGraphs.set_operator!Method

function set_operator!(g::AbstractGraph, operator::AbstractOperator)

Update the operator of graph `g` to `typeof(operator)`.
source
FeynmanDiagram.ComputationalGraphs.set_operator!Method

function set_operator!(g::AbstractGraph, operator::Type{<:AbstractOperator})

Update the operator of graph `g` to `operator`.
source
FeynmanDiagram.ComputationalGraphs.set_orders!Method

function set_orders!(g::AbstractGraph, orders::AbstractVector)

Update the orders of graph `g` to `orders`.
source
FeynmanDiagram.ComputationalGraphs.set_properties!Method

function set_properties!(g::AbstractGraph, properties)

Update the properties of graph `g` to `properties`.
source
FeynmanDiagram.ComputationalGraphs.set_subgraph!Function

function set_subgraph!(g::AbstractGraph, subgraph::AbstractGraph, i=1)

Update the `i`th subgraph of graph `g` to `subgraph`.
-Defaults to the first subgraph factor if an index `i` is not supplied.
source
FeynmanDiagram.ComputationalGraphs.set_subgraph_factor!Function

function setsubgraphfactor!(g::AbstractGraph, subgraph_factor, i=1)

Update the `i`th subgraph factor of graph `g` to `subgraph_factor`.
-Defaults to the first subgraph factor if an index `i` is not supplied.
source
FeynmanDiagram.ComputationalGraphs.set_subgraph_factors!Method

function setsubgraphfactors!(g::AbstractGraph, subgraph_factors::AbstractVector, indices::AbstractVector{Int})

Update the specified subgraph factors of graph `g` at indices `indices` to `subgraph_factors`.
-By default, calls `set_subgraph_factor!(g, subgraph_factors[i], i)` for each `i` in `indices`.
source
FeynmanDiagram.ComputationalGraphs.set_subgraph_factors!Method

function setsubgraphfactors!(g::AbstractGraph, subgraph_factors::AbstractVector)

Update the subgraph factors of graph `g` to `subgraphs`.
source
FeynmanDiagram.ComputationalGraphs.set_subgraphs!Method

function set_subgraphs!(g::AbstractGraph, subgraphs::AbstractVector{<:AbstractGraph}, indices::AbstractVector{Int})

Update the specified subgraphs of graph `g` at indices `indices` to `subgraphs`.
-By default, calls `set_subgraph!(g, subgraphs[i], i)` for each `i` in `indices`.
source
FeynmanDiagram.ComputationalGraphs.set_subgraphs!Method

function set_subgraphs!(g::AbstractGraph, subgraphs::AbstractVector{<:AbstractGraph})

Update the full list of subgraphs of graph `g` to `subgraphs`.
source
FeynmanDiagram.ComputationalGraphs.set_weight!Method

function set_weight!(g::AbstractGraph, weight)

Update the weight of graph `g` to `weight`.
source
FeynmanDiagram.ComputationalGraphs.standardize_labels!Method
function standardize_labels!(g::FeynmanGraph)
+For Feynman diagrams, subgraphs `w` and `m` should have the same diagram type, orders, and external indices.

Arguments:

  • g::AbstractGraph: graph to be modified
  • w::AbstractGraph: subgraph to replace
  • m::AbstractGraph: new subgraph
source
FeynmanDiagram.ComputationalGraphs.set_id!Method

function set_id!(g::AbstractGraph, id)

Update the id of graph `g` to `id`.
source
FeynmanDiagram.ComputationalGraphs.set_name!Method

function set_name!(g::AbstractGraph, name::AbstractString)

Update the name of graph `g` to `name`.
source
FeynmanDiagram.ComputationalGraphs.set_operator!Method

function set_operator!(g::AbstractGraph, operator::AbstractOperator)

Update the operator of graph `g` to `typeof(operator)`.
source
FeynmanDiagram.ComputationalGraphs.set_operator!Method

function set_operator!(g::AbstractGraph, operator::Type{<:AbstractOperator})

Update the operator of graph `g` to `operator`.
source
FeynmanDiagram.ComputationalGraphs.set_orders!Method

function set_orders!(g::AbstractGraph, orders::AbstractVector)

Update the orders of graph `g` to `orders`.
source
FeynmanDiagram.ComputationalGraphs.set_properties!Method

function set_properties!(g::AbstractGraph, properties)

Update the properties of graph `g` to `properties`.
source
FeynmanDiagram.ComputationalGraphs.set_subgraph!Function

function set_subgraph!(g::AbstractGraph, subgraph::AbstractGraph, i=1)

Update the `i`th subgraph of graph `g` to `subgraph`.
+Defaults to the first subgraph factor if an index `i` is not supplied.
source
FeynmanDiagram.ComputationalGraphs.set_subgraph_factor!Function

function setsubgraphfactor!(g::AbstractGraph, subgraph_factor, i=1)

Update the `i`th subgraph factor of graph `g` to `subgraph_factor`.
+Defaults to the first subgraph factor if an index `i` is not supplied.
source
FeynmanDiagram.ComputationalGraphs.set_subgraph_factors!Method

function setsubgraphfactors!(g::AbstractGraph, subgraph_factors::AbstractVector, indices::AbstractVector{Int})

Update the specified subgraph factors of graph `g` at indices `indices` to `subgraph_factors`.
+By default, calls `set_subgraph_factor!(g, subgraph_factors[i], i)` for each `i` in `indices`.
source
FeynmanDiagram.ComputationalGraphs.set_subgraph_factors!Method

function setsubgraphfactors!(g::AbstractGraph, subgraph_factors::AbstractVector)

Update the subgraph factors of graph `g` to `subgraphs`.
source
FeynmanDiagram.ComputationalGraphs.set_subgraphs!Method

function set_subgraphs!(g::AbstractGraph, subgraphs::AbstractVector{<:AbstractGraph}, indices::AbstractVector{Int})

Update the specified subgraphs of graph `g` at indices `indices` to `subgraphs`.
+By default, calls `set_subgraph!(g, subgraphs[i], i)` for each `i` in `indices`.
source
FeynmanDiagram.ComputationalGraphs.set_subgraphs!Method

function set_subgraphs!(g::AbstractGraph, subgraphs::AbstractVector{<:AbstractGraph})

Update the full list of subgraphs of graph `g` to `subgraphs`.
source
FeynmanDiagram.ComputationalGraphs.set_weight!Method

function set_weight!(g::AbstractGraph, weight)

Update the weight of graph `g` to `weight`.
source
FeynmanDiagram.ComputationalGraphs.standardize_labels!Method
function standardize_labels!(g::FeynmanGraph)
 
 Finds all labels involved in `g` and its subgraphs and 
 modifies `g` by relabeling in standardized order, e.g.,
-(1, 4, 5, 7, ...) ↦ (1, 2, 3, 4, ....)

Arguments:

  • g::FeynmanGraph: graph to be relabeled
source
FeynmanDiagram.ComputationalGraphs.standardize_labelsMethod
function standardize_labels!(g::FeynmanGraph)
+(1, 4, 5, 7, ...) ↦ (1, 2, 3, 4, ....)

Arguments:

  • g::FeynmanGraph: graph to be relabeled
source
FeynmanDiagram.ComputationalGraphs.standardize_labelsMethod
function standardize_labels!(g::FeynmanGraph)
 
 Finds all labels involved in `g` and its subgraphs and returns 
 a copy of `g` relabeled in a standardized order, e.g.,
-(1, 4, 5, 7, ...) ↦ (1, 2, 3, 4, ....)

Arguments:

  • g::FeynmanGraph: graph to be relabeled
source
FeynmanDiagram.ComputationalGraphs.subgraphFunction

function subgraph(g::AbstractGraph, i=1)

Returns a copy of the `i`th subgraph of computational graph `g`.
-Defaults to the first subgraph if an index `i` is not supplied.
source
FeynmanDiagram.ComputationalGraphs.subgraph_factorFunction

function subgraph_factor(g::AbstractGraph, i=1)

Returns a copy of the `i`th subgraph factor of computational graph `g`.
-Defaults to the first subgraph factor if an index `i` is not supplied.
source
FeynmanDiagram.ComputationalGraphs.subgraph_factorsMethod

function subgraph_factors(g::AbstractGraph, indices::AbstractVector{Int})

Returns the subgraph factors of computational graph `g` at indices `indices`.
-By default, calls `subgraph_factor(g, i)` for each `i` in `indices`.
source
FeynmanDiagram.ComputationalGraphs.subgraph_factorsMethod

function subgraph_factors(g::AbstractGraph)

Returns the subgraph factors of computational graph `g`.
source
FeynmanDiagram.ComputationalGraphs.subgraphsMethod

function subgraphs(g::AbstractGraph, indices::AbstractVector{Int})

Returns the subgraphs of computational graph `g` at indices `indices`.
-By default, calls `subgraph(g, i)` for each `i` in `indices`.
source
FeynmanDiagram.ComputationalGraphs.subgraphsMethod

function subgraphs(g::AbstractGraph)

Returns the subgraphs of computational graph `g`.
source
FeynmanDiagram.ComputationalGraphs.topologyMethod
function topology(g::FeynmanGraph)

Returns the topology (::Vector{Vector{Int}}) of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.unary_istrivialMethod
function unary_istrivial(g::AbstractGraph)
+(1, 4, 5, 7, ...) ↦ (1, 2, 3, 4, ....)

Arguments:

  • g::FeynmanGraph: graph to be relabeled
source
FeynmanDiagram.ComputationalGraphs.subgraphFunction

function subgraph(g::AbstractGraph, i=1)

Returns a copy of the `i`th subgraph of computational graph `g`.
+Defaults to the first subgraph if an index `i` is not supplied.
source
FeynmanDiagram.ComputationalGraphs.subgraph_factorFunction

function subgraph_factor(g::AbstractGraph, i=1)

Returns a copy of the `i`th subgraph factor of computational graph `g`.
+Defaults to the first subgraph factor if an index `i` is not supplied.
source
FeynmanDiagram.ComputationalGraphs.subgraph_factorsMethod

function subgraph_factors(g::AbstractGraph, indices::AbstractVector{Int})

Returns the subgraph factors of computational graph `g` at indices `indices`.
+By default, calls `subgraph_factor(g, i)` for each `i` in `indices`.
source
FeynmanDiagram.ComputationalGraphs.subgraph_factorsMethod

function subgraph_factors(g::AbstractGraph)

Returns the subgraph factors of computational graph `g`.
source
FeynmanDiagram.ComputationalGraphs.subgraphsMethod

function subgraphs(g::AbstractGraph, indices::AbstractVector{Int})

Returns the subgraphs of computational graph `g` at indices `indices`.
+By default, calls `subgraph(g, i)` for each `i` in `indices`.
source
FeynmanDiagram.ComputationalGraphs.subgraphsMethod

function subgraphs(g::AbstractGraph)

Returns the subgraphs of computational graph `g`.
source
FeynmanDiagram.ComputationalGraphs.topologyMethod
function topology(g::FeynmanGraph)

Returns the topology (::Vector{Vector{Int}}) of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.unary_istrivialMethod
function unary_istrivial(g::AbstractGraph)
 
 Returns true if the unary form of the graph operation of node `g` is trivial.
-Otherwise, returns false.
source
FeynmanDiagram.ComputationalGraphs.unique_nodes!Function
function unique_nodes!(graphs::AbstractVector{<:AbstractGraph})
+Otherwise, returns false.
source
FeynmanDiagram.ComputationalGraphs.unique_nodes!Function
function unique_nodes!(graphs::AbstractVector{<:AbstractGraph})
 
-Identifies and retrieves unique nodes from a set of graphs.

Arguments:

  • graphs: A collection of graphs to be processed.

Returns:

  • A mapping dictionary from the id of each leaf to the unique leaf node.
source
FeynmanDiagram.ComputationalGraphs.vertexFunction
function vertex(g::FeynmanGraph, i=1)

Returns the ith vertex (::OperatorProduct) of FeynmanGraph g. Defaults to the first vertex if an index i is not supplied.

source
FeynmanDiagram.ComputationalGraphs.verticesMethod
function vertices(g::FeynmanGraph)

Returns all vertices (::Vector{OperatorProduct}) of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.weightMethod
function weight(g::AbstractGraph)
+Identifies and retrieves unique nodes from a set of graphs.

Arguments:

  • graphs: A collection of graphs to be processed.

Returns:

  • A mapping dictionary from the id of each leaf to the unique leaf node.
source
FeynmanDiagram.ComputationalGraphs.vertexFunction
function vertex(g::FeynmanGraph, i=1)

Returns the ith vertex (::OperatorProduct) of FeynmanGraph g. Defaults to the first vertex if an index i is not supplied.

source
FeynmanDiagram.ComputationalGraphs.verticesMethod
function vertices(g::FeynmanGraph)

Returns all vertices (::Vector{OperatorProduct}) of FeynmanGraph g.

source
FeynmanDiagram.ComputationalGraphs.weightMethod
function weight(g::AbstractGraph)
 
-Returns the weight of the computational graph `g`.
source
+Returns the weight of the computational graph `g`.source diff --git a/previews/PR186/lib/frontend/index.html b/previews/PR186/lib/frontend/index.html index 10c89ef7..8f348ad5 100644 --- a/previews/PR186/lib/frontend/index.html +++ b/previews/PR186/lib/frontend/index.html @@ -1,22 +1,22 @@ -Front-end generates Feynman diagrams and translates then into a computational graph · FeynmanDiagram.jl

Front-end generates Feynman diagrams and translates then into a computational graph

API

FeynmanDiagram.FrontEnds.DiagramIdType
abstract type DiagramId end
+Front-end generates Feynman diagrams and translates then into a computational graph · FeynmanDiagram.jl

Front-end generates Feynman diagrams and translates then into a computational graph

API

FeynmanDiagram.FrontEnds.LabelProductType

The cartesian QuantumOperator.label product:

#Parameters:

  • 'LT': Type of labels
  • 'N' : Number of labels' type

#Members:

  • 'labels' : The list of labels in the LabelProduct
  • 'dims' : A tuple of the length of the label factors
source
FeynmanDiagram.FrontEnds.LabelProductType

The cartesian QuantumOperator.label product:

#Parameters:

  • 'LT': Type of labels
  • 'N' : Number of labels' type

#Members:

  • 'labels' : The list of labels in the LabelProduct
  • 'dims' : A tuple of the length of the label factors
source
FeynmanDiagram.FrontEnds.LoopPoolType
struct LoopPool{T}
 
 Pool of loop basis. Each loop basis corresponds to a loop variable.
 A loop variable is a linear combination of N independent loops. The combination coefficients is what we call a loop basis.
 For example, if a loop is a momentum K, then
 
-varibale_i = K_1*basis[1, i] + K_2*basis[2, i] + K_3*basis[3, i] + ...

Members

  • name::Symbol : name of the pool
  • dim::Int : dimension of a loop variable (for example, the dimension of a momentum-frequency loop variable is (d+1) where d is the spatial dimension)
  • basis::Matrix{T} : Matrix of (N x Nb) that stores the loop basis, where Nb is the number of loop basis (or number of loop variables).
  • loops::Matrix{T} : Matrix of (dim x Nb) that stores the loop variables, where Nb is the number of loop basis (or number of loop variables).
source
FeynmanDiagram.FrontEnds.PropagatorIdType
abstract type PropagatorId <: DiagramId end
+varibale_i = K_1*basis[1, i] + K_2*basis[2, i] + K_3*basis[3, i] + ...

Members

  • name::Symbol : name of the pool
  • dim::Int : dimension of a loop variable (for example, the dimension of a momentum-frequency loop variable is (d+1) where d is the spatial dimension)
  • basis::Matrix{T} : Matrix of (N x Nb) that stores the loop basis, where Nb is the number of loop basis (or number of loop variables).
  • loops::Matrix{T} : Matrix of (dim x Nb) that stores the loop variables, where Nb is the number of loop basis (or number of loop variables).
source
Base.lengthMethod
function Base.length(obj::LabelProduct)

Return the number of grids of the LabelProduct.

source
Base.showMethod
function Base.show(io::IO, obj::LabelProduct)

Print the LabelProduct.

source
Base.sizeMethod
function Base.size(obj::LabelProduct, I::Int)

Return the length of the specifict Ith label factor of the LabelProduct.

source
Base.sizeMethod
function Base.size(obj::LabelProduct, I::Int)

Return the length of the specifict Ith label factor of the LabelProduct.

source
Base.lengthMethod
function Base.length(obj::LabelProduct)

Return the number of grids of the LabelProduct.

source
Base.showMethod
function Base.show(io::IO, obj::LabelProduct)

Print the LabelProduct.

source
Base.sizeMethod
function Base.size(obj::LabelProduct, I::Int)

Return the length of the specifict Ith label factor of the LabelProduct.

source
Base.sizeMethod
function Base.size(obj::LabelProduct, I::Int)

Return the length of the specifict Ith label factor of the LabelProduct.

source
FeynmanDiagram.FrontEnds.index_to_linearMethod
@generated function index_to_linear(obj::LabelProduct{LT,N}, I...) where {LT,N}
 
-Convert a tuple of the indexes of each label to a single linear index of the LabelProduct.

Argument:

  • 'obj': The LabelProduct object
  • 'index...': N indexes of the label factor, where N is the number of label factor
source
FeynmanDiagram.FrontEnds.leafstatesMethod
function leafstates(leaf_maps::Vector{Dict{Int,G}}, maxloopNum::Int)
+Convert a tuple of the indexes of each label to a single linear index of the LabelProduct.

Argument:

  • 'obj': The LabelProduct object
  • 'index...': N indexes of the label factor, where N is the number of label factor
source
FeynmanDiagram.FrontEnds.leafstatesMethod
function leafstates(leaf_maps::Vector{Dict{Int,G}}, maxloopNum::Int)
 
 Extracts leaf information from the leaf mapping from the leaf value's index to the leaf node for all graph partitions. 
 The information includes their initial value, type, orders, in/out time, and loop momentum index.
-The loop basis is also obtained for all the graphs.

Arguments:

  • leaf_maps: A vector of the dictionary mapping the leaf value's index to the Graph of this leaf. Each dict corresponds to a graph partition, such as (order, Gorder, Vorder).
  • maxloopNum: The maximum loop-momentum number.

Returns

  • A tuple of vectors containing information about the leaves of graphs, including their initial values, types, orders, input and output time indexes, and loop-momenta indexes.
  • Loop-momentum basis (::Vector{Vector{Float64}}) for all the graphs.
source
FeynmanDiagram.FrontEnds.leafstatesMethod
function leafstates(leaf_maps::Vector{Dict{Int,G}}, labelProd::LabelProduct) where {G<:Union{Graph,FeynmanGraph}}
+The loop basis is also obtained for all the graphs.

Arguments:

  • leaf_maps: A vector of the dictionary mapping the leaf value's index to the Graph of this leaf. Each dict corresponds to a graph partition, such as (order, Gorder, Vorder).
  • maxloopNum: The maximum loop-momentum number.

Returns

  • A tuple of vectors containing information about the leaves of graphs, including their initial values, types, orders, input and output time indexes, and loop-momenta indexes.
  • Loop-momentum basis (::Vector{Vector{Float64}}) for all the graphs.
source
FeynmanDiagram.FrontEnds.leafstatesMethod
function leafstates(leaf_maps::Vector{Dict{Int,G}}, labelProd::LabelProduct) where {G<:Union{Graph,FeynmanGraph}}
 
 Extracts leaf information from the leaf mapping from the leaf value's index to the leaf node for all graph partitions
 and their associated LabelProduct data (`labelProd`). 
-The information includes their initial value, type, orders, in/out time, and loop momenta.

Arguments:

  • leaf_maps: A vector of the dictionary mapping the leaf value's index to the FeynmanGraph/Graph of this leaf. Each dict corresponds to a graph partition, such as (order, Gorder, Vorder).
  • labelProd: A LabelProduct used to label the leaves of graphs.

Returns

  • A tuple of vectors containing information about the leaves of graphs, including their initial values, types, orders, input and output time indexes, and loop-momenta indexes.
source
FeynmanDiagram.FrontEnds.linear_to_indexMethod
function linear_to_index(obj::LabelProduct, I::Int)

Convert the single linear index of the LabelProduct to a tuple of indexes of each label.

Argument:

  • 'obj': The LabelProduct object
  • 'I': The linear index of the LabelProduct
source
FeynmanDiagram.FrontEnds.reconstructMethod
reconstruct(instance::DiagramId, updates::Pair{Symbol}...)

Create a new instance of the same type as instance, with specified fields updated to new values.

Usage

newinstance = reconstruct(oldinstance, :field1 => newvalue1, :field2 => newvalue2)

source
+The information includes their initial value, type, orders, in/out time, and loop momenta.

Arguments:

  • leaf_maps: A vector of the dictionary mapping the leaf value's index to the FeynmanGraph/Graph of this leaf. Each dict corresponds to a graph partition, such as (order, Gorder, Vorder).
  • labelProd: A LabelProduct used to label the leaves of graphs.

Returns

  • A tuple of vectors containing information about the leaves of graphs, including their initial values, types, orders, input and output time indexes, and loop-momenta indexes.
source
FeynmanDiagram.FrontEnds.linear_to_indexMethod
function linear_to_index(obj::LabelProduct, I::Int)

Convert the single linear index of the LabelProduct to a tuple of indexes of each label.

Argument:

  • 'obj': The LabelProduct object
  • 'I': The linear index of the LabelProduct
source
FeynmanDiagram.FrontEnds.reconstructMethod
reconstruct(instance::DiagramId, updates::Pair{Symbol}...)

Create a new instance of the same type as instance, with specified fields updated to new values.

Usage

newinstance = reconstruct(oldinstance, :field1 => newvalue1, :field2 => newvalue2)

source
diff --git a/previews/PR186/lib/operator/index.html b/previews/PR186/lib/operator/index.html index 535d570d..247fed8d 100644 --- a/previews/PR186/lib/operator/index.html +++ b/previews/PR186/lib/operator/index.html @@ -2,18 +2,18 @@ Quantum operator and its product · FeynmanDiagram.jl

Quantum operator and its product

API

FeynmanDiagram.QuantumOperators.OperatorProductType
struct OperatorProduct <: AbstractVector{QuantumOperator}
 
 struct of a quantum-operator product. It is a subtype of `AbstractVector` and
-inherits a large set of Vector behaviors including iteration and indexing.

Members:

  • operators::Vector{QuantumOperator} vector of quantum operators
source
FeynmanDiagram.QuantumOperators.QuantumOperatorType
struct QuantumOperator

struct of a quantum operator.

Members:

  • operator::Datatype: type of quantum operator, supports :f⁺, :f⁻, :f, :b⁺, :b⁻, :ϕ
  • label::Int: label of the operator indices. It could represent spacetime, spin, momentum, flavor, etc.
  • is_ghost::Bool: whether the operator is a ghost operator or not.
source
Base.:*Method
Base.:*(o1::Union{QuantumOperator, OperatorProduct}, o2::Union{QuantumOperator, OperatorProduct})
+inherits a large set of Vector behaviors including iteration and indexing.

Members:

  • operators::Vector{QuantumOperator} vector of quantum operators
source
FeynmanDiagram.QuantumOperators.QuantumOperatorType
struct QuantumOperator

struct of a quantum operator.

Members:

  • operator::Datatype: type of quantum operator, supports :f⁺, :f⁻, :f, :b⁺, :b⁻, :ϕ
  • label::Int: label of the operator indices. It could represent spacetime, spin, momentum, flavor, etc.
  • is_ghost::Bool: whether the operator is a ghost operator or not.
source
Base.:*Method
Base.:*(o1::Union{QuantumOperator, OperatorProduct}, o2::Union{QuantumOperator, OperatorProduct})
 
-`o1 * o2` returns the quantum operator product of `o1` and `o2`
source
Base.adjointMethod
Base.adjoint(o::OperatorProduct)
+`o1 * o2` returns the quantum operator product of `o1` and `o2`
source
Base.adjointMethod
Base.adjoint(o::OperatorProduct)
 
-Return the conjuated composite operator of `o`.
source
Base.adjointMethod
Base.adjoint(operator::QuantumOperator)

Return the conjuated quantum operator of operator.

source
Base.adjointMethod
Base.adjoint(operator::QuantumOperator)

Return the conjuated quantum operator of operator.

source
FeynmanDiagram.QuantumOperators.correlator_orderMethod
function correlator_order(operator::OperatorProduct)
 function correlator_order(operator::OperatorProduct)
 
 Convert a OperatorProduct to correlator-ordered form. 
-Returns the associated statistical sign and permutation.
source
FeynmanDiagram.QuantumOperators.fermionic_annihilationMethod
Create a OperatorProduct with one quantum operator from given label `i`.
-It supports the following abbreviated function form:

''' const 𝑓⁻ = fermionicannihilation const 𝑓⁺ = fermioniccreation const 𝑓 = majorana const 𝑏⁻ = bosonicannihilation const 𝑏⁺ = bosoniccreation const 𝜙 = real_classic '''

source
FeynmanDiagram.QuantumOperators.fermionic_annihilationMethod
Create a OperatorProduct with one quantum operator from given label `i`.
+It supports the following abbreviated function form:

''' const 𝑓⁻ = fermionicannihilation const 𝑓⁺ = fermioniccreation const 𝑓 = majorana const 𝑏⁻ = bosonicannihilation const 𝑏⁺ = bosoniccreation const 𝜙 = real_classic '''

source
FeynmanDiagram.QuantumOperators.normal_orderMethod
function normal_order(operator::OperatorProduct)
 
 Computes the permutation required to convert a OperatorProduct to normal-ordered form. 
-Returns the associated statistical sign and permutation.
source
+Returns the associated statistical sign and permutation.source
FeynmanDiagram.QuantumOperators.parityMethod

The parity of a permutation P is +1 if the number of 2-cycles (swaps) in an n-cycle decomposition with n ≤ 2 is even, and -1 if the number of 2-cycles is odd.

source
FeynmanDiagram.QuantumOperators.parity_oldMethod

calculate the parity of a given permutation of the array [1, 2, 3, ...]

source
diff --git a/previews/PR186/lib/parquet/index.html b/previews/PR186/lib/parquet/index.html index 1ad72efe..3e2dd4be 100644 --- a/previews/PR186/lib/parquet/index.html +++ b/previews/PR186/lib/parquet/index.html @@ -1,37 +1,37 @@ Parquet Algorithm to Build Diagrams · FeynmanDiagram.jl

Parquet Algorithm to Build Diagrams

API

FeynmanDiagram.FrontEnds.Parquet.ParquetBlocksType
struct ParquetBlocks
 
-The channels of the left and right sub-vertex4 of a bubble diagram in the parquet equation

Members

  • phi : channels of left sub-vertex for the particle-hole and particle-hole-exchange bubbles
  • ppi : channels of left sub-vertex for the particle-particle bubble
  • Γ4 : channels of right sub-vertex of all channels
source
FeynmanDiagram.FrontEnds.Parquet.ep_couplingMethod
function ep_coupling(para::DiagPara;
+The channels of the left and right sub-vertex4 of a bubble diagram in the parquet equation

Members

  • phi : channels of left sub-vertex for the particle-hole and particle-hole-exchange bubbles
  • ppi : channels of left sub-vertex for the particle-particle bubble
  • Γ4 : channels of right sub-vertex of all channels
source
FeynmanDiagram.FrontEnds.Parquet.ep_couplingMethod
function ep_coupling(para::DiagPara;
     extK=[getK(para.totalLoopNum, 1), getK(para.totalLoopNum, 2), getK(para.totalLoopNum, 3)],
     channels::AbstractVector=[PHr, PHEr, PPr, Alli],
     subdiagram=false,
     name=:none, resetuid=false,
     blocks::ParquetBlocks=ParquetBlocks()
-)

Generate electron-phonon 4-vertex diagrams using Parquet Algorithm. The right incoming Tau will be set to the last Tau for all diagrams | | Γ3 –––-| | |

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loops as a vector [left in, left out, right in, right out].
  • channels : vector of channels in the left Γ3 diagrams.
  • subdiagram : a sub-vertex or not
  • name : name of the vertex
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :response, :extT, :diagram, :hash.

Output

  • A DataFrame with fields :response, :type, :extT, :diagram, :hash
source
FeynmanDiagram.FrontEnds.Parquet.get_ver4IMethod
get_ver4I()
+)

Generate electron-phonon 4-vertex diagrams using Parquet Algorithm. The right incoming Tau will be set to the last Tau for all diagrams | | Γ3 –––-| | |

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loops as a vector [left in, left out, right in, right out].
  • channels : vector of channels in the left Γ3 diagrams.
  • subdiagram : a sub-vertex or not
  • name : name of the vertex
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :response, :extT, :diagram, :hash.

Output

  • A DataFrame with fields :response, :type, :extT, :diagram, :hash
source
FeynmanDiagram.FrontEnds.Parquet.get_ver4IMethod
get_ver4I()
 
 Retrieves the global dictionary `vertex4I_diags` that contains graph initialized by `initialize_vertex4I_diags`. 
-This function is a getter that provides access to the stored graph data of the 3- and 4-point fully-irreducible (Alli) vertex functions.
source
FeynmanDiagram.FrontEnds.Parquet.greenFunction
green(para::DiagPara, extK = getK(para.totalLoopNum, 1), extT = para.hasTau ? (1, 2) : (0, 0), subdiagram = false;
-    name = :G, resetuid = false, blocks::ParquetBlocks=ParquetBlocks())

Build composite Green's function. By definition, para.firstTauIdx is the first Tau index of the left most self-energy subdiagram.

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loop.
  • extT: [Tau index of the left leg, Tau index of the right leg]
  • subdiagram : a sub-vertex or not
  • name : name of the diagram
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A Graph object or nothing if the Green's function is illegal.
source
FeynmanDiagram.FrontEnds.Parquet.greenFunction
green(para::DiagPara, extK = getK(para.totalLoopNum, 1), extT = para.hasTau ? (1, 2) : (0, 0), subdiagram = false;
+    name = :G, resetuid = false, blocks::ParquetBlocks=ParquetBlocks())

Build composite Green's function. By definition, para.firstTauIdx is the first Tau index of the left most self-energy subdiagram.

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loop.
  • extT: [Tau index of the left leg, Tau index of the right leg]
  • subdiagram : a sub-vertex or not
  • name : name of the diagram
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A Graph object or nothing if the Green's function is illegal.
source
FeynmanDiagram.FrontEnds.Parquet.initialize_vertex4I_diagsMethod
initialize_vertex4I_diags(; filter=[NoHartree], spinPolarPara::Float64=0.0)
 
-Initialize the vertex4I_diags dictionary with the diagrams of the 3- and 4-point fully-irreducible (Alli) vertex functions.

Parameters

  • filter (optional) : a list of filter conditions to select the diagrams. Default is [NoHartree].
  • spinPolarPara (optional) : the spin-polarization parameter. Default is 0.0.
source
FeynmanDiagram.FrontEnds.Parquet.innerTauNumMethod
function innerTauNum(type::DiagramType, innerLoopNum, interactionTauNum)
+Initialize the vertex4I_diags dictionary with the diagrams of the 3- and 4-point fully-irreducible (Alli) vertex functions.

Parameters

  • filter (optional) : a list of filter conditions to select the diagrams. Default is [NoHartree].
  • spinPolarPara (optional) : the spin-polarization parameter. Default is 0.0.
source
FeynmanDiagram.FrontEnds.Parquet.innerTauNumMethod
function innerTauNum(type::DiagramType, innerLoopNum, interactionTauNum)
 
 internal imaginary-time degrees of freedom for a given diagram type and internal loop number.
 For the vertex functions (self-energy, polarization, vertex3, and vertex4), innerTauNum is equivalent to tauNum.
-For the Green function, tauNum = innerTauNum + external tauNum
source
FeynmanDiagram.FrontEnds.Parquet.mergebyFunction
function mergeby(df::DataFrame, fields=Vector{Symbol}();
     operator=Sum(), name::Symbol=:none,
     getid::Function=g -> GenericId(g[1, :diagram].properties.para, Tuple(g[1, fields]))
-)

Aggregates and merges rows in a DataFrame based on specified fields and an aggregation operator. It is designed to work with data frames containing diagram representations or similar structured data, allowing for flexible aggregation based on custom identifiers and properties.

Parameters

  • df: A DataFrame to be processed. It must contain a column named :diagram which holds Graph.
  • fields: A vector of Symbols specifying the columns based on which the aggregation groups are formed.
  • operator: The aggregation operator to be applied. This operator is used to aggregate data across rows within each group formed by the specified fields. The default is Sum().
  • name: An optional Symbol representing the name of a new column to store the aggregated results. The default is :none.
  • getid: A function that generates a unique identifier for each group based on the specified fields and the properties of the :diagram column. The default function is g -> GenericId(g[1, :diagram].properties.para, Tuple(g[1, fields])).
source
FeynmanDiagram.FrontEnds.Parquet.polarizationFunction
function polarization(para::DiagPara, extK=getK(para.totalLoopNum, 1), subdiagram=false; name=:Π, resetuid=false, blocks::ParquetBlocks=ParquetBlocks())

Generate polarization diagrams using Parquet Algorithm.

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loop.
  • subdiagram : a sub-vertex or not
  • name : name of the vertex
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :response, :diagram, :hash.
  • All polarization share the same external Tau index. With imaginary-time variables, they are extT = (para.firstTauIdx, para.firstTauIdx+1)
source
FeynmanDiagram.FrontEnds.Parquet.sigmaFunction
function sigma(para::DiagPara, extK=getK(para.totalLoopNum, 1), subdiagram=false;
-    name=:Σ, resetuid=false, blocks::ParquetBlocks=ParquetBlocks())

Build sigma diagram. When sigma is created as a subdiagram, then no Fock diagram is generated if para.filter contains NoFock, and no sigma diagram is generated if para.filter contains Girreducible

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loop.
  • subdiagram : a sub-vertex or not
  • name : name of the diagram
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :type, :extT, :diagram, :hash
  • All sigma share the same incoming Tau index, but not the outgoing one
source
FeynmanDiagram.FrontEnds.Parquet.update_extKTFunction
update_extKT(diags::Vector{Graph}, para::DiagPara, legK::Vector{Vector{Float64}}) -> Vector{Graph}

Returns a new vector of graphs with updated external momenta (extK) and external times (extT), based on the provided graphs, parameters, and external legs' momenta.

Arguments

  • diags::Vector{Graph}: A vector of Graph objects.
  • para::DiagPara: parameters reconstructed in the graphs. Its firstTauIdx will update the extT of graphs.
  • legK::Vector{Vector{Float64}}: basis of the external momenta for the legs of the diagram as [left in, left out, right in, right out].
  • extraLoopIdx: the index of the extra loop in the external momenta basis in legK. Defaults to nothing, which means no extra loop is included.

Returns

  • Vector{Graph}: A new vector of Graph objects with updated extK, extT, and para (if existing) properties for each node.
source
FeynmanDiagram.FrontEnds.Parquet.update_extKT!Function
update_extKT!(diags::Vector{Graph}, para::DiagPara, legK::Vector{Vector{Float64}})

Update the external momenta (extK) and external times (extT) of all the nodes in a vector of graphs in-place.

Arguments

  • diags::Vector{Graph}: A vector of Graph objects.
  • para::DiagPara: parameters reconstructed in the graphs. Its firstTauIdx will update the extT of graphs.
  • legK::Vector{Vector{Float64}}: basis of the external momenta for the legs of the diagram as [left in, left out, right in, right out].
  • extraLoopIdx: the index of the extra loop in the external momenta basis in legK. Defaults to nothing, which means no extra loop is included.
source
FeynmanDiagram.FrontEnds.Parquet.vertex3Function
function vertex3(para::DiagPara, _extK=[getK(para.totalLoopNum, 1), getK(para.totalLoopNum, 2)], subdiagram=false;
-    name=:Γ3, channels=[PHr, PHEr, PPr, Alli], resetuid=false, blocks::ParquetBlocks=ParquetBlocks())

Generate 3-vertex diagrams using Parquet Algorithm. With imaginary-time variables, all vertex3 generated has the same bosonic Tidx $extT[1]=para.firstTauIdx$ and the incoming fermionic Tidx $extT[2]=para.firstTauIdx+1$.

#Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loops as a vector [bosonic leg (out), fermionic in, fermionic out], extK[1] = extK[2] - extK[3].
  • subdiagram : a sub-vertex or not
  • name : name of the vertex
  • channels : vector of channels of the current 4-vertex.
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :response, :extT, :diagram, :hash.
source
FeynmanDiagram.FrontEnds.Parquet.vertex4Function
vertex4(para::DiagPara,
+)

Aggregates and merges rows in a DataFrame based on specified fields and an aggregation operator. It is designed to work with data frames containing diagram representations or similar structured data, allowing for flexible aggregation based on custom identifiers and properties.

Parameters

  • df: A DataFrame to be processed. It must contain a column named :diagram which holds Graph.
  • fields: A vector of Symbols specifying the columns based on which the aggregation groups are formed.
  • operator: The aggregation operator to be applied. This operator is used to aggregate data across rows within each group formed by the specified fields. The default is Sum().
  • name: An optional Symbol representing the name of a new column to store the aggregated results. The default is :none.
  • getid: A function that generates a unique identifier for each group based on the specified fields and the properties of the :diagram column. The default function is g -> GenericId(g[1, :diagram].properties.para, Tuple(g[1, fields])).
source
FeynmanDiagram.FrontEnds.Parquet.polarizationFunction
function polarization(para::DiagPara, extK=getK(para.totalLoopNum, 1), subdiagram=false; name=:Π, resetuid=false, blocks::ParquetBlocks=ParquetBlocks())

Generate polarization diagrams using Parquet Algorithm.

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loop.
  • subdiagram : a sub-vertex or not
  • name : name of the vertex
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :response, :diagram, :hash.
  • All polarization share the same external Tau index. With imaginary-time variables, they are extT = (para.firstTauIdx, para.firstTauIdx+1)
source
FeynmanDiagram.FrontEnds.Parquet.sigmaFunction
function sigma(para::DiagPara, extK=getK(para.totalLoopNum, 1), subdiagram=false;
+    name=:Σ, resetuid=false, blocks::ParquetBlocks=ParquetBlocks())

Build sigma diagram. When sigma is created as a subdiagram, then no Fock diagram is generated if para.filter contains NoFock, and no sigma diagram is generated if para.filter contains Girreducible

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loop.
  • subdiagram : a sub-vertex or not
  • name : name of the diagram
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :type, :extT, :diagram, :hash
  • All sigma share the same incoming Tau index, but not the outgoing one
source
FeynmanDiagram.FrontEnds.Parquet.update_extKTFunction
update_extKT(diags::Vector{Graph}, para::DiagPara, legK::Vector{Vector{Float64}}) -> Vector{Graph}

Returns a new vector of graphs with updated external momenta (extK) and external times (extT), based on the provided graphs, parameters, and external legs' momenta.

Arguments

  • diags::Vector{Graph}: A vector of Graph objects.
  • para::DiagPara: parameters reconstructed in the graphs. Its firstTauIdx will update the extT of graphs.
  • legK::Vector{Vector{Float64}}: basis of the external momenta for the legs of the diagram as [left in, left out, right in, right out].
  • extraLoopIdx: the index of the extra loop in the external momenta basis in legK. Defaults to nothing, which means no extra loop is included.

Returns

  • Vector{Graph}: A new vector of Graph objects with updated extK, extT, and para (if existing) properties for each node.
source
FeynmanDiagram.FrontEnds.Parquet.update_extKT!Function
update_extKT!(diags::Vector{Graph}, para::DiagPara, legK::Vector{Vector{Float64}})

Update the external momenta (extK) and external times (extT) of all the nodes in a vector of graphs in-place.

Arguments

  • diags::Vector{Graph}: A vector of Graph objects.
  • para::DiagPara: parameters reconstructed in the graphs. Its firstTauIdx will update the extT of graphs.
  • legK::Vector{Vector{Float64}}: basis of the external momenta for the legs of the diagram as [left in, left out, right in, right out].
  • extraLoopIdx: the index of the extra loop in the external momenta basis in legK. Defaults to nothing, which means no extra loop is included.
source
FeynmanDiagram.FrontEnds.Parquet.vertex3Function
function vertex3(para::DiagPara, _extK=[getK(para.totalLoopNum, 1), getK(para.totalLoopNum, 2)], subdiagram=false;
+    name=:Γ3, channels=[PHr, PHEr, PPr, Alli], resetuid=false, blocks::ParquetBlocks=ParquetBlocks())

Generate 3-vertex diagrams using Parquet Algorithm. With imaginary-time variables, all vertex3 generated has the same bosonic Tidx $extT[1]=para.firstTauIdx$ and the incoming fermionic Tidx $extT[2]=para.firstTauIdx+1$.

#Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loops as a vector [bosonic leg (out), fermionic in, fermionic out], extK[1] = extK[2] - extK[3].
  • subdiagram : a sub-vertex or not
  • name : name of the vertex
  • channels : vector of channels of the current 4-vertex.
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :response, :extT, :diagram, :hash.
source
FeynmanDiagram.FrontEnds.Parquet.vertex4Function
vertex4(para::DiagPara,
     extK = [getK(para.totalLoopNum, 1), getK(para.totalLoopNum, 2), getK(para.totalLoopNum, 3)],
     subdiagram = false;
     channels::AbstractVector = [PHr, PHEr, PPr, Alli],
     level = 1, name = :none, resetuid = false,
     blocks::ParquetBlocks=ParquetBlocks(),
     blockstoplevel::ParquetBlocks=blocks
-    )

Generate 4-vertex diagrams using Parquet Algorithm

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loops as a vector [left in, left out, right in, right out].
  • subdiagram : a sub-vertex or not
  • channels : vector of channels of the current 4-vertex.
  • name : name of the vertex
  • level : level in the diagram tree
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.
  • blockstoplevel : building blocks of the Parquet equation at the toplevel. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :response, :type, :extT, :diagram, :hash
source
Parameters.reconstructMethod
Parameters.reconstruct(p::DiagPara; kws...)
+    )

Generate 4-vertex diagrams using Parquet Algorithm

Arguments

  • para : parameters. It should provide internalLoopNum, interactionTauNum, firstTauIdx
  • extK : basis of external loops as a vector [left in, left out, right in, right out].
  • subdiagram : a sub-vertex or not
  • channels : vector of channels of the current 4-vertex.
  • name : name of the vertex
  • level : level in the diagram tree
  • resetuid : restart uid count from 1
  • blocks : building blocks of the Parquet equation. See the struct ParquetBlocks for more details.
  • blockstoplevel : building blocks of the Parquet equation at the toplevel. See the struct ParquetBlocks for more details.

Output

  • A DataFrame with fields :response, :type, :extT, :diagram, :hash
source

Usage

julia> using FeynmanDiagram
julia> para = DiagPara(type = Ver4Diag, innerLoopNum = 1, hasTau = true);ERROR: UndefVarError: `Ver4Diag` not defined in `Main` +Type-stable version of the Parameters.reconstruct
source

Usage

julia> using FeynmanDiagram
julia> para = DiagPara(type = Ver4Diag, innerLoopNum = 1, hasTau = true);ERROR: UndefVarError: `Ver4Diag` not defined in `Main` Suggestion: check for spelling errors or missing imports.
julia> Parquet.vertex4(para)ERROR: UndefVarError: `para` not defined in `Main` Suggestion: check for spelling errors or missing imports.
julia> para = DiagPara(type = Ver3Diag, innerLoopNum = 1, hasTau = true);ERROR: UndefVarError: `Ver3Diag` not defined in `Main` Suggestion: check for spelling errors or missing imports.
julia> Parquet.vertex3(para)ERROR: UndefVarError: `para` not defined in `Main` @@ -39,4 +39,4 @@ Suggestion: check for spelling errors or missing imports.
julia> Parquet.sigma(para)ERROR: UndefVarError: `para` not defined in `Main` Suggestion: check for spelling errors or missing imports.
julia> para = DiagPara(type = PolarDiag, innerLoopNum = 1, hasTau = true);ERROR: UndefVarError: `PolarDiag` not defined in `Main` Suggestion: check for spelling errors or missing imports.
julia> Parquet.polarization(para)ERROR: UndefVarError: `para` not defined in `Main` -Suggestion: check for spelling errors or missing imports.
+Suggestion: check for spelling errors or missing imports. diff --git a/previews/PR186/lib/taylorseries/index.html b/previews/PR186/lib/taylorseries/index.html index f1457da6..82c62bb8 100644 --- a/previews/PR186/lib/taylorseries/index.html +++ b/previews/PR186/lib/taylorseries/index.html @@ -1,46 +1,46 @@ -Taylor expansions in independent variables (support AbstractGraph) · FeynmanDiagram.jl

Taylor expansions in independent variables (support AbstractGraph)

API

FeynmanDiagram.Taylor.ParamsTaylorType
ParamsTaylor
+Taylor expansions in independent variables (support AbstractGraph) · FeynmanDiagram.jl

Taylor expansions in independent variables (support AbstractGraph)

API

FeynmanDiagram.Taylor.ParamsTaylorType
ParamsTaylor
 
 DataType holding the current parameters for `TaylorSeries`. 
-This part of code is adopted from TaylorSeries.jl (https://github.com/JuliaDiff/TaylorSeries.jl)

Fields:

  • orders :: Int Orders (degree) of the polynomials
  • num_vars :: Int Number of variables
  • variable_names :: Vector{String} Names of the variables
  • variable_symbols :: Vector{Symbol} Symbols of the variables

These parameters can be changed using set_variables

source
FeynmanDiagram.Taylor.TaylorSeriesType
mutable struct TaylorSeries{T}
+This part of code is adopted from TaylorSeries.jl (https://github.com/JuliaDiff/TaylorSeries.jl)

Fields:

  • orders :: Int Orders (degree) of the polynomials
  • num_vars :: Int Number of variables
  • variable_names :: Vector{String} Names of the variables
  • variable_symbols :: Vector{Symbol} Symbols of the variables

These parameters can be changed using set_variables

source
FeynmanDiagram.Taylor.TaylorSeriesType
mutable struct TaylorSeries{T}
 
-A representation of a taylor series.

Members:

  • name::Symbol name of the diagram
  • coeffs::Dict{Vector{Int},T} The taylor expansion coefficients. The integer array define the order of corresponding coefficient.
source
FeynmanDiagram.Taylor.TaylorSeriesMethod
function TaylorSeries(::Type{T}, nv::Int) where {T}
+A representation of a taylor series.

Members:

  • name::Symbol name of the diagram
  • coeffs::Dict{Vector{Int},T} The taylor expansion coefficients. The integer array define the order of corresponding coefficient.
source
FeynmanDiagram.Taylor.TaylorSeriesMethod
function TaylorSeries(::Type{T}, nv::Int) where {T}
 
-Create a taylor series equal to variable with index nv. For example, if global variables are "x y", in put nv=2 generate series t=y.

Arguments:

  • ::Type{T} DataType of coefficients in taylor series.
  • nv::Int Index of variable.
source
Base.:*Method
function Base.:*(g1::TaylorSeries{T}, g2::TaylorSeries{T}) where {T}
+Create a taylor series equal to variable with index nv. For example, if global variables are "x y", in put nv=2 generate series t=y.

Arguments:

  • ::Type{T} DataType of coefficients in taylor series.
  • nv::Int Index of variable.
source
Base.:*Method
function Base.:*(g1::TaylorSeries{T}, g2::TaylorSeries{T}) where {T}
 
-Returns a taylor series `g1 * g2` representing the product of `g2` with `g1`.

Arguments:

  • g1 First taylor series
  • g2 Second taylor series
source
Base.:*Method
function Base.:*(g1::TaylorSeries{T}, c2::Number) where {T}
+Returns a taylor series `g1 * g2` representing the product of `g2` with `g1`.

Arguments:

  • g1 First taylor series
  • g2 Second taylor series
source
Base.:*Method
function Base.:*(g1::TaylorSeries{T}, c2::Number) where {T}
 
-Returns a TaylorSeries representing the scalar multiplication `g1*c2`.

Arguments:

  • g1 TaylorSeries
  • c2 scalar multiple
source
Base.:*Method
function Base.:*(c1::Number, g2::TaylorSeries{T}) where {T}
+Returns a TaylorSeries representing the scalar multiplication `g1*c2`.

Arguments:

  • g1 TaylorSeries
  • c2 scalar multiple
source
Base.:*Method
function Base.:*(c1::Number, g2::TaylorSeries{T}) where {T}
 
-Returns a TaylorSeries representing the scalar multiplication `g2*c1`.

Arguments:

  • g2 TaylorSeries
  • c1 scalar multiple
source
Base.:+Method
function Base.:+(g1::TaylorSeries{T}, c::S) where {T,S<:Number}
+Returns a TaylorSeries representing the scalar multiplication `g2*c1`.

Arguments:

  • g2 TaylorSeries
  • c1 scalar multiple
source
Base.:+Method
function Base.:+(g1::TaylorSeries{T}, c::S) where {T,S<:Number}
 
-Returns a taylor series `g1 + c` representing the addition of constant `c` with `g1`.

Arguments:

  • g1 Taylor series
  • c Constant
source
Base.:+Method
function Base.:+(g1::TaylorSeries{T}, g2::TaylorSeries{T}) where {T}
+Returns a taylor series `g1 + c` representing the addition of constant `c` with `g1`.

Arguments:

  • g1 Taylor series
  • c Constant
source
Base.:+Method
function Base.:+(g1::TaylorSeries{T}, g2::TaylorSeries{T}) where {T}
 
-Returns a taylor series `g1 + g2` representing the addition of `g2` with `g1`.

Arguments:

  • g1 First taylor series
  • g2 Second taylor series
source
Base.:+Method
function Base.:+(c::S, g1::TaylorSeries{T}) where {S<:Number,T}
+Returns a taylor series `g1 + g2` representing the addition of `g2` with `g1`.

Arguments:

  • g1 First taylor series
  • g2 Second taylor series
source
Base.:+Method
function Base.:+(c::S, g1::TaylorSeries{T}) where {S<:Number,T}
 
-Returns a taylor series `g1 + c` representing the addition of constant `c` with `g1`.

Arguments:

  • g1 Taylor series
  • c Constant
source
Base.:-Method
function Base.:-(g1::TaylorSeries{T,V}, g2::TaylorSeries{T,V}) where {T,V}
+Returns a taylor series `g1 + c` representing the addition of constant `c` with `g1`.

Arguments:

  • g1 Taylor series
  • c Constant
source
Base.:-Method
function Base.:-(g1::TaylorSeries{T,V}, g2::TaylorSeries{T,V}) where {T,V}
 
-Returns a taylor series `g1 - g2` representing the difference of `g2` with `g1`.

Arguments:

  • g1 First taylor series
  • g2 Second taylor series
source
Base.:^Method
function Base.:^(x::TaylorSeries, p::Integer)
+Returns a taylor series `g1 - g2` representing the difference of `g2` with `g1`.

Arguments:

  • g1 First taylor series
  • g2 Second taylor series
source
Base.:^Method
function Base.:^(x::TaylorSeries, p::Integer)
 
-Return the power of taylor series x^p, where p is an integer.

Arguments:

  • x Taylor series
  • 'p' Power index
source
Base.oneMethod
function  Base.one(g::TaylorSeries{T}) where {T}
+Return the power of taylor series x^p, where p is an integer.

Arguments:

  • x Taylor series
  • 'p' Power index
source
Base.oneMethod
function  Base.one(g::TaylorSeries{T}) where {T}
 
-Return a constant one for a given taylor series.

Arguments:

  • g Taylor series
source
FeynmanDiagram.Taylor.displayBigOMethod
displayBigO(d::Bool) --> nothing

Set/unset displaying of the big 𝒪 notation in the output of Taylor1 and TaylorN polynomials. The initial value is true.

source
FeynmanDiagram.Taylor.displayBigOMethod
displayBigO(d::Bool) --> nothing

Set/unset displaying of the big 𝒪 notation in the output of Taylor1 and TaylorN polynomials. The initial value is true.

source
FeynmanDiagram.Taylor.getcoeffMethod
function getcoeff(g::TaylorSeries, order::Vector{Int})
 
-Return the taylor coefficients with given order in taylor series g.

Arguments:

  • g Taylor series
  • order Order of target coefficients
source
FeynmanDiagram.Taylor.getderivativeMethod
function getderivative(g::TaylorSeries, order::Vector{Int})
+Return the taylor coefficients with given order in taylor series g.

Arguments:

  • g Taylor series
  • order Order of target coefficients
source
FeynmanDiagram.Taylor.getderivativeMethod
function getderivative(g::TaylorSeries, order::Vector{Int})
 
-Return the derivative with given order in taylor series g.

Arguments:

  • g Taylor series
  • order Order of derivative
source
FeynmanDiagram.Taylor.set_variablesMethod
set_variables([T::Type], names::String; [orders=get_orders(), numvars=-1])

Return a TaylorSeries{T} vector with each entry representing an independent variable. names defines the output for each variable (separated by a space). The default type T is Float64, and the default for orders is the one defined globally.

If numvars is not specified, it is inferred from names. If only one variable name is defined and numvars>1, it uses this name with subscripts for the different variables.

julia> set_variables(Int, "x y z", orders=[4,4,4])
+Return the derivative with given order in taylor series g.

Arguments:

  • g Taylor series
  • order Order of derivative
source
FeynmanDiagram.Taylor.set_variablesMethod
set_variables([T::Type], names::String; [orders=get_orders(), numvars=-1])

Return a TaylorSeries{T} vector with each entry representing an independent variable. names defines the output for each variable (separated by a space). The default type T is Float64, and the default for orders is the one defined globally.

If numvars is not specified, it is inferred from names. If only one variable name is defined and numvars>1, it uses this name with subscripts for the different variables.

julia> set_variables(Int, "x y z", orders=[4,4,4])
 3-element Array{TaylorSeries.Taylor{Int},1}:
   1 x + 𝒪(x⁵y⁵z⁵)
   1 y + 𝒪(x⁵y⁵z⁵)
-  1 z + 𝒪(x⁵y⁵z⁵)
source
FeynmanDiagram.Taylor.taylor_binomialMethod
function taylor_binomial(o1::Vector{Int}, o2::Vector{Int})
 
 Return the taylor binomial prefactor when product two high-order derivatives with order o1 and o2.
 
 # Arguments:
 - `o1`  Order of first derivative
-- `o2`  Order of second derivative
source
FeynmanDiagram.Taylor.use_show_defaultMethod
use_Base_show(d::Bool) --> nothing

Use Base.show_default method (default show method in Base), or a custom display. The initial value is false, so customized display is used.

source
+- `o` Order of the taylor coefficient
source
FeynmanDiagram.Taylor.use_show_defaultMethod
use_Base_show(d::Bool) --> nothing

Use Base.show_default method (default show method in Base), or a custom display. The initial value is false, so customized display is used.

source
diff --git a/previews/PR186/lib/utility/index.html b/previews/PR186/lib/utility/index.html index dd8953b6..c0ea2fb8 100644 --- a/previews/PR186/lib/utility/index.html +++ b/previews/PR186/lib/utility/index.html @@ -15,18 +15,18 @@ leaf_dep_funcs = [pr -> pr isa FrontEnds.BareGreenId, pr -> pr isa FrontEnds.BareInteractionId, pr -> pr.extK[1] != 0] # Perform Taylor-mode AD and categorize the results. `result_dict` holds the AD results, organized by differentiation orders `[0:2, 0:3, 0:3]`. -result_dict = taylorAD(graphs, deriv_orders, leaf_dep_funcs)source
FeynmanDiagram.Utility.taylorexpansion!Method
function taylorexpansion!(graph::FeynmanGraph{F,W}, var_dependence::Dict{Int,Vector{Bool}}=Dict{Int,Vector{Bool}}(); to_coeff_map::Dict{Int,TaylorSeries{G}}=Dict{Int,TaylorSeries{G}}()) where {F,W}
+result_dict = taylorAD(graphs, deriv_orders, leaf_dep_funcs)
source
FeynmanDiagram.Utility.taylorexpansion!Method
function taylorexpansion!(graph::FeynmanGraph{F,W}, var_dependence::Dict{Int,Vector{Bool}}=Dict{Int,Vector{Bool}}(); to_coeff_map::Dict{Int,TaylorSeries{G}}=Dict{Int,TaylorSeries{G}}()) where {F,W}
 
-Return a taylor series of FeynmanGraph g, together with a map of between nodes of g and correponding taylor series.

Arguments:

  • graph Target FeynmanGraph
  • var_dependence::Dict{Int,Vector{Bool}} A dictionary that specifies the variable dependence of target graph leaves. Should map the id of each leaf to a Bool vector. The length of the vector should be the same as number of variables.
  • to_coeff_map::Dict{Int,TaylorSeries} A dicitonary that maps id of each node of target graph to its correponding taylor series.
source
FeynmanDiagram.Utility.taylorexpansion!Method
function taylorexpansion!(graph::G, var_dependence::Dict{Int,Vector{Bool}}=Dict{Int,Vector{Bool}}(); to_coeff_map::Dict{Int,TaylorSeries{G}}=Dict{Int,TaylorSeries{G}}()) where {G<:Graph}
+Return a taylor series of FeynmanGraph g, together with a map of between nodes of g and correponding taylor series.

Arguments:

  • graph Target FeynmanGraph
  • var_dependence::Dict{Int,Vector{Bool}} A dictionary that specifies the variable dependence of target graph leaves. Should map the id of each leaf to a Bool vector. The length of the vector should be the same as number of variables.
  • to_coeff_map::Dict{Int,TaylorSeries} A dicitonary that maps id of each node of target graph to its correponding taylor series.
source
FeynmanDiagram.Utility.taylorexpansion!Method
function taylorexpansion!(graph::G, var_dependence::Dict{Int,Vector{Bool}}=Dict{Int,Vector{Bool}}(); to_coeff_map::Dict{Int,TaylorSeries{G}}=Dict{Int,TaylorSeries{G}}()) where {G<:Graph}
 
-Return a taylor series of graph g, together with a map of between nodes of g and correponding taylor series.

Arguments:

  • graph Target graph
  • var_dependence::Dict{Int,Vector{Bool}} A dictionary that specifies the variable dependence of target graph leaves. Should map the id of each leaf to a Bool vector. The length of the vector should be the same as number of variables.
  • to_coeff_map::Dict{Int,TaylorSeries} A dicitonary that maps id of each node of target graph to its correponding taylor series.
source
FeynmanDiagram.Utility.taylorexpansion!Method
function taylorexpansion!(graph::FeynmanGraph{F,W}, propagator_var::Tuple{Vector{Bool},Vector{Bool}}, label::Tuple{LabelProduct,LabelProduct}; to_coeff_map::Dict{Int,TaylorSeries{Graph{F,W}}}=Dict{Int,TaylorSeries{Graph{F,W}}}()) where {F,W}
+Return a taylor series of graph g, together with a map of between nodes of g and correponding taylor series.

Arguments:

  • graph Target graph
  • var_dependence::Dict{Int,Vector{Bool}} A dictionary that specifies the variable dependence of target graph leaves. Should map the id of each leaf to a Bool vector. The length of the vector should be the same as number of variables.
  • to_coeff_map::Dict{Int,TaylorSeries} A dicitonary that maps id of each node of target graph to its correponding taylor series.
source
FeynmanDiagram.Utility.taylorexpansion!Method
function taylorexpansion!(graph::FeynmanGraph{F,W}, propagator_var::Tuple{Vector{Bool},Vector{Bool}}, label::Tuple{LabelProduct,LabelProduct}; to_coeff_map::Dict{Int,TaylorSeries{Graph{F,W}}}=Dict{Int,TaylorSeries{Graph{F,W}}}()) where {F,W}
 
 Return a taylor series of FeynmanGraph g, together with a map of between nodes of g and correponding taylor series. In this set up, the leaves that are the same type of propagators (fermi or bose) depend on the same set of variables, 
-whereas other types of Feynman diagrams (such as vertices) depends on no variables that need to be differentiated (for AD purpose, they are just constants).

Arguments:

  • graph Target FeynmanGraph
  • propagator_var::Tuple{Vector{Bool},Vector{Bool}} A Tuple that specifies the variable dependence of fermi (first element) and bose propagator (second element). The dependence is given by a vector of the length same as the number of variables.
  • label::Tuple{LabelProduct,LabelProduct} A Tuple fermi (first element) and bose LabelProduct (second element).
  • to_coeff_map::Dict{Int,TaylorSeries} A dicitonary that maps id of each node of target diagram to its correponding taylor series.
source
FeynmanDiagram.Utility.taylorexpansion!Method
function taylorexpansion!(graph::Graph{F,W}, propagator_var::Dict{DataType,Vector{Bool}};
+whereas other types of Feynman diagrams (such as vertices) depends on no variables that need to be differentiated (for AD purpose, they are just constants).

Arguments:

  • graph Target FeynmanGraph
  • propagator_var::Tuple{Vector{Bool},Vector{Bool}} A Tuple that specifies the variable dependence of fermi (first element) and bose propagator (second element). The dependence is given by a vector of the length same as the number of variables.
  • label::Tuple{LabelProduct,LabelProduct} A Tuple fermi (first element) and bose LabelProduct (second element).
  • to_coeff_map::Dict{Int,TaylorSeries} A dicitonary that maps id of each node of target diagram to its correponding taylor series.
source
FeynmanDiagram.Utility.taylorexpansion!Method
function taylorexpansion!(graph::Graph{F,W}, propagator_var::Dict{DataType,Vector{Bool}};
     to_coeff_map::Dict{Int,TaylorSeries{Graph{F,W}}}=Dict{Int,TaylorSeries{Graph{F,W}}}()) where {F,W}
     
-Return a taylor series of Graph g, together with a map of between nodes of g and correponding taylor series. In this set up, the leaves that are the same type of diagrams (such as Green functions) depend on the same set of variables.

Arguments:

  • graph Target Graph
  • propagator_var::Dict{DataType,Vector{Bool}} A dictionary that specifies the variable dependence of different types of diagrams. Should be a map between DataTypes in DiagramID and Bool vectors. The dependence is given by a vector of the length same as the number of variables.
  • to_coeff_map::Dict{Int,TaylorSeries} A dicitonary that maps id of each node of target diagram to its correponding taylor series.
source
FeynmanDiagram.Utility.taylorexpansion_withmapMethod
taylorexpansion_withmap(g::G; coeffmode=true, var::Vector{Int}=collect(1:get_numvars())) where {G<:Graph}
+Return a taylor series of Graph g, together with a map of between nodes of g and correponding taylor series. In this set up, the leaves that are the same type of diagrams (such as Green functions) depend on the same set of variables.

Arguments:

  • graph Target Graph
  • propagator_var::Dict{DataType,Vector{Bool}} A dictionary that specifies the variable dependence of different types of diagrams. Should be a map between DataTypes in DiagramID and Bool vectors. The dependence is given by a vector of the length same as the number of variables.
  • to_coeff_map::Dict{Int,TaylorSeries} A dicitonary that maps id of each node of target diagram to its correponding taylor series.
source
FeynmanDiagram.Utility.taylorexpansion_withmapMethod
taylorexpansion_withmap(g::G; coeffmode=true, var::Vector{Int}=collect(1:get_numvars())) where {G<:Graph}
 
 Return a taylor series of graph g, together with a map of chain relationships between generated derivatives.
 This function is only internally used for constructing high order derivatives by naive nested forward AD.
-It is only for banch mark purpose and not exported.

Arguments:

  • g Target graph
  • coeffmode If true, the generated taylor series saves taylor coefficients with the factorial prefactor. If false, the taylor series saves derivatives instead
  • var The index of variables graph depends on
source
+It is only for banch mark purpose and not exported.

Arguments:

source diff --git a/previews/PR186/manual/counterterms/index.html b/previews/PR186/manual/counterterms/index.html index abce675c..d34f6f3c 100644 --- a/previews/PR186/manual/counterterms/index.html +++ b/previews/PR186/manual/counterterms/index.html @@ -15,4 +15,4 @@ \frac{(\delta\lambda)^n}{n!} \partial^{n}_\lambda V^m_\lambda = \left(\frac{\lambda}{8\pi}\right)^n \frac{m^{(n)}}{n!} V^{m+n}_\lambda = \binom{m + n - 1}{n} V^m_\lambda \delta^n_\lambda, \end{aligned}\]

where $m^{(n)} = \prod_{i=0}^{n-1} (m + i)$ is a rising factorial and

\[ \binom{m + n - 1}{n} = \frac{(m + n - 1)!}{n! (m-1)!} = \frac{m^{(n)}}{n!}.\]

Thus,

\[\begin{aligned} V^m & = \left(\sum^\infty_{n=0} \frac{(\delta\lambda)^n}{n!} \partial^n_\lambda V_\lambda\right)^m = V^m_\lambda \left(1 - \delta_\lambda\right)^{-m} = \sum^\infty_{n=0} \binom{m+n-1}{n} V^m_\lambda \delta^n_\lambda = \sum^\infty_{n=0} \frac{(\delta\lambda)^{n}}{n!} \partial^{n}_\lambda V^m_\lambda. -\end{aligned}\]

Since the order of differentiation w.r.t. $\mu$ and $\lambda$ does not matter, it follows that a general diagram $\mathcal{D}[g, V] \sim g^n V^m$ may be represented either by pre-expanding $g[g_\mu]$ and $V[V_\lambda]$ and collecting terms, or by directly evaluating terms in the Taylor series for $\mathcal{D}[g_\mu, V_\lambda]$; this codebase uses the latter approach.

Evaluation of interaction counterterms

An example of the interaction counterterm evaluation for a diagram with $n_\lambda = 3$ and $m$ interaction lines. Since the Julia implementation evaluates the interaction counterterms of a given diagram as $\frac{(-\lambda)^n}{n!}\partial^n_\lambda V^m_\lambda$, we pick up an extra factor of $l!$ on each $l$th-order derivative in the chain rule.

An example of the representation of interaction counterterm diagrams via differentiation.

Benchmark of counterterms in the UEG

As a concrete example, we have evaluated the individual diagrams and associated counterterms entering the RPT series for the total density $n[g_\mu, V_\lambda]$ in units of the non-interacting density $n_0$. The diagrams/counterterms are denoted by partitions $\mathcal{P} \equiv (n_{\text{loop}}, n_\mu, n_\lambda)$ indicating the total loop order and number of $\mu$ and $\lambda$ derivatives.

3D UEG

For this benchmark, we take $r_s = 1$, $\beta = 40 \epsilon_F$, and $\lambda = 0.6$. All partitions contributing up to 4th order are included, as well as some selected partitions at 5th and 6th order.

$(n_{\text{loop}}, n_\lambda, n_\mu)$$n / n_0$
(1, 0, 1)0.40814(16)
(1, 0, 2)0.02778(21)
(1, 0, 3)-0.00096(60)
(2, 0, 0)0.28853(12)
(2, 1, 0)0.07225(3)
(2, 2, 0)0.02965(2)
(2, 0, 1)0.09774(30)
(2, 1, 1)0.01594(10)
(2, 0, 2)0.00240(130)
(3, 0, 0)0.10027(37)
(3, 1, 0)0.04251(21)
(3, 0, 1)0.02600(150)
(4, 0, 0)0.00320(130)
(2, 1, 2)-0.00111(18)
(2, 0, 3)-0.00430(150)
(3, 2, 0)0.02241(8)
(3, 3, 0)0.01429(7)
+\end{aligned}\]

Since the order of differentiation w.r.t. $\mu$ and $\lambda$ does not matter, it follows that a general diagram $\mathcal{D}[g, V] \sim g^n V^m$ may be represented either by pre-expanding $g[g_\mu]$ and $V[V_\lambda]$ and collecting terms, or by directly evaluating terms in the Taylor series for $\mathcal{D}[g_\mu, V_\lambda]$; this codebase uses the latter approach.

Evaluation of interaction counterterms

An example of the interaction counterterm evaluation for a diagram with $n_\lambda = 3$ and $m$ interaction lines. Since the Julia implementation evaluates the interaction counterterms of a given diagram as $\frac{(-\lambda)^n}{n!}\partial^n_\lambda V^m_\lambda$, we pick up an extra factor of $l!$ on each $l$th-order derivative in the chain rule.

An example of the representation of interaction counterterm diagrams via differentiation.

Benchmark of counterterms in the UEG

As a concrete example, we have evaluated the individual diagrams and associated counterterms entering the RPT series for the total density $n[g_\mu, V_\lambda]$ in units of the non-interacting density $n_0$. The diagrams/counterterms are denoted by partitions $\mathcal{P} \equiv (n_{\text{loop}}, n_\mu, n_\lambda)$ indicating the total loop order and number of $\mu$ and $\lambda$ derivatives.

3D UEG

For this benchmark, we take $r_s = 1$, $\beta = 40 \epsilon_F$, and $\lambda = 0.6$. All partitions contributing up to 4th order are included, as well as some selected partitions at 5th and 6th order.

$(n_{\text{loop}}, n_\lambda, n_\mu)$$n / n_0$
(1, 0, 1)0.40814(16)
(1, 0, 2)0.02778(21)
(1, 0, 3)-0.00096(60)
(2, 0, 0)0.28853(12)
(2, 1, 0)0.07225(3)
(2, 2, 0)0.02965(2)
(2, 0, 1)0.09774(30)
(2, 1, 1)0.01594(10)
(2, 0, 2)0.00240(130)
(3, 0, 0)0.10027(37)
(3, 1, 0)0.04251(21)
(3, 0, 1)0.02600(150)
(4, 0, 0)0.00320(130)
(2, 1, 2)-0.00111(18)
(2, 0, 3)-0.00430(150)
(3, 2, 0)0.02241(8)
(3, 3, 0)0.01429(7)
diff --git a/previews/PR186/manual/feynman_rule/index.html b/previews/PR186/manual/feynman_rule/index.html index 5aa4f724..1225a8ed 100644 --- a/previews/PR186/manual/feynman_rule/index.html +++ b/previews/PR186/manual/feynman_rule/index.html @@ -8,4 +8,4 @@ \end{aligned}\]

The sign of $\Gamma^{(3)}$ diagram is given by $(-1)^{n_v} \xi^{n_F}$.

Feynman Rules for the 4-point Vertex Function

The 4-point vertex function is related to the 3-point vertex function through an equation,

\[\Gamma^{(3)}_{4,y,x} = \xi \cdot G_{4,s} \cdot G_{t, 4} \cdot \Gamma^{(4)}_{s, t, y, x},\]

where the indices $x, y, s, t$ could be different from diagrams to diagrams.

Diagrammatic expansion of the 4-point vertex function.

The diagram weights are given by,

\[\begin{aligned} \Gamma^{(4)}= & (-1) V_{56}^{\text{direct}} + (-1)\xi V_{56}^{exchange}\\ +&(-1)^2 \xi V_{56} V_{78} g_{58} g_{85}+(-1)^2 V_{56} V_{78}+\cdots, -\end{aligned}\]

where we used the identity $\xi^2 = 1$.

The sign of $\Gamma^{(4)}$ diagram is given by $(-1)^{n_v} \xi^{n_F}$ multiplied with a sign from the permutation of the external legs.

Feynman Rules for the Susceptibility

The susceptibility can be derived from $\Gamma^{(4)}$.

\[\chi_{1,2} \equiv \left<\mathcal{T} n_1 n_2\right>_{\text{connected}} = \xi G_{1,2} G_{2, 1} + \xi G_{1,s} G_{t, 1} \Gamma^{(4)}_{s, t, y, x} G_{2,y} G_{x, 2}\]

Diagrammatic expansion of the susceptibility.

We define the polarization $P$ as the one-interaction irreducible (or proper) vertex function,

\[\chi^{-1} = P^{-1} + V,\]

+\end{aligned}\]

where we used the identity $\xi^2 = 1$.

The sign of $\Gamma^{(4)}$ diagram is given by $(-1)^{n_v} \xi^{n_F}$ multiplied with a sign from the permutation of the external legs.

Feynman Rules for the Susceptibility

The susceptibility can be derived from $\Gamma^{(4)}$.

\[\chi_{1,2} \equiv \left<\mathcal{T} n_1 n_2\right>_{\text{connected}} = \xi G_{1,2} G_{2, 1} + \xi G_{1,s} G_{t, 1} \Gamma^{(4)}_{s, t, y, x} G_{2,y} G_{x, 2}\]

Diagrammatic expansion of the susceptibility.

We define the polarization $P$ as the one-interaction irreducible (or proper) vertex function,

\[\chi^{-1} = P^{-1} + V,\]

diff --git a/previews/PR186/manual/hubbard_atom/index.html b/previews/PR186/manual/hubbard_atom/index.html index fdbd493d..b1a155c6 100644 --- a/previews/PR186/manual/hubbard_atom/index.html +++ b/previews/PR186/manual/hubbard_atom/index.html @@ -1,2 +1,2 @@ -Hubbard Atom as a Test Case · FeynmanDiagram.jl

Hubbard Atom as a Test Case

One may use the Hubbard atom model to benchmark the Feynman diagrams generated by FeynmanDiagram.jl. In this note, we derive the vertex functions and their power expansion in interaction. The test is implemented in the test folder.

1 Hamiltonian

\[\hat{H}=U n_{\uparrow} n_{\downarrow}-\mu (n_{\uparrow}+n_{\downarrow})\]

where $U$ is the on-site interaction, $\mu$ is the chemical potential.

The eigenstates are,

  1. \[\left| 0 \right>\]

    : $E_0=0$.
  2. \[\left| {\uparrow} \right>\]

    and $\left| {\downarrow} \right>$ : $E_1=-\mu$.
  3. \[\left| \uparrow \downarrow \right>\]

    : $E_2=U-2\mu$.

2 Partition sum

\[Z=1+2e^{\mu\beta}+e^{-\beta(U-2\mu)}\]

3 Two-point Green's function

For the imaginary-time $\tau>0$,

\[G(\tau)=\left<\text{T} c_{\uparrow}(\tau) c^+_{\uparrow}(0) \right>=\frac{1}{Z}\sum_n \left< n\right|e^{-(\beta-\tau)H}c_{\uparrow} e^{-\tau H} c^+_{\uparrow} \left| n \right>\]

Only the states $\left| 0 \right>$ and $\left| {\downarrow} \right>$ contribute,

\[G(\tau)=\frac{e^{\mu \tau}+e^{\mu \beta}e^{-(U-\mu)\tau}}{Z}\]

For example, at half filling $\mu=U/2$, there is one particle and,

\[G(\tau)=\frac{e^{-U\tau/2}+e^{-U(\beta-\tau)/2}}{2(1+e^{-U\beta/2})}\]

Transform to the Matsubara frequency,

\[G(i\omega_n) = \int_0^\beta G(\tau)e^{i\omega_n\tau} d\tau\]

\[G(i\omega_n)=-\frac{1}{Z}\left(\frac{1+e^{\mu \beta}}{i\omega_n+\mu}+e^{\mu\beta}\frac{1+e^{-(U-\mu)\beta}}{i\omega_n-(U-\mu)}\right)\]

By setting $U=0$, one can show that the above dressed Green's function reduce to the bare one,

\[g(i\omega_n) = -\frac{1}{i\omega_n+\mu}\]

4 Self-energy

The self-energy is defined as $G^{-1}(i\omega_n)=g^{-1}(i\omega_n)-\Sigma(i\omega_n)$, so that

\[\Sigma(i\omega_n) = \frac{U e^{\beta \mu } (\mu +i w) \left(e^{\beta \mu }+e^{\beta U}\right)}{e^{\beta U} (-\mu +U-i w)+e^{\beta (\mu +U)} (-2 \mu +U-2 i w)-e^{2 \beta \mu } (\mu +i w)}\]

For benchmark purpose, here we also provide the power expansion of the self-energy at the low-energy limit $\omega_0 = \pi /\beta$ with $\mu=0$,

\[\Sigma(i\omega_0) = -\frac{U}{2}+\frac{(\pi +2 i) \beta U^2}{8 \pi }-\frac{\left(\pi ^2-4\right) \beta ^2 U^3}{32 \pi ^2}-\frac{\left(24 i-12 \pi +6 i \pi ^2+\pi ^3\right) \beta ^3 U^4}{384 \pi ^3}+\frac{\left(-48-48 i \pi -24 \pi ^2+12 i \pi ^3+5 \pi ^4\right) \beta ^4 U^5}{1536 \pi ^4}+O\left(U^6\right)\]

+Hubbard Atom as a Test Case · FeynmanDiagram.jl

Hubbard Atom as a Test Case

One may use the Hubbard atom model to benchmark the Feynman diagrams generated by FeynmanDiagram.jl. In this note, we derive the vertex functions and their power expansion in interaction. The test is implemented in the test folder.

1 Hamiltonian

\[\hat{H}=U n_{\uparrow} n_{\downarrow}-\mu (n_{\uparrow}+n_{\downarrow})\]

where $U$ is the on-site interaction, $\mu$ is the chemical potential.

The eigenstates are,

  1. \[\left| 0 \right>\]

    : $E_0=0$.
  2. \[\left| {\uparrow} \right>\]

    and $\left| {\downarrow} \right>$ : $E_1=-\mu$.
  3. \[\left| \uparrow \downarrow \right>\]

    : $E_2=U-2\mu$.

2 Partition sum

\[Z=1+2e^{\mu\beta}+e^{-\beta(U-2\mu)}\]

3 Two-point Green's function

For the imaginary-time $\tau>0$,

\[G(\tau)=\left<\text{T} c_{\uparrow}(\tau) c^+_{\uparrow}(0) \right>=\frac{1}{Z}\sum_n \left< n\right|e^{-(\beta-\tau)H}c_{\uparrow} e^{-\tau H} c^+_{\uparrow} \left| n \right>\]

Only the states $\left| 0 \right>$ and $\left| {\downarrow} \right>$ contribute,

\[G(\tau)=\frac{e^{\mu \tau}+e^{\mu \beta}e^{-(U-\mu)\tau}}{Z}\]

For example, at half filling $\mu=U/2$, there is one particle and,

\[G(\tau)=\frac{e^{-U\tau/2}+e^{-U(\beta-\tau)/2}}{2(1+e^{-U\beta/2})}\]

Transform to the Matsubara frequency,

\[G(i\omega_n) = \int_0^\beta G(\tau)e^{i\omega_n\tau} d\tau\]

\[G(i\omega_n)=-\frac{1}{Z}\left(\frac{1+e^{\mu \beta}}{i\omega_n+\mu}+e^{\mu\beta}\frac{1+e^{-(U-\mu)\beta}}{i\omega_n-(U-\mu)}\right)\]

By setting $U=0$, one can show that the above dressed Green's function reduce to the bare one,

\[g(i\omega_n) = -\frac{1}{i\omega_n+\mu}\]

4 Self-energy

The self-energy is defined as $G^{-1}(i\omega_n)=g^{-1}(i\omega_n)-\Sigma(i\omega_n)$, so that

\[\Sigma(i\omega_n) = \frac{U e^{\beta \mu } (\mu +i w) \left(e^{\beta \mu }+e^{\beta U}\right)}{e^{\beta U} (-\mu +U-i w)+e^{\beta (\mu +U)} (-2 \mu +U-2 i w)-e^{2 \beta \mu } (\mu +i w)}\]

For benchmark purpose, here we also provide the power expansion of the self-energy at the low-energy limit $\omega_0 = \pi /\beta$ with $\mu=0$,

\[\Sigma(i\omega_0) = -\frac{U}{2}+\frac{(\pi +2 i) \beta U^2}{8 \pi }-\frac{\left(\pi ^2-4\right) \beta ^2 U^3}{32 \pi ^2}-\frac{\left(24 i-12 \pi +6 i \pi ^2+\pi ^3\right) \beta ^3 U^4}{384 \pi ^3}+\frac{\left(-48-48 i \pi -24 \pi ^2+12 i \pi ^3+5 \pi ^4\right) \beta ^4 U^5}{1536 \pi ^4}+O\left(U^6\right)\]

diff --git a/previews/PR186/manual/interaction/index.html b/previews/PR186/manual/interaction/index.html index 8992b92c..4e6f7216 100644 --- a/previews/PR186/manual/interaction/index.html +++ b/previews/PR186/manual/interaction/index.html @@ -1,2 +1,2 @@ -Interaction/Scattering-Amplitude Convention · FeynmanDiagram.jl

Interaction/Scattering-Amplitude Convention

In general, the interaction (or scattering amplitude) between two spin-$1/2$ particles only has two independent spin components. Here we briefly review some of the common conventions of the spin components in literature, and show how to map between different conventions.

We assume a particle from the left collides with a particle from the right. Due to the interaction between the two particles, one of them scatters to the left, and the other to the right.

We will use the index $\alpha,\beta,\gamma,\delta$ to label the left incoming, the left outgoing, the right incoming and the right outgoing particles. We assume four legs associate with four momentum-frequency vectors $k_1, k_2, k_3, k_4$.

There are two possible scatterings: a direct scattering where the two particles don't permutate after the collision, and an exchange scattering where the two particles permutate. Therefore, the total scattering amplitude has two contributions,

\[v_{\alpha\beta\gamma\delta}(12;34) = v^d_{\alpha\beta\gamma\delta}(12;34)+v^e_{\alpha\beta\gamma\delta}(12;34)\]

where the exchange contribution is different from the direct counterpart up to an exchange of two outgoing legs and an overall particle statistic sign $\xi =\pm 1$,

\[v^e_{\alpha\beta\gamma\delta}(12;34) = \xi v^d_{\alpha\delta\gamma\beta}(14;32)\]

where we have abbreviated the momentum-frequency vectors as indices.

1. Spin symmetric and asymmetric convention:

A interaction is split into a term that is independent of the spin (e.g., Coulomb interaction between electrons) and a term with spin dependence (e.g., ferromagnetic/antiferromagnetic interaction). This convention is commonly used in textbooks of Fermi liquid theory.

\[v^d_{\alpha\beta\gamma\delta}(12;34) \equiv v^{s}_{12;34}\delta_{\alpha\beta}\delta_{\gamma\delta} + v^a_{12;34} \vec{\sigma}_{\alpha\beta}\cdot \vec{\sigma}_{\gamma\delta}\]

where the superscript $d$ means the scattering is direct.

If two particles permute after the collision, then one needs to exchange $\beta \leftrightarrow \gamma$ and other internal variables,

\[v^e_{\alpha\beta\gamma\delta}(12;34) = \xi v^s_{14;32}\delta_{\alpha\delta}\delta_{\gamma\beta} + \xi v^a_{14;32} \vec{\sigma}_{\alpha\delta}\cdot \vec{\sigma}_{\gamma\beta}\]

\[v^e_{\alpha\beta\gamma\delta}(12;34) = \xi\frac{v^s_{14;32}+3v^a_{14;32}}{2}\delta_{\alpha\beta}\delta_{\gamma\delta} + \xi \frac{v^s_{14;32}-v^a_{14;32}}{2} \vec{\sigma}_{\alpha\beta}\cdot \vec{\sigma}_{\gamma\delta}\]

To derive the above equations, we use the identity $\vec{\sigma}_{\alpha\beta}\cdot \vec{\sigma}_{\gamma\delta}=2 \delta_{\alpha \delta} \delta_{\beta \gamma}-\delta_{\alpha \beta} \delta_{\gamma \delta}$, which gives the following equations,

\[\delta_{\alpha\delta}\delta_{\gamma\beta}=\frac{1}{2}\delta_{\alpha\beta}\delta_{\gamma\delta}+\frac{1}{2}\vec{\sigma}_{\alpha\beta}\cdot \vec{\sigma}_{\gamma\delta},\]

and,

\[\vec{\sigma}_{\alpha\delta}\cdot \vec{\sigma}_{\gamma\beta}=\frac{3}{2}\delta_{\alpha\beta}\delta_{\gamma\delta}-\frac{1}{2}\vec{\sigma}_{\alpha\beta}\cdot \vec{\sigma}_{\gamma\delta}\]

2. Spin $\uparrow\uparrow$ and $\uparrow\downarrow$ convention:

An alternative parameterization of the interaction matrix is by specifiying the spin components $v_{\uparrow\uparrow} \equiv v_{\uparrow\uparrow\uparrow\uparrow}$ and $v_{\uparrow\downarrow} \equiv v_{\uparrow\uparrow\downarrow\downarrow}$. They can be derived from $v_s$ and $v_a$ by the simple relation,

\[v^d_{\uparrow\uparrow}(12;34) = v^s_{12;34}+v^a_{12;34}\]

\[v^d_{\uparrow\downarrow}(12;34) = v^s_{12;34}-v^a_{12;34}\]

If two particles permute after the collision, the exchange interaction $v^e$,

\[v^e_{\uparrow\uparrow}(12;34) = \xi\frac{v^s_{14;32}+3v^a_{14;32}}{2}+\xi\frac{v^s_{14;32}-v^s_{14;32}}{2} = \xi v^s_{14;32}+ \xi v^a_{14;32}\]

\[v^e_{\uparrow\downarrow}(12;34) = \xi\frac{v^s_{14;32}+3v^a_{14;32}}{2}-\xi\frac{v^s_{14;32}-v^s_{14;32}}{2} = 2 \xi v^a_{14;32}\]

+Interaction/Scattering-Amplitude Convention · FeynmanDiagram.jl

Interaction/Scattering-Amplitude Convention

In general, the interaction (or scattering amplitude) between two spin-$1/2$ particles only has two independent spin components. Here we briefly review some of the common conventions of the spin components in literature, and show how to map between different conventions.

We assume a particle from the left collides with a particle from the right. Due to the interaction between the two particles, one of them scatters to the left, and the other to the right.

We will use the index $\alpha,\beta,\gamma,\delta$ to label the left incoming, the left outgoing, the right incoming and the right outgoing particles. We assume four legs associate with four momentum-frequency vectors $k_1, k_2, k_3, k_4$.

There are two possible scatterings: a direct scattering where the two particles don't permutate after the collision, and an exchange scattering where the two particles permutate. Therefore, the total scattering amplitude has two contributions,

\[v_{\alpha\beta\gamma\delta}(12;34) = v^d_{\alpha\beta\gamma\delta}(12;34)+v^e_{\alpha\beta\gamma\delta}(12;34)\]

where the exchange contribution is different from the direct counterpart up to an exchange of two outgoing legs and an overall particle statistic sign $\xi =\pm 1$,

\[v^e_{\alpha\beta\gamma\delta}(12;34) = \xi v^d_{\alpha\delta\gamma\beta}(14;32)\]

where we have abbreviated the momentum-frequency vectors as indices.

1. Spin symmetric and asymmetric convention:

A interaction is split into a term that is independent of the spin (e.g., Coulomb interaction between electrons) and a term with spin dependence (e.g., ferromagnetic/antiferromagnetic interaction). This convention is commonly used in textbooks of Fermi liquid theory.

\[v^d_{\alpha\beta\gamma\delta}(12;34) \equiv v^{s}_{12;34}\delta_{\alpha\beta}\delta_{\gamma\delta} + v^a_{12;34} \vec{\sigma}_{\alpha\beta}\cdot \vec{\sigma}_{\gamma\delta}\]

where the superscript $d$ means the scattering is direct.

If two particles permute after the collision, then one needs to exchange $\beta \leftrightarrow \gamma$ and other internal variables,

\[v^e_{\alpha\beta\gamma\delta}(12;34) = \xi v^s_{14;32}\delta_{\alpha\delta}\delta_{\gamma\beta} + \xi v^a_{14;32} \vec{\sigma}_{\alpha\delta}\cdot \vec{\sigma}_{\gamma\beta}\]

\[v^e_{\alpha\beta\gamma\delta}(12;34) = \xi\frac{v^s_{14;32}+3v^a_{14;32}}{2}\delta_{\alpha\beta}\delta_{\gamma\delta} + \xi \frac{v^s_{14;32}-v^a_{14;32}}{2} \vec{\sigma}_{\alpha\beta}\cdot \vec{\sigma}_{\gamma\delta}\]

To derive the above equations, we use the identity $\vec{\sigma}_{\alpha\beta}\cdot \vec{\sigma}_{\gamma\delta}=2 \delta_{\alpha \delta} \delta_{\beta \gamma}-\delta_{\alpha \beta} \delta_{\gamma \delta}$, which gives the following equations,

\[\delta_{\alpha\delta}\delta_{\gamma\beta}=\frac{1}{2}\delta_{\alpha\beta}\delta_{\gamma\delta}+\frac{1}{2}\vec{\sigma}_{\alpha\beta}\cdot \vec{\sigma}_{\gamma\delta},\]

and,

\[\vec{\sigma}_{\alpha\delta}\cdot \vec{\sigma}_{\gamma\beta}=\frac{3}{2}\delta_{\alpha\beta}\delta_{\gamma\delta}-\frac{1}{2}\vec{\sigma}_{\alpha\beta}\cdot \vec{\sigma}_{\gamma\delta}\]

2. Spin $\uparrow\uparrow$ and $\uparrow\downarrow$ convention:

An alternative parameterization of the interaction matrix is by specifiying the spin components $v_{\uparrow\uparrow} \equiv v_{\uparrow\uparrow\uparrow\uparrow}$ and $v_{\uparrow\downarrow} \equiv v_{\uparrow\uparrow\downarrow\downarrow}$. They can be derived from $v_s$ and $v_a$ by the simple relation,

\[v^d_{\uparrow\uparrow}(12;34) = v^s_{12;34}+v^a_{12;34}\]

\[v^d_{\uparrow\downarrow}(12;34) = v^s_{12;34}-v^a_{12;34}\]

If two particles permute after the collision, the exchange interaction $v^e$,

\[v^e_{\uparrow\uparrow}(12;34) = \xi\frac{v^s_{14;32}+3v^a_{14;32}}{2}+\xi\frac{v^s_{14;32}-v^s_{14;32}}{2} = \xi v^s_{14;32}+ \xi v^a_{14;32}\]

\[v^e_{\uparrow\downarrow}(12;34) = \xi\frac{v^s_{14;32}+3v^a_{14;32}}{2}-\xi\frac{v^s_{14;32}-v^s_{14;32}}{2} = 2 \xi v^a_{14;32}\]