## Linear Locally Repairable Codes with Random Matrices

Toni Ernvall, Thomas Westerbäck and Camilla Hollanti

## Abstract

In this paper, locally repairable codes with all-symbol locality are studied. Methods to modify already existing codes are presented. Also, it is shown that with high probability, a random matrix with a few extra columns guaranteeing the locality property, is a generator matrix for a locally repairable code with a good minimum distance. The proof of this gives also a constructive method to find locally repairable codes.

## I. INTRODUCTION

## A. Locally Repairable Codes

In the literature, three kinds of repair cost metrics are studied: repair bandwidth [1], disk-I/O [2], and repair locality [3], [4], [5]. In this paper, the repair locality is the subject of interest.

Given a finite field F q with q elements and an injective function f : F k q → F n q , let C denote the image of f . We say that C is a locally repairable code (LRC) and has all-symbol ( r, δ ) -locality with parameters ( n, k, d ) , if the code C has minimum (Hamming) distance d and all the n symbols of the code have ( r, δ ) -locality. The concept was introduced in [6]. The j th symbol has ( r, δ ) -locality if there exists a subset S j ⊆ { 1 , . . . , n } such that j ∈ S j , | S j | ≤ r + δ -1 and the minimum distance of the code obtained by deleting code symbols corresponding the elements of { 1 , . . . , n } \ S j is at least δ . LRCs are defined when 1 ≤ r ≤ k . By a linear LRC we mean a linear code of length n and dimension k .

In [6] it is shown that we have the following bound for a locally repairable code C of length n , dimension k , minimum distance d and all-symbol ( r, δ ) -locality:

$$d \leq n - k - \left ( \left \lceil \frac { k } { r } \right \rceil - 1 \right ) \left ( \delta - 1 \right ) + 1$$

A locally repairable code that meets this bound is called optimal . For this reason we write d opt ( n, k, r, δ ) = n -k -(⌈ k r ⌉ -1 ) ( δ -1) + 1 .

Part of this work appeared at Global Wireless Summit 2014, Aalborg, Denmark.

T. Ernvall is with Turku Centre for Computer Science, Turku, Finland and with the Department of Mathematics and Statistics, University of Turku, Finland (e-mail:tmernv@utu.fi).

- T. Westerbäck is with Department of Mathematics and Systems Analysis, Aalto University (e-mail:thomas.westerback@aalto.fi).
- C. Hollanti is with Department of Mathematics and Systems Analysis, Aalto University (e-mail:camilla.hollanti@aalto.fi).

## B. Related Work

In the all-symbol locality case the information theoretic trade-off between locality and code distance for any (linear or nonlinear) code was derived in [7]. In [8], [9], [10] and [11] the existence of optimal LRCs was proved for several parameters ( n, k, r ) . Good codes with the weaker assumption of information symbol locality are designed in [12]. In [3] it was shown that there exist parameters ( n, k, r ) for linear LRCs for which the bound of Eq. (1) is not achievable. LRCs corresponding MSR and MBR points are studied in [13].

## C. Contributions and Organization

In this paper, we will study codes with all-symbol locality, when given parameters n , k , r , and δ . We will show methods to find smaller and larger codes when given a locally repairable code. At some occasions when the starting point is optimal, also the resulting code is optimal. We will also show that random matrices with a few non-random extra columns guaranteeing the repair property generate a linear LRCs with good minimum distance, with probability approaching to one as the field size approaches the infinity.

Section II gives two procedures to exploit already existing codes when building new ones. In that section we are restricted to the case δ = 2 . To be exact, it explains how we can build a new linear code of length n + 1 and dimension k + 1 with all-symbol repair locality r + 1 from an already existing linear code of length n and dimension k with all-symbol repair locality r such that the minimum distance remains the same. The same section also introduces a method to find a smaller code when given a code associated to parameters ( n, k, r ) . Namely the procedure gives a code of length n -1 , dimension k ′ ≥ k -1 , minimum distance d ′ ≥ d and all-symbol locality r .

In Section III we study random matrices with a few non-random extra columns guaranteeing the repair property. By using the ideas of Section IV it is shown that these random codes perform well with high probability. The proof of this is postponed to Section IV.

In Section IV we give a construction of almost optimal linear locally repairable codes with all-symbol locality. By almost optimal we mean that the minimum distance of a code is at least d opt ( n, k, r, δ ) -δ +1 .

## II. BUILDING CODES FROM OTHER CODES

## A. Definitions

In this section we will restrict us in the case δ = 2 and show how we can build a new linear code of length n +1 and dimension k +1 with all-symbol repair locality r +1 from an already existing linear code of length n and dimension k with all-symbol repair locality r such that the minimum distance remains the same. Also, we will show how to find a code for parameters ( n ′ = n -1 , k ′ ≥ k -1 , d ′ ≥ d, r ′ = r ) . That is, we will show how to enlarge codes and how to reduce codes.

First we need some definitions. Here q is a prime power and F q is a finite field with q elements. Let x y , ∈ F n q . Then d ( x y , ) is the Hamming distance of x and y . The weight of x is w ( x ) = d ( x 0 , ) . The sphere with radius s and center x is defined as

$$B _ { s } ( { \mathbf x } ) = \{ { \mathbf y } \in \mathbb { F } _ { q } ^ { n } \ | \ d ( { \mathbf x }, { \mathbf y } ) \leq s \}.$$

Define furthermore

$$V _ { q } ( n, s ) = | B _ { s } ( { \mathbf x } ) | = \sum _ { i = 0 } ^ { s } \binom { n } { i } ( q - 1 ) ^ { i }.$$

For V q ( n, s ) we have a trivial upper bound

$$V _ { q } ( n, s ) \leq ( 1 + s ) \binom { n } { \lfloor \frac { n } { 2 } \rfloor } q ^ { s }.$$

## B. Enlarging codes

If r = k then we always get an optimal linear LRC by an MDS code. Hence in this section we will assume that r &lt; k .

Theorem 2.1: Suppose we have a linear LRC for parameters ( n, k, d, r ) over a field F q with q &gt; d ( n glyph[floorleft] n 2 glyph[floorright] ) and r &lt; k . Then there exists a linear LRC for parameters ( n ′ = n +1 , k ′ = k +1 , d ′ = d, r ′ = r +1) over the same field.

