• No results found

Multi-Dimensional Range Queries

Fix anydě1, and suppose the universeXconsists ofB0buckets in each dimension, i.e.,X “ rB0sd. In this case, a

range queryrj1, j11s ˆ rj2, j21s ˆ ¨ ¨ ¨ ˆ rjd, jd1sis specified by integersj1, j2, . . . , jd, j11, j21, . . . , jd1 P rB0swithji ďji1

for alli“1,2, . . . , d.

Throughout this section, we will consider the case thatdis a constant (andB0is large). Moreover suppose that

B0is a power of 2 (again, this is without loss of generality since we can pad each dimension to be a power of 2 at the

cost of a blowup in|X|by at most a factor of2d). WriteB “ |X| “Bd0. Our goal is to define a matrixMB,dwhich

satisfies analogues of Lemmas 5.4 and 5.5 forwP t0,1uBrepresenting multi-dimensional range queries (whenrBs

is identified withrB0sd).

The idea behind the construction ofMB,dis to apply the linear transformationMB0 in each dimension, operating

on a single-dimensional slice of the input vectorpzj1,...,jdqj1,...,jdPrB0s(when viewed as ad-dimensional tensor) at a

time. Alternatively,MB,d can be viewed combinatorially through the lens ofrange trees[Ben79]:MB,d is a linear

transformation that takes the vectorpzj1,...,jdqto aB-dimensional vector whose components are the values stored at

the nodes of a range tree defined in a similar manner to the range query treeTBfor the cased“ 1. However, we

opt to proceed linear algebraically: the matrixMB,dis defined as follows. Fix a vectorz PRB. We will index the

elements ofz withd-tuples of integers in rB0s, i.e., we will writez “ pzj1,...,jdqj1,...,jdPrB0s. For1 ď p ď d, let

MB,pprebe the linear transformation that appliesMB0to each vectorpzj1,...,jp´1,1,jp`1,...,jd, . . . , zj1,...,jp´1,B0,jp`1,...,jdq,

wherej1, . . . , jp´1, jp`1, . . . , jd P rB0s. That is, MB0 is applied to each slice of the vectorz, where the slice is

being taken along thepth dimension. Then let

MB,d:“MB,dpre˝ ¨ ¨ ¨ ˝M pre

We will also use an alternate characterization ofMB,d, which we develop next. First identifyRB with thed-wise tensor product ofRB0, in the following (standard) manner: Lete1, . . . , eB0 P R

B0 be the standard basis vectors in

RB0. Then the collection of alle

j1 b ¨ ¨ ¨ bejd, wherej1, . . . , jd P rB0s, form a basis forR

B0b ¨ ¨ ¨ bRB0. Under

the identification RB » pRB0qbd, a vector z “ pzj1,...,jdqj1,...,jdPrB0s P RB is identified with the following linear

combination of these basis vectors:

ÿ

j1,...,jdPrB0s

zj1,...,jd¨ej1b ¨ ¨ ¨ bejd.

Under this identification, the matrixMB,dcorresponds to the following linear transformation ofpRB0qbd:

MB0 b ¨ ¨ ¨ bMB0 :pR

B0qbdÑ p

RB0qbd.

In the following lemmas, we will often abuse notation to allowMB,dto represent both the above linear transforma-

tion as well as the matrix inRBˆBrepresenting this transformation.

Lemma 5.6. We have that MB,d P t0,1uBˆB and the sensitivity ofMB,d : RB Ñ RB is bounded by ∆MB,d ď p1`logB0qd.

Proof of Lemma 5.6. Notice that theppj1, . . . , jdq,pj11, . . . , jd1qqentry ofMB,dis given by the following product:

d

ź

p“1

pMB0qjp,jp1.

SinceMB0 P t0,1u

B0ˆB0, it follows immediately thatM

B,d P t0,1uBˆB. Moreover, to upper bound the sensitivity

ofMB,dnote that for anypj11, . . . , j1dq P rB0sd,

