arXiv:1110.2557v1 [cs.IT] 12 Oct 2011 oe htcretanme ferr htgoswith grows that errors of number a correct that codes eoyclsta upr h re of constant order the any support for that cells memory C oe eoti oe correcting t codes required obtain bin as from we instance, complexity For codes decoding metric. space. same Hamming BCH and Kendall the encoding the in the errors simple essentially in correct afford errors of construct correct algorithms we to that modified Codes error-correct be particu conventional which In can in parameters. ways codes code of number of a range show broad we a cover that tions o ytm eerh nvriyo ayad olg Park College Maryland, of ECE University of § Research, 02139, Department Systems the MA, at for while Cambridge, done Technology, Research [email protected]. of Institute sachusetts osrcino aknso h pc fpruain equip impulse distance. as of tau space well Kendall invo the the modulation as of with rank devices packings Modeling of memory lines. construction flash transmission in in noise errors correct to h oko h rttoatoswsspotdb S rnsCC grants NSF by supported was ∗ DMS0807411. authors Since and two first CCF0830699, reasons. the of of other work The charge or the devices of ageing drift by the caused by st cells the affected of the is reliability the in which concerns management t information issue of related data rewriting A of efficient [12]. for data issue encoding the called data mechanism requiring raises erase a memory, This using must cells erasure. one an of of charge block block charge large the a the decrease overwrite increase to and is to while memory possible cell, the is individual into it that procedure in write asymmetric The two with levels. cells injecting charge multi-level devic more by the supports form technology data that current cells store The memory in devices, levels varying manage- memory of data charges memorie flash Non-volatile as particular [13]–[15]. well [5], in as [3], memories models in various ment in correction includ devices, error memory non-volatile for problems coding to nt egh n ieeape frn ouaincdswit codes modulation rank of examples parameters. give constructing specific for and of possibilities the length, number of which scaling number finite the a optimal for list and the codes we messages approaches Finally, modulation errors of rank Kendall number of correctable the family between a trade-off to rise gives ayn ae,from rates, varying ouain rnpstos edl a itne ryma Gray distance, tau Kendall transpositions, modulation, usa cdm fSine ocw Russia. Moscow, Science, a of Inform Academy of Russian Problems for Institute Laboratory, [email protected] e-mail: Mathematical USA, 20742, Park, College Maryland, rne -al [email protected]. e-mail: France, eateto C n nttt o ytm eerh Unive Research, Systems for Institute and ECE of Department eateto ESadRsac aoaoyo Electronics, of Laboratory Research and EECS of Department odaxMteaisIsiue M 21 nvriyo Bo of University 5251, UMR Institute, Mathematics Bordeaux epeetsvrlgnrlcntutoso oe npermut in codes of constructions general several present We Abstract ne Terms Index eetycnieal teto nteltrtr a devo was literature the in attention considerable Recently Rn ouaini a fecdn information encoding of way a is modulation —Rank osrcin fRn ouainCodes Modulation Rank of Constructions Fahmmr,cdsi emttos rank permutations, in codes memory, —Flash t 1 = Θ( .I I. n , ) 2 NTRODUCTION . . . . , to Θ( n raMazumdar Arya eas osrc aiisof families construct also We 2 ) n forconstructions our of One . n t ! / edl rosin errors Kendall (log to Transmission, ation 2 n 04,USA. 20742, , n Dobrushin and , !) ∗ S,e-mail: USA, t lxne Barg Alexander , n Institute and messages, F0916919, oe of codes st of rsity rdeaux, p n ored rate. Mas- lves ped ary ing lar, ing ted he or a- at e. s, n h o eastof set a be emttos o ntne(,,)rfr otepermutati the to refers (2,1,3) instance for permutations: ain of tations h eodoefloe ytefis n hntetidcell. third the then successive set them and the applying first to by multiplied the be by can followed Permutations one second the ,σ π, hti a ercvrdfo rositoue ytedrift the by introduced so errors charges. cell permutations from the into recovered of data be (decrease) of can encoding it as that formulated be of can set the on permutation emtto a nivre denoted inverse, Eve an right). the has on permutation act permutations that assume we elsewhere dniypermutation. identity lmnayerrocr hntecag fcell of charge the when occurs error elementary eaiernso elcagsi lc of block a in charges cell sche of modulation rank ranks the Relative in information of errors storage of reliable source main of [22]. the memories Drift also phase-change is modulation. multilevel-cell cells in rank memory and for in model error resistance problems same coding the introduced neighboring nois considered impulse [6] the modeling Kurz but of to and devoted substantially magnitude Chadwick work relative signal earlier an the the In on signals. of effect value less the impul has noise to changes subject similar that channels A over noise memories. transmission flash in in arises model data [14], of al. coding the et correcting use Jiang to ideas, ris suggested as these the charge [15] reducing on the thereby Based of ranking, overprogramming. value desired of the particular have any we reach becau as to data long the need of val not absolut rewriting relative do the the we in simplifies than also information charges rather Storing the of charges. cells cell adjacent of of values track value er by for speed, relative accounted different adequately the at are occur data the may in cells introduced different in drift the ee ftecag ftecl ihrn n mle than smaller one rank with cell the of of rank charge the the of level oiin fpiws daeteeet eurdt change to required elements adjacent σ pairwise of positions let hserrcrepnst h xhnigo h oain of locations the of exchanging elements the to corresponds error this σ oecag h oain ftetohgetrne element highest-ranked two the of i.e., locations the exchange to 213 123 oaohrpermutation another to odfieteerrpoesfral,let formally, process error the define To Let oiae yteapiaint ahmmre,w consider we memories, flash to application the by Motivated codnl,dfiethe define Accordingly, into σ  πσ ∈ . (3 = § eern otedsuso fcag eeso cells, of levels charge of discussion the to Referring σ S π. (1 = n ilsZ´emor Gilles and n σ [ ( = , n , [ ( 1 eoeby Denote n j ] j eut in results , aeyteato ftepermutation the of action the namely , n fthe If . , ] (2 ) 4 . 3 σ , and , , lmnsadcnie h set the consider and elements nti ae eueaoeln oainfor notation one-line a use we paper this In 2) (1) 4 1 , , hnteefc fteerror the of effect the then 2) 3) σ , . . . , σ n . ( boki noe noapermutation, a into encoded is -block j en httehgetcagdcl is cell highest-charged the that means i X 1) + 7→ n π ( edl a distance tau Kendall n akmdlto scheme modulation rank n ( = stemnmmnme ftrans- of number minimum the as σ )) a lmns u rbe therefore problem Our elements. ntepruain o instance, For permutation. the in ( π eapruainof permutation a be ( S i )) n d , i , τ σ 1 = ) − 1 h ercsaeof space metric the and , n. , . . . , [ n π = ] n (2 = S d e el en a define cells n τ { j eoe the denotes ( 1 ,π σ, fpermu- of πσ, Hr and (Here assthe passes , , o error- for 1 2 [ , n n , . . . 3 ) where ] , . from 4) rors me. ues ing An the on σ, se ry se ly e, is s, k } e 1 2

permutations on n elements equipped with the distance dτ . exists a family of rank modulation codes that correct a constant The Kendall metric was studied in statistics [16] where it was number of errors and have size within a constant factor of the introduced as a measure of proximity of data samples, as well upper (sphere packing) bound. as in combinatorics and coding theory [3], [10]. The Kendall Regarding the problem of explicit constructions, apart from metric also arises naturally as a Cayley metric on the a construction in [15] of codes that correct one Kendall error, Sn if one takes the adjacent transpositions as its generators. no other code families for the Kendall distance are presently The Kendall distance is one of many metrics on per- known. Addressing this issue, we provide several general mutations considered in the literature; see the survey [9]. constructions of codes that cover a broad range of parameters Coding for the Hamming metric was considered recently in in terms of the code length n and the number of correctable [7] following the observation in [25] that permutation arrays errors. We present constructions of rank modulation codes that are useful for error correction in powerline communication. correct a given number of errors as well as several asymptotic Papers [20], [23], [24] considered coding for the ℓ∞ distance results that cover the entire range of possibilities for the scaling on permutations from the perspective of the rank modulation of the number of errors with the code’s length. Sect. II we scheme. Generalizations of Gray codes for rank modulation present a construction of low-rate rank modulation codes that are considered in [26], while an application of LDPC codes form subcodes of Reed-Solomon codes, and can be decoded to this scheme is proposed in [27]. using their decoding algorithms. In Sect. III we present another An (n, d) code is a set of permutations in S such construction that gives rank modulation codes capable of C ⊂ Xn n that the minimum distance dτ separating any two of them correcting errors whose multiplicity can be anywhere from 1+ǫ is at least d. The main questions associated with the coding a constant to O(n ), 0 <ǫ< 1/2, although the code rate is problem for the Kendall space n are to establish the size below the optimal rate of (4). Relying on this construction, we of optimal codes that correct aX given number of errors and, also show that there exist sequences of rank modulation codes more importantly, to construct explicit coding schemes. In our derived from binary codes whose parameters exhibit the same previous work [3] we addressed the first of these problems, scaling rate as (4) for any 0 <ǫ< 1. Moreover, we show analyzing both the finite-length and the asymptotic bounds on that almost all linear binary codes can be used to construct n codes. Since the maximum value of the distance in n is 2 , rank modulation codes with this optimal trade-off. Finally, we this leaves a number of possibilities for the scalingX rate of the present a third construction of rank modulation codes from  distance for asymptotic analysis, ranging from d = O(n) to codes in the Hamming space that correct a large number of d = Θ(n2). Define the rate of the code errors. If the number of errors grows as Θ(n2), then the rate of the codes obtained from binary codes using this construction R( ) = log / log(n!) (1) −1 C |C| attains the optimal scaling of O(log n). Generalizing this (all logarithms are base 2 unless otherwise mentioned) and let construction to start from nonbinary codes, we design families of rank modulation codes that scale optimally (in the sense of R(n, d)= max R( ) (2) the above definition) for all values of , . C⊂Xn C ǫ 0 <ǫ< 1 C (d) = lim R(n, d) (3) Finally, Sect. IV contains some examples of codes obtained n→∞ using the new constructions proposed here. where the maximum in (2) is over all codes with distance d. Our constructions rely on codes that correct conven- We have the following result. ≥ tional (Hamming) errors, converting them into Kendall-error- Theorem 1: [3] The limit in (3) exists, and correcting codes. For this reason, the proposed methods can be applied to most families of codes designed for the Hamming if 1 d = O(n) distance, thereby drawing on the rich variety of available con- C (d)= 1 ǫ if d = Θ(n1+ǫ), 0 <ǫ< 1 (4)  − structions with their simple encoding and decoding algorithms. 0 if d = Θ(n2). II. CONSTRUCTION I: RANK MODULATION CODES FROM Moreover,  PERMUTATION O(log−1 n) if d = Θ(n2) Our first construction of rank modulation codes is alge- R(n, d)= −1 m (1 O(log n) if d = O(n). braic in nature. Let q = p for some prime p and let − F = α , α ,...,α be the finite field of q elements. A q { 0 1 q−1} We remark [3] that the equality C (d)=1 ǫ holds under a g(x) Fq[x] is called a permutation polynomial 1+ǫ− ∈ slightly weaker condition, namely, d = n α(n), where α(n) if the values g(a) are distinct for distinct values of a Fq grows slower than any positive power of n. [19, Ch. 7]. ∈ Equation (4) suggests the following definition. Let us say Consider the evaluation map f (f(α0),...,f(αq−1)) that an infinite family of codes scales optimally if there exists which sends permutation polynomials7→ to permutations of n ǫ (0, 1) such that, for any positive α, β, all codes of the elements. Evaluations of permutation polynomials of degree ∈ family of length n larger than some n0, have rate at least k form a subset of a q-ary Reed-Solomon code of dimension 1 ǫ β and minimum distance Ω(n1+ǫ−α). k≤+1. Reed-Solomon codes are a family of error-correcting −The− proof of Theorem 1 relied on near-isometric embed- codes in the Hamming space with a number of desirable dings of n into other metric spaces that provide insights into properties including efficient decoding. For an introduction to the asymptoticX size of codes. We also showed [3] that there them see [21, Ch. 10]. 3

At the same time, evaluating the size of a rank modulation vectors in A as permutations (for that, we fix some F∗ code constructed in this way is a difficult problem because between [n] and q , which will be implicit in the subsequent it is hard to compute the number of permutation polynomials discussion). We can have n = q rather than n = q 1 if of a given degree. In this section we formalize a strategy for desired: for that we add the zero field element in the− first constructing codes along these lines. This does not result in position of the (q 1)-tuples of A, and the construction below very good rank modulation codes; in fact, our later combina- readily extends. − torial constructions will be better in terms of the size of the The idea behind the construction is quite simple: the set A codes with given error-correcting capabilities. Nonetheless, the is a subset of a Reed-Solomon code that corrects t Hamming construction involves some interesting observations which is errors. Every Kendall error is a transposition, and as such, why we decided to include it. affects at most two coordinates of the codeword of τ . A polynomial over Fq is called linearized of degree ν if it C Therefore the code τ can correct up to t/2 errors. By handling has the form C ν Kendall errors more carefully, we can actually correct up to i (x)= a xp t errors. The main result of this part of our work is given by L i i=0 the following statement. X Note that a linearized polynomial of degree ν has degree pν Theorem 3: The code τ has length n = q 1 and ⌊log (n−2t−1)C⌋ − when viewed as a standard polynomial. size at least q p . It corrects all patterns of up to t Kendall errors in the rank modulation scheme under a Lemma 2: The number of linearized polynomials over Fq of degree less than or equal to ν that are permutation polyno- decoding algorithm of complexity polynomial in n. F Proof: It is clear that τ = A , and from Lemma 2 mials in q is at least |C | | | A q⌊logp(n−2t−1)⌋. 1 1 ν+1 ν | |≥ F∗ 1 + q q . Let σ = (a1,a2,...,ai,ai+1,...,an), where aj q , 1 − p 1 q(p 1) ≥ ∈ ≤ − − j n, be a permutation in n (with the implied bijection be-   ≤ F∗ X′ Proof: The polynomial (x) acts on Fq as a linear tween [n] and q ) and let σ = (a1,a2,...,ai+1,ai,...,an) homomorphism. It is injectiveL if and only if it has a trivial be a permutation obtained from σ by one Kendall step (an kernel, in other words if the only root of (x) in F is 0. adjacent transposition). We have L q Hence, (x) is a permutation polynomial if and only if the ′ L σ σ = (0,..., 0, θ, θ, . . . , 0) only root of (x) in Fq is 0. − − The total numberL of linearized polynomials of degree up to where θ = a a F∗. i − i+1 ∈ q ν is qν+1. We are going to prove that at least a (1 1 + Let − p−1 1 0 0 0 1 ) proportion of them are permutation polynomials. To q(p−1) 1 1 0 ·· 0 show this, choose the coefficients ai, 0 i ν of (x) =  ··  ν pi ≤ ≤ L 1 1 1 0 aix uniformly and randomly from Fq. For a fixed α P = ·· i=0 ∈   F∗, the probability that (α)=0 is 1/q. Furthermore, the set  ······  Pq L   of roots of a linearized polynomial is an Fp-vector space [21,  ······   1 1 1 1  p.119], hence the set of non-zero roots is a multiple of p 1.  ··    The number of 1-dimensional subspaces of F over F is q−−1 . be an n n matrix. Note that q p p−1 × The probability that one of these sets is included in the set of P (σ σ′)T = (0,..., 0, θ, 0,..., 0)T . roots of (x) is, from the union bound, − L q 1 1 This means that multiplication by the accumulator matrix P Pr( α F∗ : (α) =0) − . converts one adjacent transposition error into one Hamming ∃ ∈ q L ≤ p 1 · q − error. Extending this observation, we claim that if dτ (σ, π) t Hence, the probability that (x) is a permutation polynomial with π being some permutation, and any t n , then≤ the L q−1 2 is greater than or equal to 1 . T ≤ − q(p−1) Hamming weight of the vector P (σ π) is not more than t. Here we again take σ and π to be vectors− with elements from F∗ F∗ A. Code construction q with the implied bijection between [n] and q . Now let (x) be a linearized permutation polynomial and We use linearized permutation polynomials of Fq to con- let 1, α, α2,...,αL q−2 be the elements of F∗ for some choice struct codes in the space n. Note that a linearized polynomial q (x) always maps zero toX zero, so that when it is a permutation of the primitive element α. Let L polynomial it can be considered to be a permutation of the σ = ( (1), (α), (α2),..., (αq−2)). F F∗ L L L L elements of q and also of the elements of q . Let t be a positive integer and let ν = log (n 2t 1) . Let be the Since (a + b)= (a)+ (b), we have ⌊ p − − ⌋ Pt L L L set of all linearized polynomials of degree ν that permute P σT = ( (β ), (β ), (β ),..., (β ))T F F≤n 0 1 2 q−2 q. Set n = q 1 and define the set A q L L L L − ⊂ where F∗ i A = ( (a),a q ), t { L ∈ L∈P } β = αj , i =0, 1,...,q 2. i − to be the set of vectors obtained by evaluating the polynomials j=0 in at the points of F∗. Form a code by writing the X Pt q Cτ 4

It is clear that βi = 0, 0 i n 1 and also βi1 = βi2 regular of degree n 1. At the same time it is not distance- 6 ≤ ≤ − T6 − for 0 i1 < i2 n 1, Therefore, the vector P σ is a regular, and so the machinery of algebraic combinatorics does ≤ ≤ − F∗ permutation of the elements of q . At the same time, it is the not apply to the analysis of the code structure. The diameter , n evaluation vector of a polynomial of degree n 2t 1. of the space n equals N 2 and is realized by pairs of We conclude that the set P σT , σ A is a subset≤ − of vectors− opposite permutationsX such as (1, 2, 3, 4) and (4, 3, 2, 1). { ∈ }  of an (extended) Reed-Solomon code of length n, dimension The main tool to study properties of dτ is provided by n 2t and distance 2t+1. Any t errors in a codeword of such the inversion vector of the permutation. An inversion in a − a code can be corrected by standard RS decoding algorithms permutation σ Sn is a pair (i, j) such that i > j and −1 −1 ∈ in polynomial time. σ (j) > σ (i). It is easy to see that dτ (σ, e) = I(σ), the The following decoding algorithm of the code τ corrects total number of inversions in σ. Therefore, for any two permu- C −1 −1 any t Kendall errors. Suppose σ A is read off from memory tations σ1, σ2 we have dτ (σ1, σ2) = I(σ2σ ) = I(σ1σ ). ∈ 1 2 as σ1. In other words, 2 −1 −1 Decoding algorithm (Construction I): dτ (σ, π) = (i, j) [n] : i = j, π (i) > π (j), |{ ∈ 6 T −1 −1 • Evaluate z = P σ . σ (i) < σ (j) . 1 }| • Use a Reed-Solomon decoding algorithm to correct up To a permutation σ S we associate an inversion vector to t Hamming errors in the vector z, obtaining a vector n x , [0, 1] [0,∈2] [0,n 1], where x (i) = y (if the Reed-Solomon decoder returns no results, the σ n σ j ∈[ Gn]: j σ−1(i + 1)− ,i =1,...,n 1. algorithm detects more than t errors). |{ ∈ }| − −1 T In words, xσ(i),i =1,...,n 1 is the number of inversions • Compute σ = P y , i.e., in σ in which i +1 is the first− element. For instance, we have σ = y y , 1 i n 1; σ = y . σ x i i+1 − i ≤ ≤ − n n σ 216437598 10103101 The correctness of the algorithm follows from the construction. It is well known that the mapping from permutations to the Namely, if dτ (σ, σ1) t, then y corresponds to a transformed ≤ T space of inversion vectors is bijective, and any permutation version of σ, i.e., y = P σ . Then the last step of the decoder 1 correctly identifies the permutation σ. can be easily reconstructed from its inversion vector . Clearly, Some examples of code parameters arising from this theo- n−1 rem are given in Sect. IV. I(σ)= xσ(i). (5) i=1 We note an earlier use of permutation polynomials for X constructing permutation codes in [7]. At the same time, Denote by J : S the inverse map from to S , Gn → n Gn n since the coding problem considered in that paper relies on so that J(xσ) = σ. The correspondence between inversion the Hamming metric rather than the Kendall tau distance, its vectors and permutations was used in [15] to construct rank results have no immediate link to the above construction. modulation codes that correct one error. For the type of errors that we consider below we introduce III. CONSTRUCTION II: RANK MODULATION CODES FROM the following ℓ1 distance function on n : G THE GRAY MAP n−1 d (x, y)= x(i) y(i) , (x, y ) (6) In this section we present constructions of rank modulation 1 | − | ∈ Gn i=1 codes using a weight-preserving embedding of the Kendall X space n into a subset of integer vectors. To evaluate the error- where the computations are performed over the integers, and correctingX capability of the resulting codes, we further link write x for the corresponding weight function (this is not a k k codes over integers with codes correcting Hamming errors. properly defined norm because n is not a linear space). Recall −1 G that dτ (σ, π) = I(πσ ); hence the relevance of the ℓ1 dis- A. From permutations to inversion vectors tance for our problem. For instance, let σ1 = (2, 1, 4, 3), σ2 = (2, 3, 4, 1), then xσ1 = (1, 0, 1), xσ2 = (1, 1, 1). To compute We begin with a description of basic properties of the −1 the distance dτ (σ1, σ2) we note that σ1 = σ1 and so distance dτ such as its relation to the number of inversions −1 in the permutation, and weight-preserving embeddings of S I(σ2σ1 )= I((1, 4, 3, 2)) = (0, 1, 2) =3. n k k into other metric spaces. Their proofs and a detailed discussion Observe that the mapping σ xσ is a weight-preserving are found for instance in the books by Comtet [8] or Knuth → bijection between n and the set n. At the same time, [17, Sect. 5.1.1]. the above exampleX shows that this mappingG is not distance The distance dτ is a right-invariant metric which means preserving. Indeed, dτ (σ1, σ2)=3 while d1(xσ , xσ )=1. that d (σ , σ ) = d (σ σ, σ σ) for any σ, σ , σ S 1 2 τ 1 2 τ 1 2 1 2 ∈ n However, a weaker property pointed out in [15] is true, where the operation is the usual multiplication of permutations. namely: Therefore, we can define the weight of the permutation σ as its distance to the identity permutation e = (1, 2,...,n). 1There is more than one way to count inversions and to define the inversion vector: for instance, one can define xσ(i) = |{j : j ≤ i, σ(j) > σ(i + Because of the invariance, the Cayley graph of Sn (i.e., 1)}|,i = 1,...,n − 1. In this case, given σ = (2, 1, 6, 4, 3, 7, 5, 9, 8) we the graph whose vertices are indexed by the permutations and would have xσ = (1, 0, 2, 1, 2, 0, 0, 1). The definition in the main text is whose edges connect permutations one Kendall step apart) is better suited to our needs in that it supports Lemma 4 below. 5

Lemma 4: Let σ1, σ2 Sn, then Note the “reflective” nature of the map: the last 2 bits of the ∈ second block of four are a reflection of the last 2 digits of the d (σ , σ ) d (x , x ). (7) τ 1 2 ≥ 1 σ1 σ2 first block with respect to the horizontal line; the last 3 bits Proof: Let σ(m), σ(m + 1) be two adjacent elements in of the second block of eight follow a similar rule, and so on. a permutation σ. Let i = σ(m), j = σ(m + 1) and suppose This property, easy to prove from (8), will be put to use below that i < j. Form a permutation σ′ which is the same as σ (see Prop. 9). ′ ′ ′ except that σ (m)= j, σ (m +1) = i, so that dτ (σ, σ )=1. Now, for i =2, . . . , n, let The count of inversions for which i is the first element is unchanged, while the same for has increased by one. We j mi = log i , then have x ′ (k) = x (k), k = j and x ′ (j) = x (j)+1. ⌊ ⌋ σ σ 6 σ σ Thus, d1(xσ′ , xσ)=1, and the same conclusion is clearly and let true if i > j. mi ψi : 0, 1 [0,i 1] Hence, if the Kendall distance between σ1 and σ2 is 1 then { } → − the distance between the corresponding inversion vectors −1 ℓ1 be the inverse Gray map ψi = φ . Clearly ψi is well defined; ′ i is also 1. Now consider two graphs G and G with the same it is injective but not surjective for most i’s since the size of vertex set Sn. In G there will be an edge between two vertices its domain is only 2mi . if and only if the Kendall distance between them is 1. On the Proposition 6: Suppose that x, y 0, 1 mi . Then other hand there will an edge between two vertices in G′ if ∈{ } and only if the ℓ1 distance between corresponding inversion ψi(x) ψi(y) dH (x, y), (9) vectors is 1. We have just shown that the set of edges of G | − |≥ ′ is a subset of the set of edges of G . The Kendall distance where dH denotes the Hamming distance. between two permutations is the minimum distance between Proof: This follows from the fact that if u, v are two them in the graph G. A similar statement is true for the ℓ1 integers such that u v =1, then their Gray images satisfy ′ | − | distance with the graph G . dH (φ(u), φ(v)) = 1. If the number are such that u < v and This proves the lemma. u v = d, then by the triangle inequality, We conclude as follows. | − | Proposition 5: If there exists a code in with ℓ dH (φ(u), φ(v)) dH (φ(u), φ(u + 1)) C Gn 1 ≤ distance d then the set τ := J(x): x forms a rank + + d (φ(v 1), φ(v)) C { ∈ C} ··· H − modulation code in Sn of cardinality with Kendall distance = d at least d. |C|

B. From inversion vectors to the Hamming space via Gray Consider a vector x = (x2 x3 ... xn), where xi | | | ∈ Map 0, 1 mi , i = 2, . . . , n. The dimension of x equals m = { n } i=2 mi log n!, or more precisely We will need the Gray map which is a mapping φs from the ≈ s s ordered set of integers [0, 2 1] to 0, 1 with the property P mn−1 − { } that the images of two successive integers differ in exactly m = (2j+1 2j )j + m (n +1 2mn ) − n − one bit. Suppose that bs−1bs−2 ...b0, bi 0, 1 , 0 i < s, j=1 ∈ { } s ≤ X is the binary representation of an integer u [0, 2 1]. Set mn−1 ∈ − j mn by definition bs =0 and define φs(u) = (gs−1,gs−2,...,g0), = j2 + m (n +1 2 ) n − where j=1 X mn mn = (mn 2)2 +2+ mn(n +1 2 ) gj = (bj + bj+1) (mod 2) (j =0, 1,...s 1) (8) − − mn+1 − = (n + 1)mn 2 +2. (note that for s 4 there are several ways of defining maps − from integers to≥ binary vectors with the required property). On the first line of this calculation we used the fact that among j+1 j the numbers mi there are exactly 2 2 numbers equal to j Example: The Gray map for the first 10 integers looks as − j j j+1 follows: for all j n 1, namely those with i =2 , 2 +1,..., 2 ≤ − mn − 1. The remaining (n + 1) 2 numbers equal mn. 00000000 00000000 − 0| For a vector x 0, 1 m let 1| 00000001 00000001 ∈{ } 2| 00000010 00000011 Ψ(x)=Ψ(x x ... x ) = (ψ (x ),...,ψ (x )). 3| 00000011 00000010 2| 3| | n 2 2 n n 4| 00000100 00000110 5| 00000101 −→ 00000111 6| 00000110 00000101 Proposition 7: Let x, y 0, 1 m. Then 7| 00000111 00000100 ∈{ } 8| 00001000 00001100 d (Ψ(x), Ψ(y)) d (x, y), 9| 00001001 00001101 1 ≥ H ...... where the distance d1 is the ℓ1 distance defined in (6). 6

Proof: Using (9), we obtain n The correctness of this algorithm is justified as follows. d1(Ψ(x), Ψ(y)) = ψi(xi) ψi(yi) Suppose σ is the original permutation written into the | − | τ i=2 ∈ C ′ memory, and dτ (σ, σ ) t. Let xσ be its inversion vector and Xn ≤ let x be its Gray image, i.e., a vector such that Ψ(x) = xσ. dH (xi, yi) ≥ By Lemma 4 and Prop. 7 we conclude that dH (x, y) t, and i=2 X therefore the decoder of the code correctly recovers≤x from = d(x, y). y. Therefore σ′ will be decoded toA σ as desired. Example: Consider a t-error-correcting primitive BCH code in the binary Hamming space of length m = (n + 1) logAn 2⌊log n⌋+1 + 2 and designed distance 2t + 1 C. The code construction: correcting up to O(n log n) number (generally,⌊ ⌋ − we will need to shorten the code to get to the of errors desired length m). The cardinality of the code satisfies Now we can formulate a general method to construct rank 2m modulation codes. We begin with a binary code of length M . ≥ (m + 1)t m and cardinality M in the Hamming space. A The previous theorem shows that we can construct a set of Encoding algorithm (Construction II): (n,M) rank modulation codes that correct t Kendall errors. • Given a message m encode it with the code . We obtain Note that, by the sphere packing bound, the size of any code m A t a vector x 0, 1 . n that corrects t Kendall errors satisfies = O(n!/n ). ∈{ } mi C ∈ X |C| • Write x = (x2 x3 ... xn), where xi 0, 1 . The rank modulation codes constructed from binary BCH | | | ∈{ } t t t • Evaluate π = J(Ψ(x)) codes have size M = Ω(n!/(log n!) )=Ω(n!/(n log n)). This algorithm is of essentially the same complexity as the Specific examples of code parameters that can be obtained encoding of the code , and if this latter code is linear, from the above construction are given in Sect. IV. A is easy to implement, Both J and Ψ are injective, so the Remark (Encoding into permutations): Suppose that the cardinality of the resulting code is M. Moreover, each of construction in this section is used to encode binary messages the two mappings can only increase the distance (namely, see into permutations (i.e., the code in the above encoding algo- (7) and the previous Proposition). Summarizing, we have the rithm is an identity map). We obtainA an encoding procedure of following statement. binary m-bit messages into permutations of n symbols. This Theorem 8: Let be a binary code of length redundancy of this encoding equals 1 m/ log(n!). Using the A − ⌊log n⌋+1 Stirling formula, we have for n 1 m = (n + 1) log n 2 +2, ≥ ⌊ ⌋− 1 log n! log(√2πn)+ n log n n log e cardinality M and Hamming distance d. Then the set of ≤ − − 12n permutations ( [1], Eq. 6.1.38). Writing m (n + 1)(log n 1) 2n +2, ≥ − − = π S : π = J(Ψ(x)), x we can estimate the redundancy as Cτ ∈ n ∈ A m (3 log e)n forms a rank modulation code on n elements of cardinality M 1 − , n 2. with distance at least d in the Kendall space . − log n! ≤ log n! ≥ Xn The resulting rank modulation code τ can be decoded to Thus the encoding is asymptotically nonredundant. The redun- correct any t = (d 1)/2 Kendall errorsC if t Hamming errors dancy is the largest when n is a power of 2. It is less than are correctable with⌊ − a decoding⌋ algorithm of the binary code 10% for all n 69, less than 7% for all n 527, etc. ≥ ≥ . Namely, suppose that σ′ is the permutation that represents A 1+ǫ a corrupted memory state. To recover the data we perform the D. Correcting O(n ) number of errors, 0 <ǫ< 1/2 following steps. Consider now the case when the number of errors t grows Decoding algorithm (Construction II): with n. Since the binary codes constructed above are of length about n log n, we can obtain rank modulation codes in n that • Construct the inversion vector x ′ . Form a new inversion σ correct error patterns of Kendall weight t = Ω(n log nX). But vector y as follows. For i = 2,...,n, if xσ′ (i 1) m −m ∈ in fact more is true. We need the following proposition. [0,i 1] is greater than 2 i 1 then put y ′ (i)=2 i 1, σ Proposition 9: Let x, y 0, 1 m. Then − ′ − − else put yσ′ (i)= xσ (i). ∈{ } m n 1 dH (x,y) • Form a vector y 0, 1 , y = (y y ... y ) where − 2 3 n d1(Ψ(x), Ψ(y)) − 2 n 1 1 . mi ∈ { } | | | y 0, 1 is given by φi(y ′ (i)). ≥ 2 − i ∈{ } σ   • Apply the t-error-correcting decoding algorithm of the Proof: Assume without loss of generality that x = y. We 6 code to y. If the decoder returns no result, the first claim that, for any such x, y 0, 1 mi , the inequality A ∈ { } wi−1 algorithm detects more than t errors. Otherwise suppose dH (x, y) wi 1 implies that ψi(x) ψi(y) 2 . that y is decoded as x. This is true≥ because≥ of the reflection| property− of the| ≥ standard • Output σ = J(Ψ(x)). Gray map as exemplified above. 7

Now consider vectors x = (x2 x3 ... xn), y = can show that for any 0 ε< 1, there exist infinite families m | | |mi ≤ (y2 y3 ... yn) in 0, 1 where xi, yi 0, 1 , 2 i of binary (m,M,d) codes , with rate R = 1 ǫ, such that | | | { } ∈{ } n ≤ ≤ C − n. Suppose that dH (xi, yi)= wi for all i, and i=2 wi = w the associated rank modulation code τ for permutations of C 1+ε where w = dH (x, y). [n] in Theorem 8 has minimum Kendall distance Ω(n ). P Hence, Theorem 11: For any 0 <ǫ< 1, there exist infinite families n of binary (m,M) codes such that (1/m) log M 1 ǫ> C → − d (Ψ(x), Ψ(y)) = ψ (x ) ψ (y ) 0, and the associated rank modulation code τ constructed 1 | i i − i i | C i=2 in Theorem 8 has minimum Kendall distance that scales as X 1+ǫ 2wi−1 Ω(n ). Moreover all but an exponentially decaying fraction ≥ i: wi>0 of the binary linear codes are such. nX 1 The rank modulation codes described above have asymptot- = 2wi−1 − 2 ically optimal trade-off between the rate and the distance. i=2 i: w =0 X Xi Therefore, this family of codes achieves the capacity of rank We do not have control over the number of nonzero wi’s, so modulation codes (see [3, Thm. 3.1]). let us take the worst case. We have To prove the above theorem we need the help of the n w following lemma. 1 w Pn i w 2 i 2 i=2 n−1 =2 n−1 . n 1 ≥ Lemma 12: Let 0 α 1 and let T [m], T αm i=2 ≤ ≤ ⊂ | | ≥ X − be a coordinate subset. There exists a binary code of length C As for 1 , use the trivial upper bound (n 1)/2. m and any rate R < α such that the projections of any two i: wi=0 2 Together the last two results conclude the proof. − codewords x, y , x = y on T are distinct. Moreover all ∈ C 6 We haveP the following theorem as a result. but an exponentially decaying fraction of binary linear codes Theorem 10: Let and τ be the binary and rank modula- of any rate less than α are such. tion codes defined inC TheoremC 8. Suppose furthermore that the Proof: The proof is a standard application of the proba- minimum Hamming distance d of the code satisfies d = ǫm, bilistic method. Construct a random binary code of length C where m is the blocklength of . Then the minimum Kendall m and size M =2mR randomly and independentlyC selecting 1+C ǫ m distance of the code τ is Ω(n ). M vectors from 0, 1 with uniform probability. Denote by C { } Proof: We have log n 1 log n log n. Use this in x,y the event that two different vectors x, y agree on T . − ≤⌊ ⌋≤ E −αm ∈C the definition of m to obtain that m n(log n 3). Therefore, Clearly Pr( x,y)=2 , for all x, y . The event x,y d = ǫm ǫn(log n 3). From the≥ previous− proposition the is dependentE on at most 2(M 1) other∈ such C events. UsingE minimum≥ Kendall distance− of is at least the Lov´asz Local Lemma [2], all− such events can be avoided, Cτ n 1 i.e., − 2ǫn(log n−3)/(n−1) 1 = Ω(n1+ǫ). 2 − Pr ¯x y > 0, E ,  x,y∈C \  Examples of specific codes that can be constructed from this theorem are again deferred to Sect. IV. if Let us analyze the asymptotic trade-off between the rate e2−αm(2M 1) 1 and the distance of the codes. We begin with an asymptoti- − ≤ cally good family of binary codes, i.e., a sequence of codes or C ,i = 1, 2 ..., of increasing length m for which the rate i M 2αm−1/e +1/2. log Ci /m converges to a positive number R, and the relative ≤ | | Hamming distance behaves as ǫm, where 0 <ǫ< 1/2. Such Hence as long as there exists a code of rate that families of codes can be efficiently constructed by means of R < α, R contains no pairs of vectors x y that agree on . This proves concatenating several short codes into a longer binary code , T the first part of the lemma. (e.g., [21, Ch. 10]) Using this family in the previous theorem, To prove the claim regarding random linear codes chose a we obtain a family of rank modulation codes in Sn of Kendall 1+ǫ linear code spanned by the rows of an mR m binary matrix distance that behaves as Ω(n ), and of rate R (see (1)). The C × upper limit of 1/2 on ǫ is due to the fact [21, p. 565] that no G each entry of which is chosen independently with P (0) = P (1) = 1/2. The code will not contain two codewords that binary codes of large size (of positive rate) are capable of C correcting a higher proportion of errors. project identically on T if the mR T submatrix of G with columns indexed by T has full rank.× | | If mR < T then a given mR T sub-matrix of G has full rank with| probability| 1+ǫ E. Correcting even more, O(n ), errors, 1/2 ǫ< 1 ×| | −(|T |−mR)2 ≤ at least 1 5 2 [11]. Thus if T grows at least It is nevertheless possible to extend the above theorem to as T = mR− +· √m, the proportion of matrices| | G in which the case of ǫ 1/2, obtaining rank modulation codes of the (mR T ) submatrix is singular falls exponentially with 1+≥ǫ × distance Ω(n ), 1/2 ǫ < 1 and positive rate. However, m. Even if each of these matrices generates a different code, this extension is not direct,≤ and results in an existential claim the proportion of undesirable codes will decline exponentially as opposed to the constructive results above. To be precise, one with m. 8

m n−1 Proof of Thm. 11: Suppose that x, y 0, 1 where • Compute the vector x = ϑ(b), where ϑ : 0, 1 m = n m and m = log i as above in∈ this { section.} Let is as follows: { } → i=2 i i ⌊ ⌋ Gn n ϑ P b = (b1,b2,...,bn−1) x = (x1,...,xn−1) d (Ψ(x), Ψ(y)) = ψ (x ) ψ (y ) n1+ǫ 7→ 1 | i i − i i |≤ i=2 0 if bi =0 X xi = , i =1,...,n 1. for some 0 ǫ 1. Let 0 <β < 1. For at least a 1 β (i if bi =1 − proportion of≤ indices≤ we can claim that − i • Find the encoding of m as σ = J(x). n1+ǫ ψ (x ) ψ (y ) . Theorem 13: Let (n 1,M,d 2t + 1) be a code in | i i − i i |≤ β(n 1) C − ≥ − the binary Hamming space and let τ Sn be the set of permutations obtained from it usingC the⊂ above encoding On the other hand, if xi and yi have the same value in the first ti of the mi coordinates, then the construction of the algorithm. Then the code τ Sn has cardinality M and C ⊂ 2 Gray map implies that ψ (x ) ψ (y ) 2mi−ti . Hence for corrects any r Kendall errors where r = t /4 if t 2 is even i i i i ≥ at least a 1 β fraction| of the−i’s, |≥ and r = (t2 1)/4 if t 3 is odd. − Proof: To− prove the≥ claim about error correction, consider n1+ǫ 2mi−ti , the following decoding procedure of the code τ . Let π be a ≤ β(n 1) permutation read off from memory. C − i.e., t m ǫ log n log n . Decoding algorithm (Construction IIIA): i ≥ i − − β(n−1) Therefore, x and y must coincide in a well-defined subset • Find the inversion vector xπ = (x1,...,xn−1). n−1 of coordinates of size • Form a vector y 0, 1 by putting ∈{ } ⌈(1−β)(n−1)⌉ ⌈(1−β)(n−1)⌉ n 0 if xi i/2 ti mi ǫ log n log yi = ≤⌊ ⌋ ≥ − − β(n 1) (1 if xi > i/2 . i=2 i=2 ⌊ ⌋ X X  −  ⌈(1−β)(n−1)⌉ • Decode y with the code to obtain a codevector c. If = log i the decoder returns no result,C the algorithm detects more ⌊ ⌋ i=2 X than t errors. ǫ(1 β)(n 1) log n O(n) • Compute the overall decoding result as J(ϑ(c)). − − − − = m(1 ǫ O(1/ log n)). − − Let σ be the original permutation, let xσ be its inversion Invoking Lemma 12 now concludes the proof: indeed, it vector, and let c(σ) be the corresponding codeword of . The C implies that there exists a binary code of rate at least 1 ǫ above decoding can go wrong only if the Hamming distance − where no such pair of vectors x and y exists. The claim about dH (c(σ), y) > t. For this to happen the ℓ1 distance between linear codes also follows immediately. xπ and xσ must be large, in the worst case satisfying the t condition d1(xπ, xσ) > i=1 i/2 . This gives the claimed result. ⌊ ⌋ F. Construction III: A quantization map From a binary code inP Hamming space of rate R that In this section we describe another construction of rank corrects any τn errors, the above construction produces a rank modulation codes from codes in the Hamming space over an modulation code of size 2Rn that is able to correct Ω(n2) Cτ alphabet of size q 2. The focus of this construction is on the errors. The rate of the obtained code equals R(log n)−1. ≈ case when the number≥ of errors is large, for instance, forms a According to Theorem 1 this scaling is optimal for the proportion of n2. multiplicity of errors considered. Some numerical examples The first result in this section serves as a warm-up for a more are given in Sect. IV. involved construction given later. In the first construction we 2) Construction IIIB: Rank modulation codes from nonbi- use binary codes in a rather simple manner to obtain codes in nary codes: This construction can be further generalized to permutations. This nevertheless gives codes in that correct n obtain codes that are able to correct a wide range of Kendall a large number of errors. Then we generalize theX construction errors by observing that the quantization map employed above by using codes over larger alphabets. is a rather coarse tool which can be refined if we rely on codes 1) Construction IIIA: Rank modulation codes from binary in the q-ary Hamming space for q > 2. As a result, for any base codes: Recall our notation n for the space of inversion ǫ< 1 we will be able to construct families of rank modulation G 1+ǫ vectors and the map J : n Sn that sends them to codes of rate R = R(ǫ) > 0 that correct Ω(n ) Kendall permutations. Let 0, 1 nG−1 be→ a binary code that encodes errors. C∈{ } k bits into n 1 bits. Let l > 1 be an integer. Let Q = a1,a2,...,aq be the − code alphabet. Consider a code of length{ n′ = 2(l 1)(} q 1) Encoding algorithm (Construction IIIA): over Q and assume that it correctsC any t Hamming− errors− k • Let m 0, 1 be a message. Find its encoding b with (i.e., its minimum Hamming distance is at least 2t +1). Let the code∈{. } n = (2l + 1)(q 1). Consider the mapping Θ : Qn−1 , C − q → Gn 9

defined as Θq(b) = (ϑ1(b1), ϑ2(b2),...,ϑn−1(bn−1)), b = vectors equals (b ,...,b ) Qn−1, where 1 n−1 ∈ l−1 l−1 jtj min jtj ≥ tj ≤2(q−1) 0 if i< 3(q 1) j=1 j=1 − X Pj tj ≥t+1 X (2k 1)(j 1) if (2k 1)(q 1) i ϑi(aj )=  − − − − ≤ = 2(q 1)(1+2+ + s)  < (2k + 1)(q 1) − ···  − + (t +1 2(q 1)s)(s + 1) k =2, 3, . . . , l, − −  = (q 1)s(s +1)+(t +1 2(q 1)s)(s + 1)  j =1, 2, 3, . . . , q. − − −  = (t +1 (q 1)s)(s + 1). − − To construct a rank modulation code τ from the code In estimating the minimum in the above calculation we have C C we perform the following steps. used the fact that the smaller-indexed tj ’s should be given the maximum value before the higher-indexed ones are used. Encoding algorithm (Construction IIIB): Therefore if the ℓ1 distance between the received and • Encode the message m into a codeword c original inversion vectors is less than or equal to r then ∈C decoding y′ with the code will recover x . Using (7) we C σ • Prepend the vector c with 3(q 1) 1 symbols a . complete the proof. − − 1 Asymptotic analysis: For large values of the parameters we • Map the obtained (n 1)-dimensional vector to Sn using − obtain that the number of errors correctable by τ is the map J Θq. C ◦ t2 The properties of this construction are summarized in the r ≈ 4q following statement. 2 ′ Theorem 14: Let n′ = 2(l 1)(q 1),n = (2l + 1)(q or, in other words, d( τ ) d /8q. In particular, if d = n δ and 1−ǫ C ≈ 1+ǫ ′ − − − q = O(n ), 0 <ǫ< 1, then we get d( τ )=Ω(n ). If the 1),l 2. Let (n ,M,d = 2t + 1) be a code in the q- ′ ′ Rn CRn R(n−3(q−1)) ≥ C code has cardinality q then τ = q = q . ary Hamming space. Then the code τ Sn described by C ⊂ UsingC (1) yields the value (1 |Cǫ)R| for the rate of the code the above construction has cardinality M and corrects any r − Kendall errors, where τ . This is only by a factor of R less than the optimal scaling Crate of (4). To achieve the optimal asymptotic rate-distance r = (t +1 (q 1)s)(s + 1) 1 trade-off one need to use a q-ary code of rate very close to − − − one and non-vanishing relative distance; moreover q needs to 1−ǫ and s = (t + 1)/(2(q 1)) ,s 0. grow with code length n as n . ⌊ − ⌋ ≥ To show an example, let us take the family of linear codes Proof: We generalize the proof of the previous theorem. on Hermitian curves (see e.g., [4, Ch. 10]). The codes can be Let π be the permutation read off from the memory. constructed over any alphabet of size q = b2, where b is a prime power. Let u be an integer, b +1 u

1+γ By taking u = b , for 0 <γ< 1, and by shortening the 510, obtaining codes τ with the parameters Hermitian code to the length λ(b + 1)u, for λ> 1 arbitrarily C (105, 510 9t, 2t + 1),t =1, 2, 3,.... close to 1 we obtain a code with rate arbitrarily close to − 1 with relative minimum distance equal to 1 1/λ. This We remark that for the case of better codes were − t = 1 yields asymptotically optimal scaling, in the sense defined in constructed in [15]. Namely, there exist single-error-correcting section I, for values of ǫ that range in the interval (0, 1/3). For codes in Sn of size M n!/(2n). For instance, for n = 62 values of ǫ in the range (1/3, 1), families of codes with optimal this gives M = 2277.064≥ as opposed to our M = 2245. A scaling can similarly be constructed by starting from Algebraic Hamming-type upper bound on M has the form Geometry codes with lengths that exceed larger powers of n! q than q3/2, for instance, codes from the Garcia-Stichtenoth M(t) t curves or other curves with a large number of rational points. ≤ i=0 Kn(i) Another general example can be derived from the family where P of quadratic residue (QR) codes [21]. Let p be a prime, then ′ there exist QR codes over Fℓ of length n = p, cardinality Kn(0) = 1 M = ℓ(p+1)/2 and distance √p, where ℓ is a prime that K (1) = n 1 ≥ n − is a quadratic residue modulo p. Using them in Theorem 14 2 Kn(2) = (n n 2)/2 (after an appropriate shortening), we obtain rank modulation − − n +1 codes in Sn, where n = p + 3(ℓ 1), with cardinality M K (3) = n − n 3 − and distance d( τ )=Ω(p/ℓ). Let us take a sufficiently large   prime p and letCℓ be a prime and a quadratic residue modulo (see e.g., [17, p.15] which also gives a general formula for 1 −α p. Suppose that ℓ = Θ(p 2 ) for some small α> 0. Pairs of Kn(i) for i n). The codes constructed above are not close primes with the needed properties can be shown to exist under to this bound≤ (note however that, except for small t, Hamming- the assumption that the generalized Riemann hypothesis is true type bounds are usually loose). (see e.g. [18]). Using the corresponding QR code in Theorem Now let us use binary BCH codes in Theorem C 1 +α ′ 14, we obtain n = p + 3(ℓ 1) = Θ(p), d( τ ) = Θ(n 2 ) 13. Starting with codes of length n = 63, 255 we and log M = Θ( n ( 1 α) log− n), giving theC rate 1 ( 1 α). obtain rank modulation codes with the parameters 2 2 − 2 2 − Although this trade-off does not achieve the scaling order of (64, 36, 13),(64, 30, 19),(64, 24, 25),(64, 18, 51),(64, 16, 61), (4), it still accounts for a good asymptotic family of codes. (64, 10, 85), (256, 215, 13), (256, 207, 19), (256, 199, 25), (256, 191, 33), etc. These codes are not so good for a IV. EXAMPLES small number of errors, but become better as their distance Below refers to the rank modulation code that we are increases. Cτ constructing, M = τ , and t is the number of Kendall Finally consider examples of codes constructed from The- errors that it corrects.|C We| write the code parameters as a orem 14. As our seed codes we consider the following triple (n, log M, d) where d = 2t +1. In the examples we possibilities: products of Reed-Solomon codes and codes on do not attempt to optimize the parameters of rank modulation Hermitian curves. codes; rather, our goal is to show that there is a large Let us take = , where [15, 9, 7] and [14, 3, 12] C A⊗B A B variety of constructions that can be adapted to the needs of are Reed-Solomon codes over F16. Then the code has length concrete applications. More codes can be constructed from n′ = 14 15 = 210, (so l = 8), cardinality 1627 C= 2108 and the codes obtained below by using standard operations such as distance ·84, so t = 41. From Theorem 14 we obtain a rank shortening or lengthening of codes [3], [15]. Note also that the modulation code τ with the parameters (n = 255, log M = design distance of rank modulation codes constructed below 108, d 107). SomeC further sets of parameters for codes of may be smaller than their true distance, so all the values of the length ≥n = 255 obtained as we vary dim( ) are as follows: distance given below are lower estimates of the actual values. B dim( )4 5 6 7 8 From Theorem 3 we obtain codes with the following log MB 144 180 216 252 288 parameters. Let q = 2l, then n = q 1 and log M d 95 79 67 55 49 l log(q 2t 2) . For instance, let l −= 6, then we ob-≥ tain⌊ the− triples− (63⌋, 30, 31), (63, 24, 47), etc. Taking l = 8, The code parameters obtained for n = 255 are better than we obtain for instance the following sets of parameters: the parameters obtained for the same length in the above (255, 56, 127), (255, 48, 191). examples with binary BCH codes, although decoding product Better codes are constructed using Theorem 8. Let us take RS codes is somewhat more difficult than decoding BCH codes n = 62, then m = 253. Taking twice shortened BCH codes On the other hand, relying on product RS codes offers a great t of length m, we obtain a range of rank modulation codes deal of flexibility in terms of the resulting parameters of rank accordingB to the designed distance of . In particular, there modulation codes. Bt are rank modulation codes in 62 with the parameters We have seen above that Hermitian codes account for some X of the best asymptotic code families when used in Theorem (62, 253 8t, 2t + 1),t =1, 2, 3,.... − 14. They can also be used to obtain good finite-length rank Similarly, taking n = 105, we can construct a suite of rank modulation codes. To give an example, let be a projective C modulation codes from shortened BCH codes of length m = Hermitian code of length 4097 over F 8 . We have dim( )= 2 C 11

17a 119, d( ) 4097 17a for any integer a such that [5] Y. Cassuto, M. Schwartz, V. Bohossian, and J. Bruck, “Codes for 17 −a 240;Csee≥ [4, p. 441].− Let us delete any 17 coordinates asymmetric limited-magnitude errors with application to multilevel flash memories,” IEEE Trans. Inform. Theory, vol. 56, no. 4, pp. 1582–1595, (puncture≤ ≤ the code) to get a code ′ with C 2010. [6] H. Chadwick and L. Kurz, “Rank permutation group codes based on ′ n = 4080 = 16(q 1), Kendall’s correlation statistic,” IEEE Trans. Inform. Theory, vol. 15, no. − dim( ′) = dim( ), 2, pp. 306-315, 1969. C C [7] W. Chu, C.J. Colbourn ad P. Dukes, “Constructions for permutation ′ ′ codes in powerline communications,” Designs, Codes and Cryptography, dH ( ) n 17a. C ≥ − vol. 32, pp. 51–64, 2004. We have n = n′ +3(q 1) = 4845. For a 60,..., 100 we [8] L. Comtet, Advanced Combinatorics, Dordrecht, Netherlands: Reidel, − ∈{ } 1974. obtain a suite of rank modulation codes with the parameters [9] M. Deza and T. Huang, “Metrics on permutations, a survey,” J. Combin. (n, 7208, 6119), (n, 7344, 6071),..., (n, 12648, 4079). Inform. System Sci., vol. 23, no. 1-4, pp. 173–185, 1998. [10] P. Diaconis and R. L. Graham, “Spearman’s footrule as a measure of As a final remark, note that most existing coding schemes disarray,” Journal of the Royal Statistical Society, Series B, vol. 39, no. 2, pp. 262–268, 1977. for the Hamming space, binary or not, can be used in one or [11] F. Gerth, III, “Limit probabilities for coranks of matrices over GF (q), more of our constructions to produce rank modulation codes. Linear and Multilinear Algebra, vol. 19, no. 1, pp.79–93, 1986. The decoding complexity of the obtained codes essentially [12] A. Jiang, V. Bohossian, and J. Bruck, “Rewriting codes for joint information storage in flash memories,” IEEE Trans. on Inform. Theory, equals the decoding complexity of decoding the original codes vol. 56, no. 10, pp. 5300–5313, 2010. for correcting Hamming errors or for low error probability. [13] A. Jiang, M. Langberg, R. Mateescu, and J. Bruck, “Data movement This includes codes for which the Hamming distance is not in flash memories,” Proc. 46th Annual Allerton Conf. Commun. Control Comput., Monticello, IL, Sept. 2009, pp. 1031–1038. known or not relevant for the decoding performance, such as [14] A. Jiang, R. Mateescu, M. Schwartz, and J. Bruck, “Rank modulation LDPC and polar coding schemes. In this case, the performance for flash memories,” IEEE Trans. Inform. Theory, vol. 55, no. 6, pp. of rank modulation schemes should be studied by computer 2659–2673, 2009. [15] A. Jiang, M. Schwartz, and J. Bruck, “Correcting charge-constrained simulations, similarly to the analysis of the codes used as errors in the rank-modulation scheme,” IEEE Trans. Inform. Theory, building elements in the constructions. vol. 56, no. 5, pp. 2112–2120, 2010. [16] M. Kendall and J. D. Gibbons, Rank Correlation Methods, 5th ed., Edward Arnold Publishing, London, 1990. V. CONCLUSION [17] D. E. Knuth, The Art of Computer Programming, Volume 3: Sorting and Searching, Reading. MA: Addison-Wesley, 1973. We have constructed a number of large classes of rank [18] J.C. Lagarias, and A. M. Odlyzko, “Effective versions of the Chebotarev modulation codes, associating them with binary and q-ary density theorem.” in Algebraic number fields: L-functions and Galois properties (Proc. Sympos., Univ. Durham, Durham, 1975), pp. 409–464. codes in the Hamming space. If the latter codes possess Academic Press, London, 1977. efficient decoding algorithms, then the methods discussed [19] R. Lidl and H. Niederreiter, Finite Fields, Addison-Wesley Publishing above translate these algorithms to decoding algorithms of Company, Reading, Massachusetts, 1983. [20] T. Kløve, T.-T. Lin, S.-C. Tsai, and W.-G. Tzeng, “Permutation arrays rank modulation codes of essentially the same complexity. under the Chebyshev distance,” IEEE Trans. Inform. Theory, vol. 56, Our constructions also afford simple encoding of the data no. 6, pp. 2611–2617, 2010. into permutations which essentially reduces to the encoding [21] F. J. MacWilliams and N.J.A. Sloane, The Theory of Error-Correcting Codes, North-Holland, Amsterdam, 1991. of linear error-correcting codes in the Hamming space. Thus, [22] N. Papandreou, H. Pozidis, T. Mittelholzer, G. F. Close, M. Breitwisch, the existing theory of error-correcting codes can be used to C. Lam, and E. Eleftheriou, “Drift-tolerant multilevel phase-change design practical error-correcting codes and procedures for the memory,” 3rd IEEE International Memory Workshop (IMW), Monterrey, CA, May 22-25, 2011, 4pp. rank modulation scheme. [23] M.-Z. Shieh and S.-C. Tsai, “Decoding frequency permutation arrays A direction of research that has not been addressed in under Chebyshev distance,” IEEE Trans. Inform. Theory, vol. 56, no. the literature including the present work, is to construct an 11, pp. 5730–5737, 2010. [24] I. Tamo and M. Schwartz, “Correcting limited magnitude errors in the adequate model of a probabilistic communication channel that rank modulation scheme,” IEEE Trans. Inform. Theory, vol. 56, no. 6, is associated with the Kendall tau distance. We believe that the pp. 2551–2560, 2010. underpinnings of the channel model should be related to the [25] H. Vinck, J. Haering and T. Wadayama, “Coded M-PSK for power line communications,” Proc, 2000 IEEE Int. Symp. Inform. Theory process of charge dissipation of cells in flash memory devices. (ISIT2000), Sorrento, Italy, 2000, p. 137. Once a reasonably simple probabilistic description of the error [26] Y. Yehezkeally and M. Schwartz, “Snake-in-the-box codes for rank process is formally modelled, the next task will be to examine modulation,” arXiv:1107.3372, 2011. [27] F. Zhang, H. D. Pfister and A. Jiang, “LDPC codes for rank modulation the performance on that channel of code families constructed in flash memories,” Proc. 2010 IEEE Internat. Sympos. Inform. Theory in this work. (ISIT 2010), Austin, TX, June 13–18, 2010, pp. 859–863.

REFERENCES

[1] M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions, Dover, 1965. [2] N. Alon and J. Spencer, The Probabilistic Method, 3rd Ed., J. Wiley & Sons, 2008. [3] A. Barg, and A. Mazumdar, “Codes in permutation and error correction for rank modulation,” IEEE Trans. Inform. Theory, vol. 56, no. 7, pp. 3158–3165, 2010. [4] R. Blahut, Algebraic Codes on Lines, Planes and Curves, Cambridge University Press, 2008.