Proof: Let C be a linear LRC for parameters ( n, k, d, r ) over a field F q with q &gt; d ( n glyph[floorleft] n 2 glyph[floorright] ) . Let G be its generator matrix, i.e. , G is k × n matrix such that its row vectors form a basis for C .

Suppose that k is maximal in the meaning that there does not exist a linear LRC for parameters ( n, k +1 , d, r ) over a field F q . This assumption can be made without loss of generality because we can remove extra base vectors from the resulting code if the dimension is too large. This does not reduce the minimum distance nor increase the repair locality.

Notice first that (1) gives

$$k + d \leq n - \left \lceil \frac { k } { r } \right \rceil + 2 \leq n - 2 + 2 = n$$

and hence

$$| C | V _ { q } ( n, d - 1 ) & \leq q ^ { k } \cdot ( 1 + d - 1 ) \binom { n } { \lfloor \frac { n } { 2 } \rfloor } q ^ { d - 1 } \\ & = d \binom { n } { \lfloor \frac { n } { 2 } \rfloor } q ^ { k + d - 1 } \\ & < q ^ { k + d } \\ & \leq q ^ { n }. \\ x i s a \text{ vector } x \in \mathbb { F } ^ { n } \text{ with distance at least } d \text{ to vectors of } C. \text{ Denote} h V G \text{ a new } ( k + 1 ) \times ( n + 1 )$$

Therefore there exists a vector x ∈ F n q with distance at least d to vectors of C . Denote by G 2 a new ( k +1) × ( n +1) matrix

$$\left ( \frac { \ G \, \left | \, \mathbf 0 ^ { t } } { \mathbf x \, \right | \, 1 } \right )$$

where 0 is an all-zero vector from F k q .

Denote by C 2 a code that G 2 generates. Clearly C 2 ⊆ F n +1 q and its dimension is k +1 . Its minimum distance is d : Let u = a y + z where a ∈ F q , y = ( x | 1) and z = ( z ′ | 0) with z ′ being a vector form C . Now if a = 0 we have

$$w ( \mathbf u ) = w ( \mathbf z ) = w ( \mathbf z ^ { \prime } ) \geq d$$

glyph[negationslash]

and if a = 0 we have

$$w ( \mathbf u ) = w ( a ^ { - 1 } \mathbf u ) = w ( \mathbf y + a ^ { - 1 } \mathbf z ) = d ( \mathbf y, - a ^ { - 1 } \mathbf z ) = d ( \mathbf x, - a ^ { - 1 } \mathbf z ^ { \prime } ) + d ( 1, 0 ) \geq d + 1.$$

The code C 2 has repair locality r +1 : In the matroid M 1 represented by G each i = 1 , . . . , n is contained in a circuit of size at most r +1 . Hence in the matroid M 2 represented by G 2 each i = 1 , . . . , n is contained in a circuit of size at most r +2 . And hence we chose k to be maximal we have that n +1 is contained in some circuit of size at most r +2 . This completes the proof.

The following example illustrates the strength of the above result in the case that r and k are close enough to each other.

Example 2.1: Suppose δ = 2 and let r ∈ [ k 2 , k ) and C be an optimal linear locally repairable code for parameters ( n, k, d, r ) over a field F q with q &gt; d ( n glyph[floorleft] n 2 glyph[floorright] ) . Because of the optimality we have

$$d = n - k - \left \lceil \frac { k } { r } \right \rceil + 2 = n - k.$$

Theorem 2.1 results a locally repairable code for parameters ( n ′ = n +1 , k ′ = k +1 , d ′ = d, r ′ = r +1) . This code is also optimal:

$$n ^ { \prime } - k ^ { \prime } - \left \lceil \frac { k ^ { \prime } } { r ^ { \prime } } \right \rceil + 2 = n - k - \left \lceil \frac { k + 1 } { r + 1 } \right \rceil + 2 = n - k = d = d ^ { \prime }.$$

Hence the proof of the above theorem gives a procedure to build optimal codes using already known optimal codes in the case that the size of the repair locality is at least half of the code dimension.

## C. Puncturing codes

Puncturing is a traditional method in classical coding theory. The next theorem shows that this method is useful also in the context of locally repairable codes.

Theorem 2.2: Suppose we have a locally repairable code C ⊆ F n q with all-symbol locality associated to parameters ( n, k, d, r ) . There exists a code C ′ ⊆ F n -1 q associated to parameters ( n ′ = n -1 , k , d , r ′ ′ ′ = ) r with k ′ ≥ k -1 and d ′ ≥ d . Also, if C is linear then we may assume that C ′ is linear.

Proof: Write

$$C _ { x } = \{ y \in C \ | \ y = ( x, z ) \text{ where } z \in \mathbf F _ { q } ^ { n - 1 } \}$$

## for x ∈ F q .

Clearly each element of C is contained in precisely one of the subsets C x with x ∈ F q . Hence there exists a ∈ F q such that

$$| C _ { a } | \geq \frac { | C | } { q } = q ^ { k - 1 }.$$

Define C ′ to be a code we get by puncturing the first component of C a , i.e. ,

$$C ^ { \prime } = \{ z \in \mathbf F _ { q } ^ { n - 1 } \ | \ ( a, z ) \in C _ { a } \}.$$

Now, C ′ is of size at least k , its minimum distance d ′ is the same as the minimum distance of C a , that is, at least the minimum distance of C and hence d ′ ≥ d , and C ′ has repair locality r . Indeed, suppose we need to repair the j th node. If the first node from the original system is not in the repair locality, then the repair can be made as in the original code. If the first node is in the repair locality, then we know that there is a stored into that node and hence the repair can be made using the other nodes from the original locality.

′

If C is linear then it is easy to verify that we can choose a to be 0 and in this case also C is linear.

Example 2.2: Suppose that C is an optimal code. It is associated with parameters ( n, k, d, r ) with equality

$$d = n - k - \left \lceil \frac { k } { r } \right \rceil + 2.$$

Let C ′ be a code formed from C using method explained in Theorem 2.2. Hence it is associated with parameters ( n ′ = n -1 , k ′ ≥ k -1 , d ′ ≥ d, r ′ = ) r . This code is optimal if

