On q-ary Antipodal Matchings and Applications
Gadiel Seroussi 1
Universidad de la Republica, Montevideo, Uruguay, and
XPERI Corp., Los Gatos, California, USA
1based on joint work with
Erik Ordentlich (Oath Inc., CA, USA) andRonny Roth (Technion, Haifa, Israel)
done in part while at HP Labs, CA, USA
1 / 28
Motivation1: weight-constrained q-ary arrays
• We wish to encode data into n× n arrays over the integeralphabet Q , {0, 1, . . . , q−1}.• Clearly, the maximum possible weight (integer sum of entries)
of a row or column in such an array is wmax = n(q − 1).
• We are interested in constrained arrays where the weight ofany row or column is at most 1
2wmax = 12n(q − 1).
1 3 0 1
0 0 2 1
0 0 1 0
0 2 2 2
q = 4, n = 4, 12wmax = 6
2 / 28
Motivation1: weight-constrained q-ary arrays
• We wish to encode data into n× n arrays over the integeralphabet Q , {0, 1, . . . , q−1}.• Clearly, the maximum possible weight (integer sum of entries)
of a row or column in such an array is wmax = n(q − 1).
• We are interested in constrained arrays where the weight ofany row or column is at most 1
2wmax = 12n(q − 1).
1 3 0 1 5
0 0 2 1 3
0 0 1 0 1
0 2 2 2 6
1 5 5 4 X
q = 4, n = 4, 12wmax = 6
2 / 28
Motivation1: weight-constrained q-ary arrays
• We wish to encode data into n× n arrays over the integeralphabet Q , {0, 1, . . . , q−1}.• Clearly, the maximum possible weight (integer sum of entries)
of a row or column in such an array is wmax = n(q − 1).
• We are interested in constrained arrays where the weight ofany row or column is at most 1
2wmax = 12n(q − 1).
2 3 3 1 9
0 3 2 1 6
3 0 2 3 8
3 2 1 1 7
8 8 8 6 X
q = 4, n = 4, 12wmax = 6
2 / 28
Motivation1: weight-constrained q-ary arrays
• We wish to encode data into n× n arrays over the integeralphabet Q , {0, 1, . . . , q−1}.• Clearly, the maximum possible weight (integer sum of entries)
of a row or column in such an array is wmax = n(q − 1).
• We are interested in constrained arrays where the weight ofany row or column is at most 1
2wmax = 12n(q − 1).
1 3 0 1 5
0 0 2 1 3
0 0 1 0 1
0 2 2 2 6
1 5 5 4 X
q = 4, n = 4, 12wmax = 6
A problem in constrained coding .
2 / 28
Outline
1 IntroductionMotivation1: coding into weight-constrained q-ary arraysMotivation2: multi-level memristor memoriesA q-ary symbol-flipping code
2 q-ary antipodal matchingsDefinitionsThe binary case (q = 2)q-ary antipodal matchings: The unary constructionComplementary matchings: main toolsComplementary matchings: constructionComplementary matchings: complexity considerationsCoding into weight-constrained q-ary arrays
3 / 28
Problem definition
Definition
An×n : Set of all n× n arrays over Q = {0, 1, . . . , q−1} such thatthe weight of each row and column is at most 1
2wmax = 12(q − 1)n.
1 3 0 1 5
0 0 2 1 3
0 0 1 0 1
0 2 2 2 6
1 5 5 4 X
Problem
Construct 1–1 encoders
f : {0, 1}K −→ An×nsuch that
• f and f−1 can be computed efficiently.
• Redundancy n2 log2 q −K is small.
4 / 28
Problem definition
Definition
An×n : Set of all n× n arrays over Q = {0, 1, . . . , q−1} such thatthe weight of each row and column is at most 1
2wmax = 12(q − 1)n.
1 3 0 1 5
0 0 2 1 3
0 0 1 0 1
0 2 2 2 6
1 5 5 4 X
Problem
Construct 1–1 encoders
f : {0, 1}K −→ An×nsuch that
• f and f−1 can be computed efficiently.
• Redundancy n2 log2 q −K is small.
The binary case was addressed in [Ordentlich-Roth’12]. Here, weemphasize q > 2.
• For simplicity, we’ll often assume that q is even, or even a powerof 2 . The results apply in general, though.
4 / 28
Motivation2: multi-level memristor memories
Memristor crossbar
• Each memristor can be in one of qconductance states labeled0, 1, . . . , q − 1 (increasing 0).
• State is changed by applyingappropriate opposite voltages tothe row/column of the selectedmemristor (2VW voltage drop).
• Non-selected devices on samerow/column see a VW voltage drop⇒ they draw parasitic current.
• Limit parasitic current ⇔limit the total conductance of each row and column.
• 12wmax weight-constrained arrays ⇒ current / 1/2 of maxunder reasonable assumptions on the conductance states.
5 / 28
Motivation2: multi-level memristor memories
Memristor crossbar
• Each memristor can be in one of qconductance states labeled0, 1, . . . , q − 1 (increasing 0).
• State is changed by applyingappropriate opposite voltages tothe row/column of the selectedmemristor (2VW voltage drop).
• Non-selected devices on samerow/column see a VW voltage drop⇒ they draw parasitic current.
• Limit parasitic current ⇔limit the total conductance of each row and column.
• 12wmax weight-constrained arrays ⇒ current / 1/2 of maxunder reasonable assumptions on the conductance states.
5 / 28
Motivation2: multi-level memristor memories
Memristor crossbar
• Each memristor can be in one of qconductance states labeled0, 1, . . . , q − 1 (increasing 0).
• State is changed by applyingappropriate opposite voltages tothe row/column of the selectedmemristor (2VW voltage drop).
• Non-selected devices on samerow/column see a VW voltage drop⇒ they draw parasitic current.
• Limit parasitic current ⇔limit the total conductance of each row and column.
• 12wmax weight-constrained arrays ⇒ current / 1/2 of maxunder reasonable assumptions on the conductance states.
5 / 28
A q-ary symbol-flipping code
Definition: x , q − 1− x , complement of x ∈ Q (x→ x : flip).
Flipping encoder into An×n (similar to binary case)
1 Initialize the upper-left (n−1)×(n−1) entries witharbitrary elements from Q.
2 Initialize last row and column with 2n−1 arbitraryelements from {0, 1, . . . , bq/2c−1 }.
3 While there is any row/column of weight ≥ 12wmax do:
Flip one such (overweight) row or column (else stop).
.....
.....
.....
..
..
......
..
..
.......
-� n
6
?
n
� -n−1
6 / 28
A q-ary symbol-flipping code
Definition: x , q − 1− x , complement of x ∈ Q (x→ x : flip).
Flipping encoder into An×n (similar to binary case)
1 Initialize the upper-left (n−1)×(n−1) entries witharbitrary elements from Q.
2 Initialize last row and column with 2n−1 arbitraryelements from {0, 1, . . . , bq/2c−1 }.
3 While there is any row/column of weight ≥ 12wmax do:
Flip one such (overweight) row or column (else stop).
.....
.....
.....
..
..
......
..
..
.......
-� n
6
?
n
� -n−1
6 / 28
A q-ary symbol-flipping code
Definition: x , q − 1− x , complement of x ∈ Q (x→ x : flip).
Flipping encoder into An×n (similar to binary case)
1 Initialize the upper-left (n−1)×(n−1) entries witharbitrary elements from Q.
2 Initialize last row and column with 2n−1 arbitraryelements from {0, 1, . . . , bq/2c−1 }.
3 While there is any row/column of weight ≥ 12wmax do:
Flip one such (overweight) row or column (else stop).
.....
.....
.....
..
..
......
..
..
.......
-� n
6
?
n
� -n−1
• Guaranteed to stop (each row/column flip reduces overall weight).• Redundancy: 2n− 1 bits (not qits).
• n− o(n) is a trivial lower bound; ρn+ o(n) has been proven forthe binary case with ρ ≈ 1.45.
• Complexity: O(n3) symbol flips for encoding (somewhat unpredictablebetween n2 and n3), O(n2) for decoding.
6 / 28
A q-ary symbol-flipping code
• Problematic issue: flipping an overweightcolumn fixes its weight, but might make arow overweight (and vice versa).
• Wanted: a more predictable number ofencoding iterations.
We seek a 1-1 map that fixes anoverweight vector without increasing anyof its component weights
q=4, n=4, 12wmax=6
7
42 0 2
3
0
1
3
7 / 28
A q-ary symbol-flipping code
• Problematic issue: flipping an overweightcolumn fixes its weight, but might make arow overweight (and vice versa).
• Wanted: a more predictable number ofencoding iterations.
We seek a 1-1 map that fixes anoverweight vector without increasing anyof its component weights
q=4, n=4, 12wmax=6
5
72 0 2
0
3
2
0
7 / 28
A q-ary symbol-flipping code
• Problematic issue: flipping an overweightcolumn fixes its weight, but might make arow overweight (and vice versa).
• Wanted: a more predictable number ofencoding iterations.
We seek a 1-1 map that fixes anoverweight vector without increasing anyof its component weights
q=4, n=4, 12wmax=6
7
42 0 2
3
0
1
3
7 / 28
A q-ary symbol-flipping code
• Problematic issue: flipping an overweightcolumn fixes its weight, but might make arow overweight (and vice versa).
• Wanted: a more predictable number ofencoding iterations.
We seek a 1-1 map that fixes anoverweight vector without increasing anyof its component weights
q=4, n=4, 12wmax=6
2 0 2
3
0
1
3
⇒ q-ary antipodal matchings.
7 / 28
q-ary antipodal matchings
• Consider the sets of overweight and underweight n-vectors
L ={x ∈ Qn : w(x) > 1
2wmax
}R =
{x ∈ Qn : w(x) < 1
2wmax
}.
• A q-ary antipodal matching is a bijection ϕ : L → R suchthat x ≥ ϕ(x) (componentwise, x dominates ϕ(x)).
• ϕ corresponds to a perfect matching in the bipartite graphGn,q = (L : R, E), where E = {(x,y) : x ≥ y} .
8 / 28
q-ary antipodal matchings
• Consider the sets of overweight and underweight n-vectors
L ={x ∈ Qn : w(x) > 1
2wmax
}R =
{x ∈ Qn : w(x) < 1
2wmax
}.
• A q-ary antipodal matching is a bijection ϕ : L → R suchthat x ≥ ϕ(x) (componentwise, x dominates ϕ(x)).
• ϕ corresponds to a perfect matching in the bipartite graphGn,q = (L : R, E), where E = {(x,y) : x ≥ y} .
8 / 28
q-ary antipodal matchings
• Consider the sets of overweight and underweight n-vectors
L ={x ∈ Qn : w(x) > 1
2wmax
}R =
{x ∈ Qn : w(x) < 1
2wmax
}.
• A q-ary antipodal matching is a bijection ϕ : L → R suchthat x ≥ ϕ(x) (componentwise, x dominates ϕ(x)).
• ϕ corresponds to a perfect matching in the bipartite graphGn,q = (L : R, E), where E = {(x,y) : x ≥ y} .
G2,4
( 12wmax = 3)
(3, 3)
(3, 2)
(3, 1)
(2, 2)
(2, 3)
(1, 3)
(0, 0)
(0, 1)
(0, 2)
(1, 1)
(1, 0)
(2, 0)
PPPPPQQQQQ
@@@@@
SSSSSS
TTTTTTTT
�����
PPPPPQQQQQ
@@@@@
SSSSSS
�����
�����
PPPPPQQQQQ
@@@@@
�����
�����
�����
PPPPPQQQQQ
������
�����
�����
�����
PPPPP��������
������
�����
�����
�����uu
uuuu
uuuuuu
8 / 28
q-ary antipodal matchings
• Consider the sets of overweight and underweight n-vectors
L ={x ∈ Qn : w(x) > 1
2wmax
}R =
{x ∈ Qn : w(x) < 1
2wmax
}.
• A q-ary antipodal matching is a bijection ϕ : L → R suchthat x ≥ ϕ(x) (componentwise, x dominates ϕ(x)).
• ϕ corresponds to a perfect matching in the bipartite graphGn,q = (L : R, E), where E = {(x,y) : x ≥ y} .
G2,4
( 12wmax = 3)
(3, 3)
(3, 2)
(3, 1)
(2, 2)
(2, 3)
(1, 3)
(0, 0)
(0, 1)
(0, 2)
(1, 1)
(1, 0)
(2, 0)
PPPPPQQQQQ
@@@@@
SSSSSS
TTTTTTTT
�����
PPPPPQQQQQ
@@@@@
SSSSSS
�����
�����
PPPPPQQQQQ
@@@@@
�����
�����
�����
PPPPPQQQQQ
������
�����
�����
�����
PPPPP��������
������
�����
�����
�����uu
uuuu
uuuuuu
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
uuuuuu
uuuuuu
q-ary antipodal matching
8 / 28
q-ary antipodal matchings
• Consider the sets of overweight and underweight n-vectors
L ={x ∈ Qn : w(x) > 1
2wmax
}R =
{x ∈ Qn : w(x) < 1
2wmax
}.
• A q-ary antipodal matching is a bijection ϕ : L → R suchthat x ≥ ϕ(x) (componentwise, x dominates ϕ(x)).
• ϕ corresponds to a perfect matching in the bipartite graphGn,q = (L : R, E), where E = {(x,y) : x ≥ y} .
G2,4
( 12wmax = 3)
(3, 3)
(3, 2)
(3, 1)
(2, 2)
(2, 3)
(1, 3)
(0, 0)
(0, 1)
(0, 2)
(1, 1)
(1, 0)
(2, 0)
PPPPPQQQQQ
@@@@@
SSSSSS
TTTTTTTT
�����
PPPPPQQQQQ
@@@@@
SSSSSS
�����
�����
PPPPPQQQQQ
@@@@@
�����
�����
�����
PPPPPQQQQQ
������
�����
�����
�����
PPPPP��������
������
�����
�����
�����uu
uuuu
uuuuuu��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������������������������������������������������������
�������������������������
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������������������������������������������������������
�������������������������uuuuuu
uuuuuu Even more desirable:
complementary q-ary antipodal
matching
ϕ(x)i ∈ {xi, xi} .Yields better leakage current
reduction guarantees.
8 / 28
The binary case (q = 2)
• Existence of a perfect match in Gn,2 is established bypartitioning the graph into to the subgraphs induced by theconstant-weight node subsets Lw(x)=w : Rw(x)=n−w.
These graphs are regular , and thus satisfy Hall’s condition,guaranteeing existence of a perfect matching.
Hall’s condition on a graph (L : R,E)
For every subset S ⊆ L, the set N (S) of neighbors of S satisfies|N (S)| ≥ |S|.
9 / 28
The binary case (q = 2)
An efficiently computable matching ϕb was derived in
[Ordentlich-Roth’12].
• Based on a “random walk” drivenby x (0: ‘down’, 1: ‘up’).
• Identify minimal points on thewalk, extended cyclically,
@@��@@�����s s s s ss ss
0 1 0 1 1 1 1
10 / 28
The binary case (q = 2)
An efficiently computable matching ϕb was derived in
[Ordentlich-Roth’12].
• Based on a “random walk” drivenby x (0: ‘down’, 1: ‘up’).
• Identify minimal points on thewalk, extended cyclically, @@��@@�
����s s s s ss ss
s ss
hights notreturned to @@��@@��s s s s s
0 1 0 1 1 1 1
10 / 28
The binary case (q = 2)
An efficiently computable matching ϕb was derived in
[Ordentlich-Roth’12].
• Based on a “random walk” drivenby x (0: ‘down’, 1: ‘up’).
• Identify minimal points on thewalk, extended cyclically,then flip them.
@@��@@�����s s s s ss ss
s ss
hights notreturned to @@��@@��s s s s s
0 1 0 0 0 0 1
10 / 28
The binary case (q = 2)
An efficiently computable matching ϕb was derived in
[Ordentlich-Roth’12].
• Based on a “random walk” drivenby x (0: ‘down’, 1: ‘up’).
• Identify minimal points on thewalk, extended cyclically,then flip them.
@@��@@�����s s s s ss ss
s ss
hights notreturned to @@��@@��s s s s s
0 1 0 0 0 0 1
• Overall complexity is O(n).
• Inverse is ϕ−1b (y) = (ϕb(y
∗))∗, where(y0, y1, . . . , yn−1)∗ = (yn−1, . . . , y1, y0).
10 / 28
The binary case (q = 2)
An efficiently computable matching ϕb was derived in
[Ordentlich-Roth’12].
• Based on a “random walk” drivenby x (0: ‘down’, 1: ‘up’).
• Identify minimal points on thewalk, extended cyclically,then flip them.
@@��@@�����s s s s ss ss
s ss
hights notreturned to @@��@@��s s s s s
0 1 0 0 0 0 1
• Overall complexity is O(n).
• Inverse is ϕ−1b (y) = (ϕb(y
∗))∗, where(y0, y1, . . . , yn−1)∗ = (yn−1, . . . , y1, y0).
For q > 2:• No obvious decomposition of Gn,q into regular bipartite graphs
=⇒ no obvious proof of existence of q-ary antipodal matchings.
• Natural generalization of “random walk” construction does notwork (step sizes: {0, 1, . . . , q−1} → {−q+1,−q+3, . . . , q−1}).
10 / 28
q-ary antipodal matchings: The unary construction
A useful property of the binary antipodal matching:
x 111110111100111110
bits that get flipped are always in prefixes of runs of 1s.
• Unary representation of x ∈ Q:
u(x) = 0 0 · · · 0︸ ︷︷ ︸x
1 1 · · · 1︸ ︷︷ ︸x
(total length: q−1) .
• Extends to vectors: u(x) = u(x0)u(x1) . . . u(xn−1).Clearly, w(x) = Hamming weight of u(x).
Proposition
The mapping ϕu : Qn → Qn defined by
ϕu(x) = u−1(ϕb
(u(x)
))is a q-ary antipodal matching.
12 / 28
q-ary antipodal matchings: The unary construction
A useful property of the binary antipodal matching:
000010001100000010ϕb(x)
bits that get flipped are always in prefixes of runs of 1s.
• Unary representation of x ∈ Q:
u(x) = 0 0 · · · 0︸ ︷︷ ︸x
1 1 · · · 1︸ ︷︷ ︸x
(total length: q−1) .
• Extends to vectors: u(x) = u(x0)u(x1) . . . u(xn−1).Clearly, w(x) = Hamming weight of u(x).
Proposition
The mapping ϕu : Qn → Qn defined by
ϕu(x) = u−1(ϕb
(u(x)
))is a q-ary antipodal matching.
12 / 28
q-ary antipodal matchings: The unary construction
A useful property of the binary antipodal matching:
000010001100000010ϕb(x)
bits that get flipped are always in prefixes of runs of 1s.
• Unary representation of x ∈ Q:
u(x) = 0 0 · · · 0︸ ︷︷ ︸x
1 1 · · · 1︸ ︷︷ ︸x
(total length: q−1) .
• Extends to vectors: u(x) = u(x0)u(x1) . . . u(xn−1).Clearly, w(x) = Hamming weight of u(x).
Proposition
The mapping ϕu : Qn → Qn defined by
ϕu(x) = u−1(ϕb
(u(x)
))is a q-ary antipodal matching.
12 / 28
q-ary antipodal matchings: The unary construction
A useful property of the binary antipodal matching:
000010001100000010ϕb(x)
bits that get flipped are always in prefixes of runs of 1s.
• Unary representation of x ∈ Q:
u(x) = 0 0 · · · 0︸ ︷︷ ︸x
1 1 · · · 1︸ ︷︷ ︸x
(total length: q−1) .
• Extends to vectors: u(x) = u(x0)u(x1) . . . u(xn−1).Clearly, w(x) = Hamming weight of u(x).
Proposition
The mapping ϕu : Qn → Qn defined by
ϕu(x) = u−1(ϕb
(u(x)
))is a q-ary antipodal matching.
12 / 28
q-ary random walk interpretation
• A direct implementation of ϕu based on the binary matching ϕb
would have complexity O(qn).• A more efficient procedure, not involving a conversion of the
input x = (x0, x1, . . . , xn−1) to binary, is obtained byconsidering a q-ary “random walk” with steps
∆i = xi + xi+1 − (q − 1) .
13 / 28
q-ary random walk interpretation
• A direct implementation of ϕu based on the binary matching ϕb
would have complexity O(qn).• A more efficient procedure, not involving a conversion of the
input x = (x0, x1, . . . , xn−1) to binary, is obtained byconsidering a q-ary “random walk” with steps
∆i = xi + xi+1 − (q − 1) .
• Also based on finding minimalpoints. The values there are notflipped, but adjusted downappropriately.
• Not necessarily complementarycoordinate-wise, butw(ϕu(x)) = wmax −w(x).
• O(n) integer operations.
s s s ss ss
∆ : 2 -3 -1 4 2 2
Example: q = 6, n = 6
x : 5 2 0 4 5 2
13 / 28
q-ary random walk interpretation
• A direct implementation of ϕu based on the binary matching ϕb
would have complexity O(qn).• A more efficient procedure, not involving a conversion of the
input x = (x0, x1, . . . , xn−1) to binary, is obtained byconsidering a q-ary “random walk” with steps
∆i = xi + xi+1 − (q − 1) .
• Also based on finding minimalpoints. The values there are notflipped, but adjusted downappropriately.
• Not necessarily complementarycoordinate-wise, butw(ϕu(x)) = wmax −w(x).
• O(n) integer operations.
s s s ss sss s s ss
ss
∆ : 2 -3 -1 4 2 2
Example: q = 6, n = 6
x : 5 2 0 4 5 2
13 / 28
q-ary random walk interpretation
• A direct implementation of ϕu based on the binary matching ϕb
would have complexity O(qn).• A more efficient procedure, not involving a conversion of the
input x = (x0, x1, . . . , xn−1) to binary, is obtained byconsidering a q-ary “random walk” with steps
∆i = xi + xi+1 − (q − 1) .
• Also based on finding minimalpoints. The values there are notflipped, but adjusted downappropriately.
• Not necessarily complementarycoordinate-wise, butw(ϕu(x)) = wmax −w(x).
• O(n) integer operations.
s s s ss sss s s ss
ss
∆ : 2 -3 -1 4 2 2
Example: q = 6, n = 6
ϕu(x) : 5 2 0 0 3 2
13 / 28
Efficient computation of ϕu(x)
Input: x = (x0, x1, . . . , xn−1) ∈ Ln,q (vectors x,∆ derived from x)Output: y = ϕu(x)Variables: i, t ∈ Z/`Z (arithmetic modulo `); d, S,W ∈ Z
t = 0; d = 0; S = 0;for i = 1 to `− 1 do
S += ∆i−1;if S ≤ d then
d = S; t = i;end if
end fory = x; W = w(x);while W > 0 do
d = 0;while d ≤ 0 do
d += ∆t−1; t−−;end whileyt = xt − d; W −= d;
end whilereturn y.
14 / 28
Complementary q-ary antipodal matchings
A q-ary antipodal matching ϕc s.t.
(ϕc)i ∈ {xi, xi}.
⇒ Perfect matching in Gcn,q ⊆ Gn,q.
G2,4
q = 4, n = 2( 12wmax = 3)
(3, 3)
(3, 2)
(3, 1)
(2, 2)
(2, 3)
(1, 3)
(0, 0)
(0, 1)
(0, 2)
(1, 1)
(1, 0)
(2, 0)
PPPP����
PPPP����ss
ssss
ssssssPPPPQ
QQQ
@@@@
SSSSS
TTTTTT
����
PPPPQQQQ
@@@@
SSSSS
����
����
PPPPQQQQ
@@@@
����
����
����
PPPPQQQQ
�����
����
����
����
PPPP������
�����
����
����
����ss
ssss
ssssss
ssssss
ssssss
15 / 28
Complementary q-ary antipodal matchings
A q-ary antipodal matching ϕc s.t.
(ϕc)i ∈ {xi, xi}.
⇒ Perfect matching in Gcn,q ⊆ Gn,q.
Gc2,4
q = 4, n = 2( 12wmax = 3)
(3, 3)
(3, 2)
(3, 1)
(2, 2)
(2, 3)
(1, 3)
(0, 0)
(0, 1)
(0, 2)
(1, 1)
(1, 0)
(2, 0)
PPPP����
PPPP����ss
ssss
ssssssPPPP��
��
PPPP����ss
ssss
ssssss
ssssss
ssssss
15 / 28
Complementary q-ary antipodal matchings
A q-ary antipodal matching ϕc s.t.
(ϕc)i ∈ {xi, xi}.
⇒ Perfect matching in Gcn,q ⊆ Gn,q.
Gc2,4
q = 4, n = 2( 12wmax = 3)
(3, 3)
(3, 2)
(3, 1)
(2, 2)
(2, 3)
(1, 3)
(0, 0)
(0, 1)
(0, 2)
(1, 1)
(1, 0)
(2, 0)
PPPP����
PPPP����ss
ssss
ssssssPPPP��
��
PPPP����ss
ssss
ssssss��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
�����������������������������������������������������������������������������������������������������������������������
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
�����������������������������������������������������������������������������������������������������������������������ss
ssss
ssssss
ssssss
ssssss
Main results:
Existence
For all q and n, there exist complementary q-ary antipodalmatchings on Qn.
Construction
We present efficient constructions of complementary q-aryantipodal matchings for small q and all n.
15 / 28
Complementary matchings: main tools
Proposition (a more general matching result)
Let v = (v1, . . . , vn)∈Rn, vi ≥ 0, and w(v)=∑
i vi.Define the bipartite graph G(v) = (L:R, E), with
L ={a ∈ {0, 1}n :
∑i aivi >
12w(v)
},
R ={a ∈ {0, 1}n :
∑i aivi <
12w(v)
},
E = { (a, b) ∈ L×R : a ≥ b } .
Then, G(v) has a perfect matching.
G(6, 5, 3)12w(v) = 7
011
101
110
111
000
100
010
001
@@@@
JJJJJ
����
@@@@
����
����
����
����tt
tttttt
16 / 28
Complementary matchings: main tools
Proposition (a more general matching result)
Let v = (v1, . . . , vn)∈Rn, vi ≥ 0, and w(v)=∑
i vi.Define the bipartite graph G(v) = (L:R, E), with
L ={a ∈ {0, 1}n :
∑i aivi >
12w(v)
},
R ={a ∈ {0, 1}n :
∑i aivi <
12w(v)
},
E = { (a, b) ∈ L×R : a ≥ b } .
Then, G(v) has a perfect matching.
G(6, 5, 3)12w(v) = 7
011
101
110
111
000
100
010
001
@@@@
JJJJJ
����
@@@@
����
����
����
����
@@@@
@@@@
@@@@
@@@@
@@@@
@@@@
����
����
����
tttt
tttt
• Proof: using the Marica-Schonheim (1969) inequality on setdifferences, we show that Hall’s condition holds for G(v) (nota regular graph).
16 / 28
Complementary matchings: main tools
Proposition (a more general matching result)
Let v = (v1, . . . , vn)∈Rn, vi ≥ 0, and w(v)=∑
i vi.Define the bipartite graph G(v) = (L:R, E), with
L ={a ∈ {0, 1}n :
∑i aivi >
12w(v)
},
R ={a ∈ {0, 1}n :
∑i aivi <
12w(v)
},
E = { (a, b) ∈ L×R : a ≥ b } .
Then, G(v) has a perfect matching.Gc2,4
(3, 3)(3, 2)(3, 1)(2, 2)(2, 3)(1, 3)
(0, 0)(0, 1)(0, 2)(1, 1)(1, 0)(2, 0)
PPP���
PPP���sss
sssssssss��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������ssssss
ssssss
• Existence of a perfect matching in Gcq,n is reduced to theexistence of perfect matchings in G(v) for various vectors v.• These graphs G(v) have sizes exponential in n.
• Construction uses G(v) and the proposition in a different way.• Matching on one graph G(v), length(v)=q/2 (indep. of n).• up to q/2 applications of ϕb on binary vectors of lengthsn0, n1, . . . , nq/2−1 adding up to n (overall time O(n)).
16 / 28
Complementary matchings: main tools
Proposition (a more general matching result)
Let v = (v1, . . . , vn)∈Rn, vi ≥ 0, and w(v)=∑
i vi.Define the bipartite graph G(v) = (L:R, E), with
L ={a ∈ {0, 1}n :
∑i aivi >
12w(v)
},
R ={a ∈ {0, 1}n :
∑i aivi <
12w(v)
},
E = { (a, b) ∈ L×R : a ≥ b } .
Then, G(v) has a perfect matching.Gc2,4
(3, 3)(3, 2)(3, 1)(2, 2)(2, 3)(1, 3)
(0, 0)(0, 1)(0, 2)(1, 1)(1, 0)(2, 0)
PPP���
PPP���sss
sssssssss��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������������������������������������������������������������������ssssss
ssssss
• Existence of a perfect matching in Gcq,n is reduced to theexistence of perfect matchings in G(v) for various vectors v.• These graphs G(v) have sizes exponential in n.
• Construction uses G(v) and the proposition in a different way.• Matching on one graph G(v), length(v)=q/2 (indep. of n).• up to q/2 applications of ϕb on binary vectors of lengthsn0, n1, . . . , nq/2−1 adding up to n (overall time O(n)).
16 / 28
Complementary matchings: construction (example)
• x ∈ Qn, w(x)=24 (q=6, n=8, 12wmax=20)5 2 0 4 5 2 4 2
17 / 28
Complementary matchings: construction (example)
• x ∈ Qn, w(x)=24 (q=6, n=8, 12wmax=20)5 2 0 4 5 2 4 25 0 52 22 44
• gather by complementary pairs into q/2sub-vectors x|r, r=0, 1, ...q/2−14 4
x|1
5 0 5
x|0
2 2 2
x|2
17 / 28
Complementary matchings: construction (example)
• x ∈ Qn, w(x)=24 (q=6, n=8, 12wmax=20)5 2 0 4 5 2 4 25 0 52 22 44
• gather by complementary pairs into q/2sub-vectors x|r, r=0, 1, ...q/2−14 4
x|1
5 0 5
x|0
2 2 2
x|2
• derive binary vectors br( 1 1 )
6
( 1 0 1 )
5
( 0 0 0 )
−3 • compute signed weights w(x|r)=∑
i(2xi−q+1)
17 / 28
Complementary matchings: construction (example)
• x ∈ Qn, w(x)=24 (q=6, n=8, 12wmax=20)5 2 0 4 5 2 4 25 0 52 22 44
• gather by complementary pairs into q/2sub-vectors x|r, r=0, 1, ...q/2−14 4
x|1
5 0 5
x|0
2 2 2
x|2
• derive binary vectors br( 1 1 )
6
6[
1[
( 1 0 1 )
5
5
1
( 0 0 0 )
−33 ]
0 ]
• compute signed weights w(x|r)=∑
i(2xi−q+1)
• v : abs values of weights
• s : signs of weights (1: non-neg, 0: neg)
17 / 28
Complementary matchings: construction (example)
• x ∈ Qn, w(x)=24 (q=6, n=8, 12wmax=20)5 2 0 4 5 2 4 25 0 52 22 44
• gather by complementary pairs into q/2sub-vectors x|r, r=0, 1, ...q/2−14 4
x|1
5 0 5
x|0
2 2 2
x|2
• derive binary vectors br( 1 1 )
6
6[
1[
( 1 0 1 )
5
5
1
( 0 0 0 )
−33 ]
0 ]
• compute signed weights w(x|r)=∑
i(2xi−q+1)
• v : abs values of weights
• s : signs of weights011101110111
000100010001
@@JJ
��@@��������@@@@@@@@@@@@������qqqq qqqq
G(6, 5, 3)
qqqq qqqq[ 1 0 0 ]
• find the image of s in aperfect matching of G(v).
17 / 28
Complementary matchings: construction (example)
• x ∈ Qn, w(x)=24 (q=6, n=8, 12wmax=20)5 2 0 4 5 2 4 25 0 52 22 44
• gather by complementary pairs into q/2sub-vectors x|r, r=0, 1, ...q/2−14 4
x|1
5 0 5
x|0
2 2 2
x|2
• derive binary vectors br( 1 1 )
6
6[
1[
( 1 0 1 )
5
5
1
( 0 0 0 )
−33 ]
0 ]
• compute signed weights w(x|r)=∑
i(2xi−q+1)
• v : abs values of weights
• s : signs of weights011101110111
000100010001
@@JJ
��@@��������@@@@@@@@@@@@������qqqq qqqq
G(6, 5, 3)
qqqq qqqq[ 1 0 0 ]
• find the image of s in aperfect matching of G(v).
• If a bit in s was flipped 1→0, apply thebinary mapping ϕb to the correspondingvector br, and transform x|r accordingly.
���
� �
(1, 0, 1)ϕb−→ (0, 0, 1)
5 0 5 −→ 0 0 5
17 / 28
Complementary matchings: construction (example)
• x ∈ Qn, w(x)=24 (q=6, n=8, 12wmax=20)5 2 0 4 5 2 4 25 0 52 22 44
• gather by complementary pairs into q/2sub-vectors x|r, r=0, 1, ...q/2−14 4
x|1
5 0 5
x|0
2 2 2
x|2
• derive binary vectors br( 1 1 )
6
6[
1[
( 1 0 1 )
5
5
1
( 0 0 0 )
−33 ]
0 ]
• compute signed weights w(x|r)=∑
i(2xi−q+1)
• v : abs values of weights
• s : signs of weights011101110111
000100010001
@@JJ
��@@��������@@@@@@@@@@@@������qqqq qqqq
G(6, 5, 3)
qqqq qqqq[ 1 0 0 ]
• find the image of s in aperfect matching of G(v).
• If a bit in s was flipped 1→0, apply thebinary mapping ϕb to the correspondingvector br, and transform x|r accordingly.
���
� �
(1, 0, 1)ϕb−→ (0, 0, 1)
5 0 5 −→ 0 0 5
w=24 5 2 0 4 5 2 4 2ϕc−→ 0 2 0 4 5 2 4 2 w=19
17 / 28
Complementary matchings: complexity considerations
• Overall computation is O(n)• Grouping of symbols by magnitude, computation of the weight
vector v, the binary vectors br and s, and any necessaryapplications of ϕb are of overall complexity O(n).
• Remaining task: identify the graph G(v), its perfect matching,and the image of s under the matching (recall len(v) = q
2 ).
• Given q, there is a finite number of possible graphs G(v), anda perfect matching for each one could be pre-computed.
18 / 28
Complementary matchings: complexity considerations
• Overall computation is O(n)• Grouping of symbols by magnitude, computation of the weight
vector v, the binary vectors br and s, and any necessaryapplications of ϕb are of overall complexity O(n).
• Remaining task: identify the graph G(v), its perfect matching,and the image of s under the matching (recall len(v) = q
2 ).
• Given q, there is a finite number of possible graphs G(v), anda perfect matching for each one could be pre-computed.
Example: Graphs G(v) and matchings for q = 6 (q/2 = 3)
18 / 28
Complementary matchings: complexity considerations
• However, the number of graphs G(v) growssuper-exponentially with q, so, in practice, they can bepre-computed only for relatively small values of q.
Each graph G(v) correspondsto a linear threshold Booleanfunction on q/2 variables.These functions have beenextensively studied.
q/2 # of G(v)2 13 24 35 76 217 1358 2,4709 175,428
10 52,980,624
19 / 28
Threshold function search tree for q/2 = 5
Leaves: 7 Depth: 3
20 / 28
Threshold function search tree for q/2 = 5
Leaves: 7 Depth: 3fv(10010) = 0fv(10100) = 1fv(10011) = 0⇒ fv ≡ f0
Each internal node corresponds to the evaluation of the thresholdfunction at a given binary q/2-uple a (i.e. computing a · v andchecking the threshold), and branching accordingly. Leaves identifythe functions.
20 / 28
Threshold function search tree for q/2 = 6
21 / 28
Threshold function search tree for q/2 = 7
Leaves: 137 Depth: 8
22 / 28
Threshold function search tree for q/2 = 8
Leaves: 2470 Depth: 13 (least possible).
23 / 28
Coding into weight-constrained q-ary arrays
• We show encodings based on ϕu ; similar schemes can bedescribed for complementary matchings.
• To encode into An×n, we will apply ϕu to vectors of lengths nand n− 2.
• First stage: data initialization (assume q = 2k).
.............
.............
.............
.............
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.................
-� n
6
?
n
• Total redundancy: 2n+ 4 bits.
25 / 28
Coding into weight-constrained q-ary arrays
• We show encodings based on ϕu ; similar schemes can bedescribed for complementary matchings.
• To encode into An×n, we will apply ϕu to vectors of lengths nand n− 2.
• First stage: data initialization (assume q = 2k).
1 (n−1)2 − 1 full symbols from Q.
2 2(n−2) even symbols from Q(k−1 bits each).
3 4 symbols in {0, 1, . . . , q4 − 1}(k−2 bits each).
.............
.............
.............
.............
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.................
.............
.............
.............
.............
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.................
-� n
6
?
n
• Total redundancy: 2n+ 4 bits.
25 / 28
Coding into weight-constrained q-ary arrays
• We show encodings based on ϕu ; similar schemes can bedescribed for complementary matchings.
• To encode into An×n, we will apply ϕu to vectors of lengths nand n− 2.
• First stage: data initialization (assume q = 2k).
1 (n−1)2 − 1 full symbols from Q.
2 2(n−2) even symbols from Q(k−1 bits each).
3 4 symbols in {0, 1, . . . , q4 − 1}(k−2 bits each).
.............
.............
.............
.............
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.................
.............
.............
.............
.............
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.................
.............
.............
.............
.............
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.................
-� n
6
?
n
• Total redundancy: 2n+ 4 bits.
25 / 28
Coding into weight-constrained q-ary arrays
• We show encodings based on ϕu ; similar schemes can bedescribed for complementary matchings.
• To encode into An×n, we will apply ϕu to vectors of lengths nand n− 2.
• First stage: data initialization (assume q = 2k).
1 (n−1)2 − 1 full symbols from Q.
2 2(n−2) even symbols from Q(k−1 bits each).
3 4 symbols in {0, 1, . . . , q4 − 1}(k−2 bits each). .............
.............
.............
.............
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.................
.............
.............
.............
.............
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.................
.............
.............
.............
.............
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.................
.............
.............
.............
.............
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.
...
...
...
...
.................
-� n
6
?
n
• Total redundancy: 2n+ 4 bits.
25 / 28
Encoding algorithm (after data initialization)
Input: n×n array A with initialized data (notation: [`]={0, 1, . . ., `−1}).
1 Flip all of the first n−2 rows of A that are overweight.
2 For all j ∈ [n−2] do:
If w(A[n],j) % 4 = 0, set An−1,j += 1.
If (the resulting) w(A[n],j) is positive then do:
(a) replace A[n],j with ϕu(A[n],j);
(b) set An−1,j = (An−1,j + 1) % q.
3 For j ∈ {n−2, n−1} do:
(a) if w(A[n−2],j) > 0, replace A[n−2],j with ϕu(A[n−2],j)
and set An−2,j += q/4;
(b) if w(Aj,[n−2]) > 0, replace Aj,[n−2] with ϕu(Aj,[n−2])
and set An−1,j += q/4.
Output: The resulting n× n array A.
26 / 28
Decoding
Input: n× n array A.
1 For j ∈ {n−2, n−1} do:
(a) if An−2,j ≥ q/4, replace A[n−2],j with ϕ−1u (A[n−2],j)
and set An−2,j −= q/4;
(b) if An−1,j ≥ q/4, replace Aj,[n−2] with ϕ−1u (Aj,[n−2])
and set An−1,j −= q/4.
2 For all j ∈ [n−2] do:If w(A[n],j) % 4 = 0 then do:
(a) set An−1,j = (An−1,j − 1) % q;
(b) replace A[n],j with ϕ−1u (A[n],j).
If An−1,j is odd, set An−1,j −= 1.
3 Flip all of the first n−2 rows of A for which Ai,n−1 is odd.
Output: Original data as laid out in encoder initialization.
27 / 28
Obrigado
Thank you
28 / 28