ÿ pj1,...,jdqPrB0sd d ź p“1 pMB0qjp,j1p“ d ź p“1 ¨ ˝ B0 ÿ jp“1 pMB0qjp,j1p ˛ ‚ď p∆MB 0q dď p1 `logB0qd,

where the last inequality above uses Lemma 5.4.

Lemma 5.7. For the vectorwrepresenting any range queryrj1, j11s ˆ ¨ ¨ ¨ ˆ rjd, jd1s, the vectorwMB,d´1 belongs to t´1,0,1uBand moreover it has at most

d

ź

p“1

pcpjp´1q `cpjp1qq ď p2 logB0qd“ p2 logpB1{dqqd

nonzero entries.

Proof of Lemma 5.7. The inverseMB,d´1 ofMB,dis given by thed-wise tensor productMB´10 b ¨ ¨ ¨ bMB´10. This can

be verified by noting that this tensor product andMB,dmultiply (i.e., compose) to the identity:

pMB´1 0 b ¨ ¨ ¨ bM ´1 B0q ¨MB,d “ pM ´1 B0 b ¨ ¨ ¨ bM ´1 B0q ¨ pMB0b ¨ ¨ ¨ bMB0q “ pMB´1 0 ¨MB0q b ¨ ¨ ¨ b pM ´1 B0 ¨MB0q “IB0b ¨ ¨ ¨ bIB0 “IB.

Recall that the (row) vectorwrepresenting the range queryrj1, j11s ˆ ¨ ¨ ¨ ˆ rjd, jd1ssatisfies, for eachpj12, . . . , jd2q P rB0sd,wj2

1,...,j2d “1if and only ifj 2

p P rjp, jp1sfor all1ďp ďd, and otherwisewj2

1,...,jd2 “0. Therefore, we may

the range queryrjp, jp1s. In particular, for1 ď j2 ď B0, thej2th entry of wp is 1 if and only ifj2 P rjp, jp1s. It

follows that

wMB,d´1 “ pw1b ¨ ¨ ¨ bwdqpMB´10 b ¨ ¨ ¨ bMB´10q “w1MB´10 b ¨ ¨ ¨ bwdMB´10. (86)

By Lemma 5.5, for1ďpďd, the vectorwpMB´10 has entries int´1,0,1u, at mostcpjp´1q `cpjp1qof which are

nonzero. SincewMB,d´1 is the tensor product of these vectors and the sett´1,0,1uis closed under multiplication, it also has entries int´1,0,1u, at mostśdp“1pcpjp´1q `cpjp1qqof which are nonzero.

The following lemma allows us to bound the running time of the local randomizer (Algorithm 3) and analyzer (Algorithm 4):

Lemma 5.8. GivenB, dwithB “B0d, the following can be computed inOplogdB0qtime:

(1) Given indicespj1, . . . , jdq P rB0sd, the nonzero indices ofMB,dfor the column indexed bypj1, . . . , jdq.

(2) Given a vectorw P RB specifying a range query, the set of nonzero elements of wMB,d´1 and their values

(which are int´1,1u).

Proof of Lemma 5.8. We first deal with the case d “ 1, i.e., the matrix MB,1 “ MB. Given j, j1 P rBs, the pj1, jq-entry of M

B is 1 if and only if the node vtj1,sj1 of the treeTB is an ancestor of the leaf vlogB,j. Since

tj “rlog2js, sj “2pj´2tj´1q ´1, whether or notvtj1,sj1 is an ancestor ofvlogB,jcan be determined inOplogBq

time, thus establishing (1) for the cased“1. Notice that the statement of Lemma 5.5 immediately gives (2) for the

cased“1.

To deal with the case of generald, notice thatMB,d“ pMB0q

bd. Therefore, for a given

pj1, . . . , jdqthe set

tpj1

1, . . . , j1dq:pMB,dqpj1

1,...,jd1q,pj1,...,jdq“1u (87)

of nonzero indices in thepj1, . . . , jdq-th column ofMB,dis equal to the Cartesian product

ą

1ďpďd

tjp1 :pMB0qjp1,jp “1u.

Since each of the setstj1

p:pMB0qj1p,jp “1ucan be computed in timeOplogB0q(using the cased“1solved above),

and is of sizeOplogB0q, the product of these sets (87) can be computed in time OplogdB0q, thus completing the

proof of item (1) in the lemma.

The proof of item (2) for generaldis similar. For1ďp ďd, letwpbe the vector inRB0 corresponding to the

1-dimensional range queryrjp, jp1s. Then recall from (86) we have thatwMB,d´1 “w1M ´1

B0 b ¨ ¨ ¨ bwdM

´1

B0. By item

(2) ford “1, the nonzero entries of each ofwpMB´10 (and their values) can be computed in timeOplogB0q; since

each of these sets has sizeOplogB0q, the set of nonzero entries ofwMB,d´1, which is the Cartesian product of these

sets, as well as the values of these entries, can be computed in timeOplogdB0q.

Related documents