$$d = n - k - \left \lceil \frac { k - 1 } { r } \right \rceil + 2.$$

This is true if and only if

$$\left \lceil \frac { k } { r } \right \rceil = \left \lceil \frac { k - 1 } { r } \right \rceil,$$

i.e. , r does not divide k -1 .

## III. RANDOM MATRICES AS GENERATOR MATRICES FOR LOCALLY REPAIRABLE CODES

## A. The structure of the codes

We will study such linear codes that nodes are divided into such non-overlapping sets S , S 1 2 , . . . , S A that any node x ∈ S j can be repaired by any | S j \ { x }| -( δ -2) = | S j | -δ +1 nodes from the set S j . We also require that | S j | ≤ r + δ -1 and to guarantee the all-symbol repairing property, that ∪ A j =1 S j = { 1 , . . . , n } . Suppose we have a k -dimensional linear code and nodes, say, 1 2 , , . . . , s ( δ ≤ s ≤ r + δ -1 ) corresponding columns in the generator matrix, form a repair set S 1 . Denote the k × s matrix these columns define by G and write t = s -δ +1 . Intuitively it is natural to require that G is of maximal rank, that is, the rank of G is t .

By the locality assumption, any t columns can repair any other column, i.e. , any t columns span the same subspace as all the s columns. So we have

$$G = ( { \mathbf x } _ { 1 } | \dots | { \mathbf x } _ { t } | { \mathbf y } _ { 1 } | \dots | { \mathbf y } _ { \delta - 1 } )$$

where each y j can be represented as a linear combination of x 1 , . . . , x t and x 1 , . . . , x t are linearly independent. This gives that

$$G = ( \mathbf x _ { 1 } | \dots | \mathbf x _ { t } ) ( I _ { t } | B )$$

where I t is an identity matrix of size t and B is t × ( δ -1) matrix.

Let G ′ consist of some t columns of G and C consist of the corresponding columns of ( I t | B ) . It is easy to verify that

$$G ^ { \prime } = ( { \mathbf x } _ { 1 } | \dots | { \mathbf x } _ { t } ) C$$

and hence

$$\text{rank} ( C ) = \text{rank} ( ( \mathbf x _ { 1 } | \dots | \mathbf x _ { t } ) C ) = \text{rank} ( G ^ { \prime } ) = t.$$

Consider a submatrix of B corresponding rows i 1 , . . . , i l and columns j 1 , . . . , j l . It is easy to check that this submatrix is invertible if and only if a submatrix corresponding the columns { 1 , . . . , t } \ { i 1 , . . . , i l } and { t + j 1 , . . . , t + j l } of ( I t | B ) is invertible. This is invertible since the rank of the submatrix of G corresponding the same columns is t . Hence any square submatrix of B is invertible

Suppose that matrices ( I t 1 | B 1 ) , . . . , ( I t A | B A ) are of this form. It is natural to study codes with generator matrix of form

$$( ( { \mathbf x } _ { 1, 1 } | \dots | { \mathbf x } _ { 1, t _ { 1 } } ) ( I _ { t _ { 1 } } | B _ { 1 } ) | \dots | ( { \mathbf x } _ { A, 1 } | \dots | { \mathbf x } _ { A, t _ { A } } ) ( I _ { t _ { A } } | B _ { A } ) )$$

and ask how we should choose the vectors x 1 1 , , . . . , x 1 ,t 1 , . . . , x A, 1 , . . . , x A,t A such that the given code has the biggest possible minimum distance.

Notice also that since the rank of a generator matrix is k , we have

$$k & \leq \text{rank} \left ( ( \mathbf x _ { 1, 1 } | \dots | \mathbf x _ { 1, t _ { 1 } } ) ( I _ { t _ { 1 } } | B _ { 1 } ) \right ) + \dots + \text{rank} \left ( ( \mathbf x _ { A, 1 } | \dots | \mathbf x _ { A, t _ { A } } ) ( I _ { t _ { A } } | B _ { A } ) \right ) \\ & \leq t _ { 1 } + \dots + t _ { A }$$

and hence

$$k \leq n - A ( \delta - 1 ) \leq n - \left \lceil \frac { n } { r + \delta - 1 } \right \rceil ( \delta - 1 ).$$

## B. Random codes

In this subsection we study locally repairable codes generated by random matrices with a few extra columns consisting of linear combinations of the previous columns guaranteing the repair property. It is shown that this kind of code has a good minimum distance with probability approaching to 1 as the field size q approaches infinity. The proof of this is postponed to the subsection IV-B.

Theorem 3.1: Given parameters ( n, k, r, δ ) and A &gt; 0 with r &lt; k , n -A δ ( -1) ≥ k , and positive integers s 1 ≤ s 2 ≤ · · · ≤ s A such that n = ∑ A j =1 s j and δ ≤ | s j | ≤ r + δ -1 for all j = 1 , . . . , A . Assume also we have matrices B , B , . . . , B 1 2 A such that B j is such a ( s j -δ +1) × ( δ -1) matrix that all its square submatrices are invertible ( j = 1 , . . . , A ). Let x i,j be uniformly independent and identically distributed random variables over F q .

Consider matrices E F , and G that are defined as follows:

$$\text{ mauces $E$, $F$ and $v$ unit are ueinemu as nouws.} \\ E = \begin{pmatrix} x _ { 1, 1 } & x _ { 1, 2 } & \cdots & x _ { 1, n - A ( \delta - 1 ) } \\ x _ { 2, 1 } & x _ { 2, 2 } & \cdots & x _ { 2, n - A ( \delta - 1 ) } \\ \vdots & \vdots & \ddots & \vdots \\ x _ { k, 1 } & x _ { k, 2 } & \cdots & x _ { k, n - A ( \delta - 1 ) } \end{pmatrix} = ( E _ { 1 } | E _ { 2 } | \dots | E _ { A } ), & ( 4 ) \\ \vdots \cdots \cdots \cdots$$

where E j is a k × ( s j -δ +1) matrix,

$$F = ( E _ { 1 } B _ { 1 } | E _ { 2 } B _ { 2 } | \dots | E _ { A } B _ { A } )$$

and

$$G = ( E | F ).$$

