You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ time/space complexity is (7.965784284662086, 4.0)
58
58
59
59
Here, the `problem` is a `Independence` instance, it contains the tensor network contraction tree for the target graph.
60
60
Here, we choose the `TreeSA` optimizer to optimize the tensor network contraciton tree, it is a local search based algorithm, check [arXiv: 2108.05665](https://arxiv.org/abs/2108.05665). You will see some warnings, do not panic, this is because we set `sc_target` (target space complex) to 1 for agressive optimization of space complexity. Type `?TreeSA` in a Julia REPL for more information about the key word arguments.
61
-
Similarly, one can select tensor network structures for solving other problems like `MaximalIndependence`, `MaxCut`, `Matching`, `Coloring{K}` and `set_packing`.
61
+
Similarly, one can select tensor network structures for solving other problems like `MaximalIndependence`, `MaxCut`, `Matching`, `Coloring{K}`, `PaintShop` and `set_packing`.
# For the definition of independence polynomial, please check the docstring of [`Independence`](@ref) or this [wiki page](https://mathworld.wolfram.com/IndependencePolynomial.html).
40
+
# There are 3 methods to compute a graph polynomial, `:finitefield`, `:fft` and `:polynomial`.
41
+
# These methods are introduced in the docstring of [`GraphPolynomial`](@ref).
# There are two approaches to find one of the best solution.
47
+
# The unbounded (default) version uses [`ConfigSampler`](@ref) to sample one of the best solutions directly.
48
+
# The bounded version uses the binary gradient back-propagation (see our paper) to compute the gradients.
49
+
# It requires caching intermediate states, but is often faster on CPU because it can use [`TropicalGEMM`](https://github.com/TensorBFS/TropicalGEMM.jl).
Copy file name to clipboardExpand all lines: src/arithematics.jl
+25-1Lines changed: 25 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,27 @@ Base.abs(x::Mod) = x
8
8
Base.isless(x::Mod{N}, y::Mod{N}) where N =mod(x.val, N) <mod(y.val, N)
9
9
10
10
11
-
# this function is used for testing
11
+
"""
12
+
is_commutative_semiring(a::T, b::T, c::T) where T
13
+
14
+
Check if elements `a`, `b` and `c` satisfied the commutative semiring requirements.
15
+
```math
16
+
\\begin{align*}
17
+
(a \\oplus b) \\oplus c = a \\oplus (b \\oplus c) & \\hspace{5em}\\triangleright\\text{commutative monoid \$\\oplus\$ with identity \$\\mathbb{0}\$}\\\\
18
+
a \\oplus \\mathbb{0} = \\mathbb{0} \\oplus a = a &\\\\
19
+
a \\oplus b = b \\oplus a &\\\\
20
+
&\\\\
21
+
(a \\odot b) \\odot c = a \\odot (b \\odot c) & \\hspace{5em}\\triangleright \\text{commutative monoid \$\\odot\$ with identity \$\\mathbb{1}\$}\\\\
22
+
a \\odot \\mathbb{1} = \\mathbb{1} \\odot a = a &\\\\
23
+
a \\odot b = b \\odot a &\\\\
24
+
&\\\\
25
+
a \\odot (b\\oplus c) = a\\odot b \\oplus a\\odot c & \\hspace{5em}\\triangleright \\text{left and right distributive}\\\\
26
+
(a\\oplus b) \\odot c = a\\odot c \\oplus b\\odot c &\\\\
27
+
&\\\\
28
+
a \\odot \\mathbb{0} = \\mathbb{0} \\odot a = \\mathbb{0}
29
+
\\end{align*}
30
+
```
31
+
"""
12
32
functionis_commutative_semiring(a::T, b::T, c::T) where T
13
33
# +
14
34
if (a + b) + c != a + (b + c)
@@ -70,6 +90,10 @@ struct TruncatedPoly{K,T,TO} <: Number
0 commit comments