With probability approaching to one as q →∞ , G is a generator matrix for a k -dimensional locally repairable code of length n with all-symbol ( r, δ ) -locality and minimum distance

$$d \geq n - k - z ( \delta - 1 ) + 1$$

where z is an integer with properties

$$\sum _ { j = 1 } ^ { z } ( s _ { j } - \delta + 1 ) \leq k - 1 \text{ and } \sum _ { j = 1 } ^ { z + 1 } ( s _ { j } - \delta + 1 ) > k - 1.$$

## IV. CODE CONSTRUCTION

## A. Construction

glyph[negationslash]

In this subsection we will give a construction for linear locally repairable codes with all-symbol locality over a field F q with q &gt; 2( rδ ) r 4 r +1 +4 r +1 ( n +2( rδ ) r 4 r +1 k -1 ) when given parameters ( n, k, r, δ ) such that n -⌈ n r + δ -1 ⌉ ( δ -1) ≥ k . We also assume that k &lt; n and n ≡ 1 2 , , . . . , δ -1 mod r + δ -1 . Write n = a r ( + δ -1)+ b with 0 ≤ b &lt; r + δ -1 .

We will construct a generator matrix for a linear code under above assumptions. The minimum distance of the constructed code is studied in Subsection IV-C.

Next we will build A = ⌈ n r + δ -1 ⌉ sets S , S 1 2 , . . . , S A such that each of them consists of r + δ -1 vectors from F k q except S A that consists of n -( A -1)( r + δ -1) vectors from F k q . Write

$$M = ( I _ { r } | B _ { r \times ( \delta - 1 ) } ) = \begin{pmatrix} a _ { 1, 1 } & \dots & a _ { 1, r + \delta - 1 } \\ \vdots & & \vdots \\ a _ { r, 1 } & \dots & a _ { r, r + \delta - 1 } \end{pmatrix}$$

where I r is an identity matrix of size r and B r × ( δ -1) is such r × ( δ -1) matrix that all its square submatrices are invertible. Define further

$$U _ { 0 } = \{ a _ { i _ { 1 }, i _ { 2 } } \ | \ 1 \leq i _ { 1 } \leq r \text{ and } 1 \leq i _ { 2 } \leq r + \delta - 1 \}$$

and glyph[negationslash]

$$U _ { m + 1 } = \left \{ a - \frac { b c } { d } \ | \ a, b, c, d \in U _ { m } \text{ and } d \neq 0 \right \} \cup U _ { m }$$

for m = 0 , . . . , r . We have U 0 ≤ rδ , | U m +1 | ≤ | U m | 4 and | U r +1 | ≤ ( rδ ) 4 r +1 .

First, choose any r linearly independent vectors g 1 1 , , . . . , g 1 ,r ∈ F k q . Let

$$\mathbf s _ { 1, r + j } = \sum _ { l = 1 } ^ { r } a _ { l, r + j } \mathbf g _ { 1, l }$$

for j = 1 , . . . , δ -1 . These r + δ -1 vectors form the set S 1 . Notice that these vectors correspond the columns of matrix

$$( g _ { 1, 1 } | \dots | g _ { 1, r } ) M.$$

This set has the property that any r vectors from this set are linearly independent.

Let 1 &lt; i ≤ A . Assume that we have i -1 sets S , S 1 2 , . . . , S i -1 such that when taken at most k vectors from these sets, at most r vectors from each set, these vectors are linearly independent. Next we will show inductively that this is possible by constructing the set S i with the same property.

Let g i, 1 be any vector such that when taken at most k -1 vectors from the already built sets, with at most r vectors from each set, then g i, 1 and these k -1 other vectors are linearly independent. This is possible since ( n k -1 ) q k -1 &lt; q k .

Write s ( h ) i,r + m = ∑ h l =1 a l,r + m i,l g for m = 1 , . . . , δ -1 and h = 1 , . . . , r and to shorten the notation, write s i,r + m = s ( r ) i,r + m for m = 1 , . . . , δ -1 .

Suppose we have j -1 vectors g i, 1 , . . . , g i,j -1 such that when taken at most k vectors from the sets S , S 1 2 , . . . , S i -1 or { g i, 1 , . . . , g i,j -1 , s ( j -1) i,r +1 , . . . , s ( j -1) i,r + δ -1 } , with at most r vectors from each set S , S 1 2 , . . . , S i -1 and at most j -1 vectors from the set { g i, 1 , . . . , g i,j -1 , s ( j -1) i,r +1 , . . . , s ( j -1) i,r + δ -1 } , then these vectors are linearly independent.

Let glyph[negationslash]

$$V _ { j } = \{ u _ { 1 } g _ { i, 1 } + \dots + u _ { j } g _ { i, j } \ | \ u _ { h } \in U _ { r + 1 } \text{ and } u _ { j } \neq 0 \} \bigcup \{ g _ { i, 1 }, \dots, g _ { i, j } \}.$$

Notice that V j is finite and to be precise, | V j | &lt; 2 | U r +1 | j ≤ 2( rδ ) j 4 r +1 .

Choose g i,j to be any vector with the following properties: when taken at most k -1 vectors from the sets S , S 1 2 , . . . , S i -1 or V j -1 , with at most r vectors from each set S , S 1 2 , . . . , S i -1 and at most j -1 vectors from the set V j -1 , then none of the vectors in V j \ { g i, 1 , . . . , g i,j -1 } does not belong to a subspace that these k -1 other vectors span. This is possible because there are at most ( n +2( rδ ) j 4 r +1 k -1 ) different possibilities to choose, each of the options span a subspace with q k -1 vectors, and since q is large we have 2( rδ ) j 4 r +1 +4 r +1 ( n +2( rδ ) j 4 r +1 k -1 ) q k -1 &lt; q k . Notice that u g i,j + v ∈ V (where V is some subspace) if and only if u g i,j ∈ -v + V .

To prove the induction step we have to prove the following thing: when taken at most k vectors from sets S , S 1 2 , . . . , S i -1 or { g i, 1 , . . . , g i,j , s ( j ) i,r +1 , . . . , s ( j ) i,r + δ -1 } , with at most r vectors from each set S , S 1 2 , . . . , S i -1 and at most j vectors from the set { g i, 1 , . . . , g i,j , s ( j ) i,r +1 , . . . , s ( j ) i,r + δ -1 } , then these vectors are linearly independent. Let 1 ≤ l ≤ j , v be a sum of at most k -l vectors from the sets S , S 1 2 , . . . , S i -1 with at most r vectors from each set. We will assume a contrary: We have coefficients s , . . . , s 1 l ∈ F q \ { 0 } such that:

$$\mathbf v + \sum _ { m = 1 } ^ { l } s _ { m } \sum _ { h = 1 } ^ { j } a _ { h, f _ { m } } \mathbf g _ { i, h } = 0$$

glyph[negationslash]

with f 1 ≤ · · · ≤ f l and f m ∈ { j +1 , j +2 , . . . , r } for m = 1 , . . . , l .

Write

$$\sum _ { m = 1 } ^ { l } s _ { m } \sum _ { h = 1 } ^ { j } a _ { h, f _ { m } } \mathbf g _ { i, h } = \sum _ { h = 1 } ^ { j } b _ { h } \mathbf g _ { i, h },$$

i.e. ,

$$\begin{pmatrix} b _ { 1 } \\ \vdots \\ b _ { j } \end{pmatrix} = \begin{pmatrix} a _ { 1, f _ { 1 } } & \dots & a _ { 1, f _ { l } } \\ \vdots & & \vdots \\ a _ { j, f _ { 1 } } & \dots & a _ { j, f _ { l } } \end{pmatrix} \begin{pmatrix} s _ { 1 } \\ \vdots \\ s _ { l } \end{pmatrix}.$$

glyph[negationslash]

Without loss of generality we may assume that a j,f l = 0 .

glyph[negationslash]

Let t be the smallest non-negative integer such that b j -t = 0 . Such t exists since the rank of ( a h,f i ) j × l is l and glyph[negationslash]

$$\begin{pmatrix} s _ { 1 } \\ \vdots \\ s _ { l } \end{pmatrix} \neq 0.$$

Hence we have

$$\begin{pmatrix} \mathbb { \langle } \nu \rangle \\ b _ { 1 } \\ \vdots \\ b _ { j - t } \\ 0 \\ \vdots \\ 0 \end{pmatrix} = \begin{pmatrix} b _ { 1 } \\ c _ { 1, f _ { 1 } } ^ { ( 1 ) } & \dots & c _ { 1, f _ { 1 - 1 } } ^ { ( 1 ) } & 0 \\ \vdots & & \vdots & \vdots \\ c _ { j - t, f _ { 1 } } ^ { ( 1 ) } & \dots & c _ { j - t, f _ { 1 - 1 } } ^ { ( 1 ) } & 0 \\ c _ { j - t + 1, f _ { 1 } } & \dots & c _ { j - t + 1, f _ { 1 - 1 } } ^ { ( 1 ) } & 0 \\ \vdots & & \vdots & \vdots \\ c _ { j - 1, f _ { 1 } } ^ { ( 1 ) } & \dots & c _ { j - 1, f _ { 1 - 1 } } ^ { ( 1 ) } & 0 \\ a _ { j, f _ { 1 } } & \dots & a _ { j, f _ { 1 - 1 } } & a _ { j, f _ { 1 } } \end{pmatrix} \begin{pmatrix} s _ { 1 } \\ \vdots \\ s _ { 1 } \end{pmatrix} \\ f _ { i } = \frac { a _ { h, f _ { 1 } } a _ { j, f _ { 1 } } } { a _ { i }, r } \in U _ { 1 }. \end{pmatrix} \begin{pmatrix} \mathbb { \langle } \nu \rangle \nu \\ \nu \rangle \nu \\ \nu \rangle \nu \\ s _ { l } \end{pmatrix} \begin{pmatrix} \mathbb { \langle } \nu \rangle \nu \\ \vdots \\ s _ { l } \end{pmatrix}$$

where c (1) h,f i = a h,f i -a h,f l a j,f i a j,f l ∈ U 1 .

This gives

$$& \text{This gives} \\ & \begin{pmatrix} b _ { 1 } \\ \vdots \\ b _ { j - t } \\ 0 \\ \vdots \\ 0 \end{pmatrix} = \begin{pmatrix} c _ { 1, f _ { 1 } } ^ { ( 1 ) } & \dots & c _ { 1, f _ { 1 - 1 } } ^ { ( 1 ) } \\ \vdots & & \vdots \\ c _ { j - t, f _ { 1 } } ^ { ( 1 ) } & \dots & c _ { j - t, f _ { 1 - 1 } } ^ { ( 1 ) } \\ c _ { j - t + 1, f _ { 1 } } & \dots & c _ { j - t + 1, f _ { 1 - 1 } } ^ { ( 2 ) } \\ \vdots & & \vdots \\ s _ { l - 1 } \end{pmatrix} \\ & \text{and by continuing the process} \end{pmatrix} \begin{pmatrix} s _ { 1 } \\ \vdots & & \vdots \\ s _ { j - t, f _ { 1 } } ^ { ( 2 ) } & \dots & c _ { 1, f _ { 1 - 1 } } ^ { ( 2 ) } & 0 \\ \vdots & & \vdots & \vdots \\ c _ { j - t, f _ { 1 } } ^ { ( 2 ) } & \dots & c _ { j - t, f _ { 1 - 1 } } ^ { ( 2 ) } & 0 \\ \vdots & & \vdots & \vdots \\ s _ { l - 1 } \end{pmatrix} \\ & \text{and by continuing the process}$$

and by continuing the process

$$\begin{array} { c c c c } & & \binom { b _ { 1 } } { \vdots } = \begin{pmatrix} c _ { 1, f _ { 1 } } ^ { ( t ) } & \dots & c _ { 1, f _ { l - t } } ^ { ( t ) } \\ \vdots & & \vdots \\ c _ { j - t, f _ { 1 } } ^ { ( t ) } & \dots & c _ { j - t, f _ { l - t } } ^ { ( t ) } \end{pmatrix} \begin{pmatrix} s _ { 1 } \\ \vdots \\ s _ { l - t } \end{pmatrix}$$

where c ( v ) h,f i = c ( v -1) h,f i -c ( v -1) h,f l -v +1 c ( v -1) j -v +1 ,f i c ( v -1) j -v +1 ,f l -v +1 ∈ U v for 2 ≤ v ≤ t .

glyph[negationslash]

We can continue the process ( i.e. , c ( v -1) j -v +1 ,f l -v +1 = 0 ) since the smallest non-invertible square matrix in the right lower corner of

$$\begin{pmatrix} a _ { 1, f _ { 1 } } & \dots & a _ { 1, f _ { l } } \\ \vdots & & \vdots \\ a _ { j, f _ { 1 } } & \dots & a _ { j, f _ { l } } \end{pmatrix} \\. \quad \cdot \cdot \cdot \cdot \end{pmatrix}$$

has the side length at least t +2 , if even exist. Indeed, suppose that matrices in the right lower corner with side length less than or equal to N are invertible and N is maximal. The value N is well-defined since the square matrix

with side length 1 is invertible. Assume contrary: N ≤ t and write

$$C = \begin{pmatrix} a _ { j - N + 1, f _ { 1 } } & \dots & a _ { j - N + 1, f _ { l - N } } \\ \vdots & & \vdots \\ a _ { j, f _ { 1 } } & \dots & a _ { j, f _ { l - N } } \end{pmatrix}.$$

Assume first that C is a zero matrix. Now

$$0 = \begin{pmatrix} a _ { j - N + 1, f _ { l - N + 1 } } & \dots & a _ { j - N + 1, f _ { l } } \\ \vdots & & \vdots \\ a _ { j, f _ { l - N + 1 } } & \dots & a _ { j, f _ { l } } \end{pmatrix} \begin{pmatrix} s _ { l - N + 1 } \\ \vdots \\ s _ { l } \end{pmatrix}$$

that is not possible.

Assume then that C is not a zero matrix. Clearly N is greater than or equal to the number of columns in

$$\begin{pmatrix} \cdot \dots & \cdot \dots & \cdot \dots & \cdot \dots & \cdot \\ \begin{pmatrix} a _ { 1, f _ { 1 } } & \dots & a _ { 1, f _ { l } } \\ \vdots & & \vdots \\ a _ { j, f _ { 1 } } & \dots & a _ { j, f _ { l } } \end{pmatrix} \\ \dots & \cdot \dots & \end{pmatrix}$$

corresponding the columns of B r × ( δ -1) . Hence

$$\begin{pmatrix} \dots \cdot \cdot _ { \prime } \\ a _ { j - N, f _ { l - N } } & \dots & a _ { j - N, f _ { l } } \\ \vdots & & \vdots \\ a _ { j, f _ { l - N } } & \dots & a _ { j, f _ { l } } \end{pmatrix} = ( \mathbf e _ { 1 } | \mathbf e _ { 2 } | \dots | \mathbf e _ { \epsilon } | B ^ { \prime } ) \\ \cdot \cdot \cdot \cdot \cdot \cdot _ { \cdot } \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \cdot \end{pmatrix}$$

where each e i has one 1 and other elements are zeros, and these 1 s are in different rows, and all the square submatrices of B ′ are invertible. Hence it is also invertible, against assumption. This proves that N ≥ t +1 .

glyph[negationslash]

Hence also c ( ) t j -t,f l -t = 0 , and we have

$$\text{$n$values $0$} \, \text{ are inveu$} \, \text{ in a iso inveu$} \, \text{, against asumipuion. $1$} \, \text{$pvoves $uai$} \, \leq \, + \, 1. \\ \text{ Hence also} \, \hat { \Phi } _ { 1 } ^ { ( t ) } \neq 0, \text{ and we have} \\ \left ( \begin{array} { c } b _ { 1 } \\ \left ( \begin{array} { c } c _ { 1, f } - \frac { c _ { 1 } ^ { ( t ) } } { c _ { 1, f } - \frac { c _ { 1, f } ^ { ( t ) } } { c _ { 1, f } ^ { ( t ) } } \\ c _ { 1, f } ^ { ( t ) } - \frac { c _ { 1, f } ^ { ( t ) } } { c _ { 1, f } ^ { ( t ) } } & \dots \\ c _ { 1, f } ^ { ( t ) } - \frac { c _ { 1, f } ^ { ( t ) } } { c _ { 1, f } ^ { ( t ) } } & \dots \\ \vdots \\ b _ { j - t } \end{array} \right ) & = \left ( \begin{array} { c } b _ { 1 } \\ \left ( \begin{array} { c } c _ { 1, f } - \frac { c _ { 1 } ^ { ( t ) } } { c _ { 1, f } ^ { ( t ) } } & \dots \\ c _ { 1, f } ^ { ( t ) } - \frac { c _ { 1, f } ^ { ( t ) } } { c _ { 1, f } ^ { ( t ) } } & \dots \\ \vdots \\ b _ { j - t } \end{array} \right ) & = \left ( \begin{array} { c } c _ { 1, f } - \frac { c _ { 1 } ^ { ( t ) } } { c _ { 1, f } ^ { ( t ) } } & \dots \\ c _ { 1, f } ^ { ( t ) } - \frac { c _ { 1, f } ^ { ( t ) } } { c _ { 1, f } ^ { ( t ) } } & \dots \\ c _ { 1, f } ^ { ( t ) } - \frac { c _ { 1, f } ^ { ( t ) } } { c _ { 1, f } ^ { ( t ) } } & \dots \\ \vdots \\ \vdots \\ \end{array} \right ) \\ \text{ and hence} \\ \end{array} \right ) \\ \, \stackrel { l } { \sim } \, \frac { j } { \nmid } \, \stackrel { j } { \nmid } \, \end{array} \right )$$

and hence

$$& \text{and hence} \\ & 0 = \text{v} + \sum _ { m = 1 } ^ { t } s _ { m } \sum _ { h = 1 } ^ { j } a _ { h, f _ { m } } \mathfrak { g } _ { i, h } \\ & = \text{v} + \sum _ { m = 1 } ^ { t - t - 1 } s _ { m } \sum _ { h = 1 } ^ { j - t - 1 } \left ( c _ { h, f _ { m } } ^ { ( t ) } - \frac { c _ { j - t, f _ { m } } ^ { ( t ) } c _ { h, f _ { m - t } } ^ { ( t ) } } { c _ { j - t, f _ { 1 - t } } ^ { ( t ) } } \right ) \mathfrak { g } _ { i, h } + \frac { s _ { 1 } c _ { j - t, f _ { 1 } } ^ { ( t ) } + \cdots + s _ { l - t } c _ { j - t, f _ { 1 - t } } ^ { ( t ) } } { c _ { j - t, f _ { l - t } } ^ { ( t ) } } \sum _ { h = 1 } ^ { j - t } c _ { h, f _ { 1 - t } } ^ { ( t ) } \mathfrak { g } _ { i, h }$$

which cannot be true since ( l - -t 1) + 1 ≤ j -t and ∑ j -t h =1 c ( ) t h,f l -t g i,h is chosen such that it does not belong to the subspace that v , ∑ j - -t 1 h =1 ( c ( ) t h,f 1 -c ( t ) j -t,f 1 c ( t ) h,f l -t c ( t ) j -t,f l -t ) g i,h , . . . , ∑ j - -t 1 h =1 ( c ( ) t h,f l - -t 1 -c ( t ) j -t,f l - -t 1 c ( t ) h,f l -t c ( t ) j -t,f l -t ) g i,h span, and s 1 c ( t ) j -t,f 1 + ··· + s l -t c ( t ) j -t,f l -t ( t ) = 0 since b j -t = 0 .

glyph[negationslash]

glyph[negationslash]

$$\psi _ { j - t, f _ { l - t } }$$

glyph[negationslash]

t Now, the sets S i consist of vectors { g i, 1 , . . . , g i,r , s i,r +1 , . . . , s i,r + δ -1 } for i = 1 , . . . , a . If b = 0 the set S A consists of vectors { g A, 1 , . . . , g A,b -δ +1 , s ( b -δ +1) i,r +1 , . . . , s ( b -δ +1) i,r + δ -1 } . The matrix G is a matrix with vectors from the sets S , S 1 2 , . . . , S A as its column vectors, i.e. ,

$$G = ( G _ { 1 } | G _ { 2 } | \dots | G _ { A } )$$

where for i = 1 , . . . , a , and

$$c$$

$$G _ { \mathbf j } = ( g _ { j, 1 } | \dots | g _ { j, r } | s _ { i, r + 1 } | \dots | s _ { i, r + \delta - 1 } )$$

$$G _ { A } = \left ( g _ { A, 1 } | \dots | g _ { A, b - \delta + 1 } | s _ { i, r + 1 } ^ { ( b - \delta + 1 ) } | \dots | s _ { i, r + \delta - 1 } ^ { ( b - \delta + 1 ) } \right )$$

glyph[negationslash]

if b = 0 .

To be a generator matrix for a code of dimension k , the rank of G has to be k . By the construction the rank is k if and only if n -A δ ( -1) ≥ k , and this is what we assumed.

Remark 4.1: Notice that the estimations for q are very rough in the construction. This is because we are mainly interested in the randomized case in which q →∞ .

Remark 4.2: Notice that in the above construction we could have chosen different matrices M = ( I r | B r × ( δ -1) ) for each G j . Also, the sets S j do not have to be of the given size. We only need to assume that

$$\sum _ { j } | S _ { j } | = n$$

and δ ≤ | S j | ≤ r + δ -1 . Then the corresponding matrix is of type ( I | S j |-δ +1 | B ( | S j |-δ +1) × ( δ -1) ) .

## B. Construction with random vectors

If we choose randomly the vector g i,j in the above construction the probability that we get a nonsuitable choice is at most

$$2 ( r \delta ) ^ { r 4 ^ { r + 1 } + 4 ^ { r + 1 } } { n + 2 ( r \delta ) ^ { r 4 ^ { r + 1 } } } { k - 1 } q ^ { k - 1 }.$$

The size of the whole vector space is q k . Hence the probability that the whole code is as in our construction, is at least

$$\left ( \frac { q ^ { k } - 2 ( r \delta ) ^ { r 4 ^ { r + 1 } + 4 ^ { r + 1 } } ( \tilde { \ m a t { k - 1 } } ^ { r + 2 ( r \delta ) ^ { r + 1 } } ) q ^ { k - 1 } } { q ^ { k } } \right ) ^ { n } = \left ( 1 - \frac { 2 ( r \delta ) ^ { r 4 ^ { r + 1 } + 4 ^ { r + 1 } } \left ( \tilde { \ m a t { k - 1 } } ^ { r + 2 ( r \delta ) ^ { r + 1 } } ) } { q } \right ) ^ { n } \to ( 1 - 0 ) ^ { n } = 1,$$

as

q

→∞

.

## C. The minimum distance of the constructed code

Next we will calculate the minimum distance of the constructed code with the assumption that the sets S j are of size s j ( j = 1 , . . . , A ), respectively. Assume also that s 1 ≤ · · · ≤ s A . Write

$$\mathbf G = \left ( E _ { 1 } | F _ { 1 } | E _ { 2 } | F _ { 2 } | \dots | E _ { A } | F _ { A } \right ),$$

where E j = ( g j, 1 | . . . | g j,s j -δ +1 ) and F j = ( s j,r +1 , . . . , s j,r + δ -1 ) for j = 1 , . . . , A .

$$\text{Let } e _ { 1 }, \dots, e _ { k } \in \mathbb { F } _ { q } \text{ be such elements that}$$

$$( e _ { 1 }, \dots, e _ { k } ) G$$

is a vector of minimal weight. By changing columns between E j s and F j s we may assume that the weight of

$$\left ( e _ { 1 }, \dots, e _ { k } \right ) \left ( E _ { 1 } | E _ { 2 } | \dots | E _ { A } \right )$$

is minimal, that is, it has the biggest possible amount of zeros. So it has k -1 zeros.

Suppose that

$$( e _ { 1 }, \dots, e _ { k } ) F _ { j }$$

glyph[negationslash]

has a zero, i.e. , its weight is not δ -1 . If ( e , . . . , e 1 k ) E j = 0 , then by changing columns between E j and F j we would get one more zero into ( e , . . . , e 1 k ) ( E E 1 | 2 | . . . | E A ) and that is not possible. Hence the number of zeros in ( e , . . . , e 1 k ) ( F 1 | F 2 | . . . | F A ) is at most z δ ( -1) where z is an integer with properties

$$\sum _ { j = 1 } ^ { z } ( s _ { j } - \delta + 1 ) \leq k - 1 \text{ and } \sum _ { j = 1 } ^ { z + 1 } ( s _ { j } - \delta + 1 ) > k - 1.$$

Hence the minimum distance of the code is

$$n - ( k - 1 ) - z ( \delta - 1 ).$$

Example 4.1: Suppose that n = A r ( + δ -1) and choose that s j -δ + 1 = r for all j = 1 , . . . , A . Then, z = ⌊ k -1 ⌋ and hence the minimum distance is

r

$$n - ( k - 1 ) - \left \lfloor \frac { k - 1 } { r } \right \rfloor ( \delta - 1 ) = n - k - \left ( \left \lceil \frac { k } { r } \right \rceil - 1 \right ) ( \delta - 1 ) + 1 = d _ { \text{opt} } ( n, k, r, \delta )$$

and hence the construction is optimal.

Suppose then that n = a r ( + δ -1) + b with 0 ≤ b &lt; r + δ -1 . If 0 &lt; b &lt; δ then using the above optimal code with extra b zero columns in the generator matrix we get a code with minimum distance d opt ( n -b, k, r, δ ) = d opt ( n, k, r, δ ) -b .

If b ≥ δ then choose s j = r + δ -1 for j = 1 , . . . , a and s a +1 = b . Now z = ⌈ k -b + δ -1 r ⌉ and hence the minimum distance is

$$n - k - \left \lceil \frac { k - b + \delta - 1 } { r } \right \rceil ( \delta - 1 ) + 1.$$

The distance d opt ( n, k, r, δ ) -( n -k -⌈ k -b + δ -1 ⌉ ( δ -1) + 1 )

r is

$$( \delta - 1 ) \left ( \left \lceil \frac { k - b + \delta - 1 } { r } \right \rceil - \left \lceil \frac { k } { r } \right \rceil + 1 \right ) \leq \delta - 1$$

and hence the code is again at least almost optimal.

## V. CONCLUSION

In this paper we have studied linear locally repairable codes with all-symbol locality. We have constructed codes with almost optimal minimum distance. Namely, the difference between largest achievable minimum distance of locally repairable codes and the minimum distance of our codes is maximally δ -1 . Instead of just giving a construction, it is shown that by using random matrices with a guaranteed locality property, such matrix generates an almost optimal LRC with probability approaching to one as the field size approaches to infinity.

Also, methods to build new codes for different parameters using already existing codes are presented. Namely, a method to find a bigger code and a method to find a smaller code are presented.

As a future work it is still left to find the exact expression of the largest achievable minimum distance of the linear locally repairable code with all-symbol locality when given the length n and the dimension k of the code and the locality ( r, δ ) .

## REFERENCES

- [1] A. G. Dimakis, P. B. Godfrey, Y. Wu, M. J. Wainwright, and K. Ramchandran, 'Network coding for distributed storage systems,' IEEE Transactions on Information Theory, vol. 56, no. 9, pp. 4539-4551, September 2010.
- [2] I. Tamo, Z. Wang, J. Bruck, 'MDS array codes with optimal rebuilding,' in 2011 IEEE International Symposium on Information Theory Proceedings (ISIT), pp. 1240-1244, 2011.
- [3] P. Gopalan, C. Huang, H. Simitci, S. Yekhanin, 'On the locality of codeword symbols,' IEEE Transactions on Information Theory, vol. 58, no. 11, pp. 6925-6934, 2011.
- [4] F. Oggier, A. Datta, 'Self-repairing homomorphic codes for distributed storage systems,' in INFOCOM, 2011 Proceedings IEEE, pp. 1215-1223.
- [5] D. S. Papailiopoulos, J. Luo, A. G. Dimakis, C. Huang, J. Li 'Simple regenerating codes: Network coding for cloud storage,' in INFOCOM, 2012 Proceedings IEEE, pp. 2801-2805.
- [6] N. Prakash, Govinda M. Kamath, V. Lalitha, P. Vijay Kumar, 'Optimal Linear Codes with a Local-Error-Correction Property,' 2012 IEEE International Symposium on Information Theory Proceedings (ISIT), pp. 2776-2780.
- [7] D. S. Papailiopoulos, A. G. Dimakis, 'Locally repairable codes,' 2012 IEEE International Symposium on Information Theory Proceedings (ISIT), pp. 2771-2775.
- [8] I. Tamo, D. S. Papailiopoulos, A. G. Dimakis, 'Optimal locally repairable codes and connections to matroid theory,' 2013 IEEE International Symposium on Information Theory Proceedings (ISIT), pp. 1814-1818.
- [9] W. Song, S. H. Dau, C. Yuen, T. J. Li, 'Optimal Locally Repairable Linear Codes,' arXiv:1307.1961 , 2013.
- [10] Ankit Singh Rawat, O. Ozan Koyluoglu, N. Silberstein, S. Vishwanath, 'Optimal Locally Repairable and Secure Codes for Distributed Storage Systems,' arXiv:1210.6954 [cs.IT] , 2012.
- [11] I. Tamo, A. Barg, 'A family of optimal locally recoverable codes,' arXiv:1311.3284 , 2013.
- [12] C. Huang, M. Chen, J. Lin, 'Pyramid codes: Flexible schemes to trade space for access efficiency in reliable data storage systems,' Sixth IEEE International Symposium on Network Computing and Applications, 2007, pp. 79-86.
- [13] Govinda M. Kamath, N. Prakash, V. Lalitha, P. Vijay Kumar, 'Codes with Local Regeneration,' arXiv:1211.1932 [cs.IT] , 2012.
Toni Ernvall Thomas Westerbäck Camilla Hollanti
Linear Locally Repairable Codes with Random Matrices
In this paper, locally repairable codes with all-symbol locality are studied.
Methods to modify already existing codes are presented. Also, it is shown that
with high probability, a random matrix with a few extra columns guaranteeing
the locality property, is a generator matrix for a locally repairable code with
a good minimum distance. The proof of this gives also a constructive method to
find locally repairable codes.