Approximation of Complex Numbers by Cyclotomic Integers - CiteSeerX

0 downloads 0 Views 364KB Size Report
22 Aug 1996 - in the following Approximation Problem on complex numbers inside the unit circle: ..... Proof. Let us rst prove that 2n? ?3 > 1: note that i < j for i>j> 0. .... We rst show that if E has the above properties, then for an arbitrary element a in. Z n]+ ...... For a complex number w the following statements are equivalent.
Approximation of Complex Numbers by Cyclotomic Integers M.A. Shokrollahi and V. Stemann August 22, 1996

Abstract. We present a new method of approximating complex numbers by n

cyclotomic integers in Zn[e2i=2 ] whose coecients with respect to the basis given by powers of e2i=2 are bounded in absolute value by a given integer M . It has been suggested by Cozzens and Finkelstein [5] that such approximations reduce the dynamic range requirements of the discrete Fourier transform. For xed n our algorithm gives approximations with an error of O(1=M 2n? ?1). This proves a heuristic formula of Cozzens and Finkelstein. We will also prove a matching lower bound for the worst case error of any approximation algorithm and hence show that our algorithm is essentially optimal. Further, we derive a slightly di erent and more ecient algorithm for approximation by 16th roots of unity. The basic ingredients of our algorithm are the explicit Galois theory of cyclotomic elds as well as cyclotomic units. We use a deep number theoretic property of these units related to the class number of the eld. Various examples and running times for this case and that of approximation by 32nd roots of unity are included. Finally, we derive the algebraic and analytic foundations for the generalization of our results to arbitrary algebraic number elds. 2

Key words. Discrete Fourier tranform, cyclotomic elds, cyclotomic units, complex approximation, integer linear programming.

1. Introduction

Numerical computations are vulnerable to basically two di erent types of errors: quantization errors which are caused, e.g., by inaccurate input, and roundo errors, which falsify results of arithmetic operations. While quantization errors are inherent to computations run on inaccurate data, roundo errors can be avoided if the input and all program constants are approximated by elements of an algebraic structure in which exact arithmetic is possible. If the approximation errors are not too large, this procedure yields outputs of guaranteed good precision. An important class of computations for which this approach has been developed in detail is the fast Fourier transform [4], FFT for short. The basic idea is as follows (see [5, 6, 7] and the references therein): the input vector as well as the roots of unity involved are approximated by Gaussian integers, i.e., elements of the ring

Approximation of Complex Numbers

2

Z[i].

This step is accomplished by scaling the complex numbers by a large number, and then rounding to the nearest Gaussian integer. Since the coecients arising in the course of the computation may be large, arithmetic in Z[i] is performed using Chinese Remaindering Techniques modulo appropriate primes. Fixing the primes leads to working with elements of Z[i] with bounded coecients. To obtain reasonable approximations of the input data however, one needs to work with large scaling factors. Hence, there is a fundamental tradeo between the so-called dynamic range requirements, and the precision of the quantization. For example, approximation by Gaussian p integersp up to an error of 1=n would require integer coecients in the range [?n= 2; : : :; n= 2], see [8]. In a pioneering paper Cozzens and Finkelstein [5] suggested to replace the fourth root of unity i byn a 2n th root  = e2i=2n . While Z[i] forms o a discrete lattice in C , 2n?1 ?1 the ring Z[ ] := 0 + 1  + : : : + 2n?1 ?1  i 2 Z is dense in C for n  3. Hence for all z 2 C and all " > 0 there is an approximation a 2 Z[ ] of z , such that ja ? zj  ". Since the set Z[ ]M

o n := 0 + 1  + : : : + 2n?1 ?1  2n?1 ?1 i 2 Z; j ij  M

is nite, we will still be confronted with the tradeo problem between the dynamic range requirements and the precision. However, we might hope for better approximations within the same range. Since any complex number can be represented by the sum of a Gaussian integer and a complex number of absolute value  1, we focus in the following Approximation Problem on complex numbers inside the unit circle: Design an algorithm that approximates a given complex number of absolute value  1 by an element of the set Z[ ]M , where  = e2i=2n . The main result of this paper is a general solution to the above problem by exhibiting a meta-algorithm that produces an approximation algorithm on input M and n. Usually, we will consider n as being xed and study algorithms solving the above Approximation Problem with respect to the following questions: (1) What is a worst case bound on the error of the approximation in terms of M ? (2) What is the running time of the approximation algorithm in terms of M ? Only partial answers have been given to these questions in previous work. Cozzens and Finkelstein give in [5] a heuristic argument which suggests obtaining an approximation error of order O(1=M 2n?2?1 ) for xed n might be possible. Furthermore they describe a simple algorithm which, for xed n, needs an O(M log(M )) bound on the coecients to achieve a precision of O(1=M 2n?2 ?1 ). As this algorithm has a precomputation phase whose basic ingredient is exhaustive search, it is impractical for larger values of M and n. Games [6, 7] develops a greedy algorithm for the special case of the 8th roots of unity. A rough sketch of the algorithm is as follows: in a rst step a small element " of Z[ ]M is found. Now the algorithm starts at the origin and successively improves the

Approximation of Complex Numbers

3

approximation by adding an appropriate element of the form  i " without violating the bound on the coecients. qHe shows that an extension of this algorithm achieves p an approximation error  j"j= 2 ? 2. Finally he gives an explicit algorithm, based on continued fractions, to nd a " of smallest absolute value. The nal result is an algorithm with worst case approximation error of O(1=M ), which compares favorably with the heuristic formula in [5]. However, no attempt has been made to justify the algorithm for the case of sixteenth roots. Furthermore, due to the large amount of computations involved, this algorithm is not well suited for real time applications. In this paper we give a complete answer to the above questions by presenting a general method to solve the Approximation Problem. For xed n the algorithm approximates a complex number in the unit circle with an approximation error of O(1=M 2n?2?1 ). This proves the heuristic formula by Cozzens and Finkelstein. The algorithm runs in time O(log(M )) and uses O(log(M )) additional memory. We prove a matching lower bound on the approximation error thereby showing the optimality of our algorithm. Due to its simple structure, it is also suitable for real time computations. In a rst step we reduce the complex approximation problem to the approximation problem of real numbers in the interval [0; 1]. This is done by separately approximating the real and imaginary part. This only p gives an additional factor of two in the bound on the coecients, and a factor of 2 on the absolute error of the nal approximation. The main part of our meta-algorithm is the construction of a set E of small positive real elements of Z[ ]M . E has the property that for all real a 2 Z[ ]M there exists an " 2 E such that a + " is still in Z[ ]M , i.e., the sum does not violate the bound on the coecients. Games' algorithm [7] for nding the elements of smallest absolute value in the set Z[e2i=8]M shows that these always have absolute norm 1 or 2. Recall that the absolute norm of an algebraic number is the product of its Galois-conjugates. Inspired by this result we construct the elements of E as power products of certain units in the cyclotomic eld Q( ), the so-called cyclotomic units. The main property of this set of units is that their so-called regulator is nonzero. This means that the matrix whose (i; j )-entry is the logarithm of the absolute value of the ith conjugate of the j th unit is nonsingular. This is a deep property which follows from the nonvanishing of the Dirichlet L-series at s = 1. The interested reader is referred to [10, Chapter 8]. To construct the sets E we start in Section 2 with establishing a fundamental relationship between the size of the coecients of an algebraic integer and the size of its conjugates. After recalling some basic results about cyclotomic elds in Section 3, we proceed in Section 4 with lower bounds for the Approximation Problem. We prove that the approximation error of any algorithm solving this problem is (1=M 2n?2?1 ) by showing that there exists a point z such that for all a 2 Z[ ] 2n?2 ?1 jz ? aj = (1=M ). Further, we also show that the smallest element of Z[ ]M

4

Approximation of Complex Numbers

has order (1=M 2n?2 ?1 ). This result, though interesting in its own, will be used to prove that our approximation algorithm runs in time O(log(M )). Matching upper bounds are proved in Section 5 by constructing the set E . We derive certain conditions on the conjugates of units in E which guarantee for any a 2 Z[ ]M the existence of " 2 E such that a + " 2 Z[ ]M . We then reduce the problem of nding power products of cyclotomic units which satisfy these conditions to an integer linear programming problem, and show how to nd (asymptotically optimal) solutions by solving a system of linear equations. Section 6 deals with a modi cation of the general algorithm for the case of 16th roots of unity. This modi ed algorithm uses a signature technique. It is asymptotically comparable to the general method, but is much more ecient in practice. The algorithm is inspired by a simple approximation algorithm in Z[e2i=8] found by the authors [9]. In Section 7 we report on the implementation of our algorithms, on their running times, and on strategies to enhance their performance. Finally, Section 8 prepares the ground for a far reaching generalization of the results of this paper. We have included a theorem obtained by Clausen and Shokrollahi [3] on the characterization of complex numbers w such that Z[w] is dense in C . If w is an algebraic integer of degree > 2, we can design a meta-algorithm for approximation in Z[w] along the same lines as in this paper, provided we know a set of units in the algebraic number eld Q(w) with nonvanishing regulator. We would like to thank Michael Clausen for communicating the problem to us and for his permission to include Theorem 8.1.

2. Galois Extensions

Let L  K be a Galois extension of elds with group G := Gal(L=K ) = f ; : : :; d? g. Further, let  ; : : :; d? be a K -basis of L, and a := Pdi ? ii 2 L with i 2 K . We wish to derive a relationship between the sets f ; : : :; d? g, f ; : : :; d? g, and f ; : : :; d? g. We start by noting that for any nonzero a 2 L there exists an invertible matrix Ra 2 GL(d; K ), such that 0  1 0 a 1 B@ ... CA = Ra B@ ... CA : (2.1) d? a  d? The map a 7! Ra is an injective homomorphism of L into GL(d; k) (regular representation). Since the entries of Ra belong to K , they are invariant under G. Hence, taking the G-conjugates of (2.1) yields T  D a = Ra  T (2.2) 0

1

0

1

0

1 =0

1

0

0

1

0

0

1

1

1

Approximation of Complex Numbers

where

0  ( ) BB  ( ) T := B B@ ... 0

0

5

1

1 (0 )    d?1 (0 ) 1 (1 )    d?1 (1 ) C CC

.. CA ; . 0 (d?1 ) 1 (d?1 )    d?1 (d?1 ) and Da := diag(0(a); : : :; d?1 (a)) is the diagonal matrix with diagonal entries 0(a); : : :; d?1(a). The following result is well-known. Lemma 2.1. T is invertible. Proof. Since L is a separable extension of K , there exists an irreducible separable polynomial f 2 K [X ], such that L = K (a) for some root a of f . Let S be the matrix (j (ai))0i;j 0. Hence, 2n??3 > 2n?3 = 3 + 3?1 = 2 > 1. Next we show for all n  3 and all odd 

1(2

n?3 )

= ?1 = ?maxconj(1 ):

Approximation of Complex Numbers

8

Notice that j1(l) j  j1 j for all l. Hence, we need to prove the left equality. Observe that 52n?3  1 mod 2n?1 since (Z=2nn??31Z) = h5i  h?1i. Thus, 52n?3  2n?1 + 1 mod 2n , and for odd  we have 52  (2n?1 + 1)  1 + 2n?1 mod 2n . Hence,

1(2

n?3 )

= n52

n?3 

n?3 

+ n?52

= ?(n + n?1 ) = ?1

1 . By the above we have Now note that 2n? ?3 = n2n? ?3 + n?2n? ?3 =  +3 + ?+3  (2 ) 2n??3 = ?2n??3 = maxconj(2n??3 ) (replace n by  + 3). 2

3.2. Cyclotomic Units. The norm of an element u 2 Z[n] is de ned as +

N(u) :=

n?2 ?1

2

Y

i=0

u(i) :

As u is an algebraic integer, N(u) 2 Z. u is called Q a unit if N(u) 2 f1g. A set fu1 ; : : :; ul g of units is called independent if j li=1 uxi i j = 1, xi 2 Z, implies x1 =    = xl = 0. For general number elds, it can be quite hard to nd a maximal set of independent units. For cyclotomic elds and their maximal real sub elds, however, the situation is quite di erent: the cyclotomic units form a maximal set of independent units. They are de ned as follows: for j = 1; : : :; 2n?2 ? 1 we set j := nj (1 ? n )=(1 ? n2j+1 ) ([10, Chapter 8]). The following important fact holds for the matrix  := (log jj(i)j)1i;j r. (2

Approximation of Complex Numbers

9

For the proof of this proposition we need the following result. Lemma 4.2. There are at most (2M + 1)2n?1?2 elements of Z[n]M inside the unit circle. Proof. Let j 2 f?M; : : :; M g, j 6= 0, j 6= 2n?2 , be given. Then there exists exactly one pair ( 0 ; 2n?2 ) 2 Z2 such that n?1 ?1

2

X

j =0

o n j nj 2 z max(jRe(z)j; jIm(z)j)  1 :

Hence, there is at most one pair ( 0; 2n?2 ) with j 0j; j 2n?2 j  M , such that P 2n?1 ?1 j j=0 j nj j  1. Thus the assertion follows. 2 Proof of Proposition 4.1. Let M := fz2Z[max min jz ? z0j: ] jjz j  ) M > (2M + 1)?(2n?2?1) = r: 2 (2M + 1)2n?1?2  M

Theorem 4.3. Let n  3. There exists a constant cn depending on n and for any M > 0 there exists zM 2 C , jzM j  1, such that

cn : j z ? z j  min M 2 z2Z[n]M M n?2 ?1 Proof. Let r and z be as in Lemma 4.2 and let zM be such that jzM ? z j = r and jzM j < 1. 2 The next theorem gives a lower bound on the size of the elements of Z[n]M . Theorem 4.4. For xed n  3 there exists a constant n depending on n, such that

n : min j z j  2 z2Z[n]M nf0g M n?2 ?1 Proof. We will only prove this statement for the elements of Z[n]+M . The corresponding assertion for Z[n]M can be proved exactly in the same way. During this proof we set m := 2n?2 . Let " 2 Z[n]+M be the smallest element of this set. Multiplying both sides of equation (2.3) with T we obtain ("(0); : : :; "(m?1)) = (e0; : : :; em?1 )T;

Approximation of Complex Numbers

10

P

where " = i ei i . Let the L1 -norm L1 (v ) of a real valued vector v be the sum of the absolute values of its entries. Note that if A is a square matrix, then L1 (vA)  L1(A)L1(v), where L1(A) is the maximum of the L1-norms of the columns of A. Hence, taking L1-norms of the above equation we obtain mX ?1 i=0

j" i j  mL1(")L (T ): ( )

1

Q Let ` := mi=0?1 "(i) be the the norm of ". We get

j`j = mY? j" i j  L (")m? L (T )m?  m m?  M m? ; 1 j"j i m?1

n  ?m is a constant depending on n. Since ` is a where n := mL (T )=(m ? 1) nonzero integer, we have j`j  1, which implies the assertion. 2 1

( )

1

1

1

1

1

=1

+1

1

5. The General Approximation Algorithm

In this section we describe a general procedure to approximate complex numbers by elements of Z[n]. We adopt the notation of the previous sections. In addition, we set m := 2n?2 .

5.1. Reduction to the Real Case. We start by reducing the problem to that of the approximation of real numbers. Proposition+5.1. Let z 2 C have real part z0 and imaginary part z1. Suppose that a0; a1 2 Z[n]M are approximations of z0 and z1 , respectively, and that jzj ? aj j   for some p   0. Then a0 + ia1 2 Z[n]2M is an approximation of z with error at most  2. Proof. The bound on the error being obvious we focus on proving thatPa0 + ia1 has coecients bounded by 2M . But this is clear once noting that if aj = ` j;` ` , P n?2?1( + n?2 ) j +  2n?2 + P2n?2?1( ? then a0 + ia1 = 0;0 + 2j =1 0;j 1;0 n 1;j 1;2 ?j n j =1 2n?2 +j 0;2n?2?j )n :2 P Given ! 2 [0; 1] and some M 2 N, our aim is to nd a = i i i 2 Z[n]+ such that L1 (a)  M and j! ? aj  M mc ?1 for some constant Pc (possibly depending on n). In view of Corollary 3.5 it suces to nd a such that mi=0?1 ja(i)j  mM . 5.2. The Algorithm. The basic precomputation step is to nd a subset E =

f" ; : : :; " m? g of Z[n] consisting of positive elements with the following proper1

ties:

2

2

+

Approximation of Complex Numbers

11

(a) 81  k < m: maxconj("k ) = "(kk) and maxconj("k+m?1 ) = ?"(kk+)m?1 ,

P

(b) 8" 2 E : mi=0?1 j"(i)j  2 maxconj("), m?2 maxconj(" )  M , (c) maxl2=1 l We rst show that if E has the above properties, then for an arbitrary element a in + Z[n]+ M \ [0; 1] there always exists " 2 E such that a + " 2 Z[n]M . Roughly speaking, one has to choose from E an element " that has its maximum conjugate at the same position as a, but with a di erent sign. Recall that the sign of a nonzero real number , denoted by sign( ) is +1 if is positive, ?1 if it is negative. Lemma 5.2. Let a 2 Z[n]+ \ (0; 1), Pmi=0?1 ja(i)j  mM , maxconj(a) =: ja(l)j, and e := sign(a(l)). Further let b := a +P"l if e = ?1, and b := a + "l+m?1 if e = 1, where ?1 (i) the "` are de ned as above. Then m i=0 jb j  mM . Pm?1 jb(i)j  (l) (l) Proof. Let " := b ? a . Suppose rst that j a j  j " j . Then i=0 P (ja(i)j + j"(i)j) + ja(l)j ? j"(l)j  P ja(i)j + ja(l)j  mM , since by Condition (b) i =l 6 i6=l P on E we have j"(l)j  i6=l j"(i) j. Pm?1 jb(i)j = Pm?1 ja(i) + "(i)j  (l) (l) Suppose now that j a j < j " j . Then i=0 P ja(i) + "(i)j + j"(l)j ? ja(l)j  P (ja(l)j + j"(ii)=0 j) + j"(l)j ? ja(l)j  (m ? 2)ja(l)j + i6=l i6=l 2j"(l)j < mj"(l)j  mM , where the last inequality follows from Condition (c) on E . 2 The idea of the approximation algorithm is now fairly simple. We compute sets E` for di erent `  M and starting from 0 we improve our approximation by adding elements from the sets E` until no further improvement is possible. Using Lemma 5.2 we know that we can always nd such elements without violating the bound on the size of the coecients. If ` < M , we increase the value of k and start all over again. Suppose that we have found sets E2k := f"1;k ; : : :; "2m?2;k g for 0  k  blog M c, m?2 " and such that Conditions (a)-(c) are satis ed. Let max(E2k ) := maxi2=1 i;k 2m?2 min(E2k ) := mini=1 "i;k . The General Approximation Algorithm (GAA) is given in pseudocode in Figure 5.1.

Theorem 5.3. Algorithm GAA computes an element a 2 Z[n] such that ja?!j 

max(E2blog M c ) and uses no more than

+

XM c max(E2k?1 ) 1 + blog min(E1) k=1 min(E2k ) iterations. Proof. At step k  1 the di erence between the a's obtained from two successive runs of the inner loop is at least min(E2k ) and the inner loop terminates i ! ? a
< f+g; if > 0 if < 0 ; sgn( ) := > f?g; : f+; ?g; if = 0

Approximation of Complex Numbers

16

P

For a = 3i=0 i i 2 Z[ ]+ let sgn(a) := sgn( 0)      sgn( 3), and, ?sgn(a) := sgn(?a). Examples are sgn(1 ? 3) = f(+; +; +; ?); (+; +; ?; ?); (+; ?; +; ?); (+; ?; ?; ?)g and sgn(1 + 1 ? 2 + 3 ) = f(+; +; ?; +)g. For  = (0 ; : : :; 3) 2 f+; ?g4 let wt( ) := jfi j i = +gj and de ne wt(a) := fwt() j  2 sgn(a)g. Hence wt(1 ? 3) = f3; 2; 1g. The following properties of the sgn-function can be easily veri ed.

Remark 6.1. Let a = Pi ii 2 Z[ ] \ [0; 1]. Then 3 =0

+

(a) jsgn(a)j = 16 , a = 0 , 4 2 wt(a), (b) jsgn(a)j = 8 , a = 1, (c) a 62 f0; 1g , jsgn(a)j 2 f1; 2; 4g. (d) If k 2 wt(a) then jfi j i  0gj  k and jfi j i  0gj  4 ? k. An important relationship between the wt-function and the bound on the coecients is given in the next lemma. Lemma 6.2. Let M  4 and a = P3i=0 ii 2 Z[ ]+M \ (0; 1). (a) If 3 2 wt(a) then there exists i such that 0  i  32 M . (b) If 1 2 wt(a) then there exists i such that 0  i  ? 32 M . Proof. (a) There are three i  0 by Remark 6.1(d). Suppose that all of them are > 2M=3. Then a > M (2(1 + 2 + 3 )=3 ? 1 ) > 1 for M  4, a contradiction. (b) There are three i  0 by Remark 6.1 (d). Suppose that all of them are < ?2M=3. Then a < M (?2(1 + 2 + 3 ) + 1 )=3 < 0 for all M , a contradiction. 2

6.2. The Main Idea. The main idea of the approximation algorithm is to start with zero and then to increase the value of the current approximation step by step by adding a small algebraic integer with inverse signature. This ensures that the coecients of the sum are still bounded in absolute value by M . This idea is captured in the following result. Lemma 6.3. Suppose that a; b 2 Z[]M and sgn(a) \ (?sgn(b)) 6= ;. Then a + b 2 +

Z[ ]M . +

17

Approximation of Complex Numbers

P

P

Let a = 3i=0 i i and b = 3i=0 i i . The assumption implies that i i  0 for all i = 0; : : :; 3. Since j ij; j ij  M , we obtain j i + i j  M for all i = 0; : : :; 3. 2 We have thus to construct a set of small elements of Z[ ]+M having all possible signatures. The following lemma shows that it is enough to construct a set with six appropriate signatures, if we make a small sacri ce on the bound M . This new set is going to play the role of the set EM from Section 5. Let 1 := (+; ?; ?; +), 2 := (+; +; ?; ?), 3 := (+; ?; +; ?), and for M 2 N let EM := f"1; : : :; "6g  Z[ ]+M be such that i 2 sgn("i ) and ?i 2 sgn("i+3 ), i = 1; 2; 3. Proof.

Lemma 6.4. Let a = Pi ii 2 Z[ ]M \ (0; 1). Then there exists " 2 EbM= c such that a + " 2 Z[ ]+M .

3 =0

+

3

Proof. If sgn(a) \ f1 ; 2; 3 g = 6 ; then apply Lemma 6.3.

Suppose sgn(a) \ f1 ; 2; 3g = ;. Then either 1 2 wt(a) or 3 2 wt(a). Suppose that 3 2 wt(a), and let j := minf ij i  0g. Since 2 2 wt(a ?P j j ), there exists " 2 EbM=3c such that sgn(a ? j j ) \ (?sgn(")) 6= ;. Let b := 3i=0 i i := a ? j j + ". Then for i 6= j we have j ij  M and for i = j we have j ij  M=3. Hence b + j j = a + " 2 Z[ ]+M , since j  2=3M by Lemma 6.2. The case 1 2 wt(a) is handled analogously. 2 As in Section 5 we construct EM from a smaller set EM0 having only three elements with disjoint signatures. The missing signatures can be obtained by multiplying with appropriate elements of Z[ ]+.

Lemma 6.5. Suppose that EM0 = f" ; " ; " g is such that sgn("i) \ fi; ?ig 6= ;, 1

2

3

and "i 2 Z[ ]+M=3 \ (0; 1=2) for i = 1; 2; 3. Let EM := f"1 ; "2; "3; "1(2 ? 1); "23 ; "31 g. Then

(a) (b) (c)

EM  Z[ ]+M \ (0; 1). EM = f"1; : : :; "6g with i 2 sgn("i) \ (?sgn("i+3 )), i = 1; 2; 3. max(EM )  2 max(EM0 ), min(EM ) = 1 min(EM0 ).

Part (c) is obvious, so we concentrate on the rst two parts. Let "1 = + +  2 i i Z[ ]bM=3c be such that 1 2 sgn("1). We prove that (2 ? 1)"1 2 Z[ ]M i and sgn((2 ? 1)"1) [ sgn("1 )  f1 ; ?1g. Note rst that we have

Proof. P 3 =0

(2 ? 1)"1 =: 0 + 11 + 22 + 33 = (2 2 ? 0 ) + 1 3 + 2 ( 0 ? 2 ) + 3 ( 1 ? 2 3 ) 2 Z[ ]+M ;

Approximation of Complex Numbers

18

Precomputation: Sets E k for 0  k  blog(M )c as described above. Input: ! 2 [0; 1], M 2 N. Output: a 2 Z[ ] M \ (0; 1), ja ? !j  max(E b M c )=M a := 0 for l = 0 toPblog(M )c do while i ii < ! do if there exists " 2 E l such that sgn(") \ (?sgn(a)) =6 ; then a := a + " else if 3 2 wt(a) then j := minf i j i  0g Find " 2 E l such that sgn(") \ (?sgn(a ? j j )) = 6 ; a := a + " else j := minf i j i  0g Find " 2 E l such that sgn(") \ (?sgn(a + j j )) = 6 ; 2

+ 9

2 log(

)

3

3 =0

2

2

a := a + "

2

Figure 6.2: Approximation By Signatures (ABS) in Z[e2i=16]+ as i  M=3. Furthermore, a direct calculation shows that sgn( i ) = ?sgn( i ) for all i. The other cases dealing with multiplication with 3 and 1 are handled analogously. 2 The algorithm Approximation By Signatures (ABS) is given in Figure 6.2 and will be analyzed later in this section. The basic precomputation step of this algorithm is the construction of sets E2k := f"1;k ; : : :; "6;k g, 0  k  blog M c, satisfying i 2 sgn("i;k ) and ?i 2 sgn("i+3;k ), i = 1; 2; 3.

6.3. Construction of EM0 and Analysis of ABS. It remains to construct EM0 . Once again, EM0 will consist of cyclotomic units. P 3 By (2.3) we know that for a = i=0 i i 2 Z[ ]+ \ (0; 1) the equation ( 0 ; 1; 2; 3) = (a; a(1); a(2); a(3))  T ?1 holds. Using Lemma 3.2 and Example 3.3, we get the following explicit form: 0 1 2 1 2 3 B 2 ?3 ?2 1 CC ( 0; 1; 2; 3) = (a; a(1); a(2); a(3))  81 B B@ 2 ?1 2 ?3 CA : 2 3 ?2 ?1

19

Approximation of Complex Numbers

From this equation we can derive a relationship between the position of the maximal conjugate of an element and its signature.

  Proposition 6.6. Suppose that ja i j   Pj6 i; ja j j = for some i 2 f1; 2; 3g. ( )

8 >  > > ? > <  sgn(a) 3 > ? > >  > : ?

Then we have

1

1 2

2 3

3

1

if if if if if if

( )

= 0

i=1 i=1 i=3 i=3 i=2 i=2

3

a(1)  0 a(1)  0 a(3)  0 : a(3)  0 a(2)  0 a(2)  0

Proof. Suppose that i = 1, a(1) > 0. Then 3 X 0 = 14 a(k)  14 (a(1) + a ? ja(2)j ? ja(3)j)  a4  0; k=0 1 = ( a ?  a(1) ?  a(2) +  a(3))  1 a < 1;

8

1

1

3

1

8

3

2  82 (a + ja(2)j + ja(3)j ? a(1))  28a < 1; 3  83 a  0:

The remaining cases can be proved analogously. 2 The next theorem gives sucient conditions for elements " to belong to the set EM0 .

Theorem 6.7. Suppose that a 2 P

\ (0; 1) is such that ja i j  P  j6 ;i ja j j = for some i 2 f1; 2; 3g, and j ja j j  4M ?1. Then a 2 Z[ ]M and sgn(a) \ fi ; ?ig = 6 ;: 1

=0

( )

Z[ ]+

3

( )

3 =1

( )

+

Proof. The assertion on sgn(a) has been proved in the previous proposition. The

other claim is obtained using Lemma 3.4:

X

L1 (a)  41 ja(i)j  41 (4M ? 1 + 1) = M: 2 i=0 3

As in the general case in Section 5, we choose the elements of EM0 as power products of i :=  i (1 ?  )=(1 ?  2i+1 ), i = 1; 2; 3.

Approximation of Complex Numbers

20

Q

Suppose that " = 3j =1 jkj and that i is such that j"(i) j  2 31 j"(j )j for j 6= i; 0, and (1 + 31 )j"(i)j  4M ? 1. Then " satis es the assumptions of the above theorem. Taking logarithms we obtain;

X 3

l=1

and

kl(log jl(j)j ? log jl(i)j)  ? log(2) ? log(1) + log(3)

X 3

l=1

kl(log jl(i)j  log(4M ? 1) + log(1 ) ? log(1 + 3 ):

P Minimizing l kl log jlj subject to the above inequalities gives an Integer Linear 3 =1

Programming problem in three variables k1; k2; k3. Exactly in the same way as in Section 5 one can prove that the optimal value of the objective function of this ILP is O(M ?3 ). Now we can analyze Algorithm ABS along the same lines as Algorithm GAA.

Theorem 6.8. Algorithm ABS computes the desired output in less than c log(M )

iterations, where c is an absolute constant. Proof. (Sketch) Let k := blog(M )c. In the same way as we did in Theorem 5.3 we prove that ABS computes the desired output in no more than

XM c max(E2k?1 ) 1 + blog min(E1) k=1 min(E2k ) iterations. Hence, it suces to show that max(E2k ) and min(E2k ) are (M ?3 ). But this follows from the above discussion and Theorem 4.4. 2

7. Implementations

In this section, we report on our implementations of the algorithms GAA (for

n = 5) and ABS. We start with the approximation algorithm using 32nd roots of

unity.

7.1. 32nd roots of unity. In a preprocessing phase we computed sets E` for

a special sequence of `'s described below. The resulting ILP's were solved by the Integer Linear Programming Package lp_solve [2]. All the computations in the eld Q(e2i=32) including those of the units were done with the package PARI [1]. For each element found in this way, we also computed and stored all the conjugates. This data is used by the approximation algorithm to reduce computing the conjugates of the approximations to table-lookups and additions/subtractions.

Approximation of Complex Numbers

21

Table 1: Number of iterations of GAA for n = 5

M

45 58 70 80 103 118 143 182 213 238 274

est. worst case impl. 723 26 1157 37 1302 39 1356 43 1405 48 1579 57 1866 91 2333 103 2392 110 2453 103 2511 104

M

355 452 509 638 653 827 1092 1196 1481 1938 2187

est. worst case impl. 2665 135 2695 117 2817 126 2955 131 3165 142 3324 156 7504 185 7815 174 7899 166 8145 158 8211 204

To avoid a large number of iterations, we had to design the sets E` in such a way as to minimize the sum given in Theorem 5.3. Deviation from the sequence ` = 2k to ` = b1:2k c resulted in a good tradeo between the number of iterations and the amount of memory used to store all the E` . The theoretical upper bounds for the worst case running time (obtained via Theorem 5.3) for di erent M are compared in Table 1 with the maximum number of iterations performed for 1000 random numbers in the interval [0; 1].

7.2. 16th roots of unity. The units giving rise to the sets E k were computed by 2

solving the Integer Linear Programming problems of Section 6. Using these units we have computed upper bounds for theoretical worst case running times (in terms of the number of iterations) of the approximation algorithm as given in Theorems 5.3 and 6.8. The results are summarized in Table 2. The entry in the third column in that table gives the maximum number of iterations performed for 1000 random numbers in the interval [0; 1]. For the implementation of ABS we deviated a little from the algorithm given in Section 6 by replacing the single addition steps by multisteps obtained from multiplying the current unit by an appropriate multiple. This resulted in considerable savings of the running time, as is seen in the last column of Table 2.

7.3. Approximation of roots of unity. We used our algorithm to approximate

e2i=1024 by elements of Z[e2i=16]M and Z[e2i=32]M for various M . Roots of unity

of order a power of two are particularly important as they are used in radix 2 FFTalgorithms. Our approximation results are summarized in Tables 3 and 4. These tables clearly show the impressive change in dynamic range requirements when we switch from Z[e2i=16] to Z[e2i=32].

7.4. Scaling. We can approximate complex numbers in the unit circle by elements

of Z[ ]M =(M=4) rather than by those of Z[ ]M . This technique, called scaling is as

Approximation of Complex Numbers

Table 2: Number of iterations of ABS

M

48 96 192 384 768 1536 3072 6144 12288 24576 49152 98304 196608

est. worst case impl. enhanced 23 9 8 134 17 11 221 23 16 332 42 31 406 37 26 445 53 30 484 52 24 514 64 29 645 74 33 656 71 22 697 86 43 736 100 33 767 111 33

Table 3: Approximation of e2i=1024 by elements of Z[e2i=32]M . M 45 58 70 80 103 118 143 182 213 238 274 355 452 509 638 653 827 1092 1196 1481 1938 2187

0 4 -4 -4 5 2 2 3 -4 14 14 -34 -2 -2 -2 3 3 -36 23 23 54 205

3 2 3 3 -1 7 7 -4 4 -2 -2 -14 21 29 29 5 5 14 -65 -19 8 -115

-1 0 -1 -1 0 -6 -2 -1 0 -12 -12 -1 10 14 14 14 14 -62 56 -7 19 119

2 1 1 1 -2 2 1 4 0 3 3 18 13 16 16 -21 -21 -6 -92 29 -189 -324

-3 -3 -3 -3 2 -4 -10 -3 -13 3 3 15 -6 -7 -7 54 54 131 45 -68 173 269

1 -1 2 2 -2 2 6 8 0 3 3 -6 -43 -38 -38 -44 -44 -46 -151 9 -27 -89

Coecients 2 -4 3 2 -4 3 3 4 -2 3 4 -2 3 2 5 -2 1 5 -3 8 -7 -4 8 -16 6 7 1 -8 -4 1 -8 -4 1 6 18 1 -39 -1 1 -35 -6 -13 -35 -6 -13 21 -60 40 21 -60 40 -118 -58 159 33 -37 144 -150 127 -50 75 -119 56 159 -122 56

-2 -2 -2 -2 -4 -3 4 24 3 14 14 -8 11 6 6 -32 -32 36 7 171 -17 -14

0 0 -3 -3 -9 -4 -5 -26 -12 2 2 -12 33 37 37 51 51 -22 29 -154 -1 -85

1 3 -2 -2 2 -2 2 18 -2 -5 -5 4 41 46 46 -14 -14 -26 -51 109 87 149

-1 -1 3 3 0 6 0 -21 7 -9 -9 -21 0 -1 -1 -2 -2 59 69 -44 -61 -157

4 5 -3 -3 6 2 1 16 6 3 3 -12 -7 -4 -4 -5 -5 -54 46 167 -9 126

-5 -6 3 3 -6 0 4 -11 -6 6 6 -5 -16 -12 -12 4 4 -86 -156 -219 -135 -235

3 4 -1 -1 7 -1 -1 10 -6 0 0 12 -23 -15 -15 9 9 24 -41 5 168 291

Absolute error 0.0064690975925 0.0055076967698 0.0002526805055 0.0002526805055 0.0000826104368 0.0000591644332 0.0000363813739 0.0000050421465 0.0000009374573 0.0000002046956 0.0000002046956 0.0000000335135 0.0000000275519 0.0000000020860 0.0000000020860 0.0000000005213 0.0000000005213 0.0000000000594 0.0000000000152 0.0000000000071 0.0000000000004 0.0000000000003

22

Approximation of Complex Numbers

23

Table 4: Approximation of e2i=1024 by elements of Z[e2i=16]M .

M

96 192 384 768 1536 3072 6144 12288 24576 49152 98304 196608 393216

0 16 30 -49 -109 -13 -279 -19 2102 3033 -2606 -1020 14984

-1 14 22 98 -80 -14 817 1287 -3775 -2525 2062 -10992 -52173

Coecients Absolute error -6 5 1 1 0 -5 0.0164480060092 20 -12 -21 -6 4 40 0.0032793605419 -51 -5 -24 69 -3 -14 0.0001455843210 33 -84 37 -108 119 -12 0.0000134058600 -226 132 182 32 -40 -300 0.0000021850237 -22 -123 216 -85 50 -100 0.0000000836765 354 -244 -867 -174 968 15 0.0000000236388 -1446 1001 -971 83 708 -3 0.0000000013689 3899 -4872 4598 -2134 1035 -443 0.0000000003403 -16 465 -2921 5445 -2552 635 0.0000000000214 -2620 6018 -6008 8756 -12278 5498 0.0000000000062 -9535 14226 9254 -12248 7467 -14144 0.0000000000013 2855 -2070 26775 24690 -30325 -21645 0.0000000000001

follows: suppose that ! is a complex number inside the unit circle, and let !1 and !2 be its real and imaginary part respectively. Let j := !j M=4. We rst approximate j ?bj c by a number in Z[ ]+M=4. Adding bj c to this number gives an approximation j of !j M=4 in Z[ ]+M=2, and := 1 + i 2 gives an approximation of !M=4 in Z[ ]M. Hence, =(M=4) is an approximation of ! in Z[ ]M =(M=4), which is usually much better than a corresponding approximation in Z[ ]M . For instance, using this scaling technique we obtain an approximation of e2i=1024 as 1 (?1943 7 + 2840 6 ? 6374 5 + 5136 4 + 362 3 + 386 2 ? 1347 + 96999) 98304 with an absolute error of less than 1:3  10?15.

7.5. Running times and Further Remarks. Compilation of Table 1 took 17 seconds on an ULTRASPARC-1. Note that it consists of 22000 approximations of real numbers in [0; 1]. Table 2 which accounts for 13000 approximations took 0.7 seconds on the same machine. Table 3 used 0.04 seconds, and Table 4 used under 0.01 seconds of CPU time on the same machine. The tables also show that the bounds we have obtained on the range of the approximation is quite pessimistic. This experience is supported by a great many examples that we computed with our program.

8. Extension to other Fields

In this section we prepare the ground for a far reaching generalization of the main results of this paper. We will start with the characterization of those complex

Approximation of Complex Numbers

24

numbers w such that Z[w] is dense in C , see Theorem 8.1. This theorem has been taken from Clausen and Shokrollahi [3]. It turns out that the necessary conditions for this to hold are also sucient: if w is neither real nor an algebraic integer of degree 2 (in which case Z[w] is a lattice), then Z[w] is dense. Theorem 8.1. For a complex number w the following statements are equivalent. (a) Z[w] is dense in C . (b) w 62 R and w2 62 Z+ Zw. Proof. It is obvious that (a) implies (b), hence we focus on the converse. The proof proceeds in several steps. Claim 1: if t 2 C n R and jtj < 1 then Z[t] is dense in C . To prove this note that, according to our assumptions, all Um := Ztm + Ztm+1 are 2-dimensional lattices in C . Hence, for every z 2 C there exist uniquely determined u; v 2 Zsuch that z ? (utm + vtm+1 ) 2 Pm := f tm + tm+1 j 0  ; < 1g: Since the diameter of Pm is smaller than jtjm and lim m!1 jtjm = 0, our rst claim follows. Claim 2: If w 2 C n R and Z[w] contains a non-zero t with jtj < 1 then Z[w] is dense in C . This is obvious by Claim 1, since Z[tnw]  Z[w] for all n. Now let w 2 C n R and w2 62 Z+ Zw. If Z[w] contains a non-zero t with jtj < 1 then (a) follows by Claim 2. So we are left with the case Z[w] \

o z 2 C jzj < 1 = f0g:

n

(8.5)

We are going to show that this case is impossible. To begin with, we note that is discrete, since by (8.5) the di erence of any two di erent elements in Z[w] has absolute value  1. Hence there exists t 2 Z[w] n R satisfying

Z[w]

n o jtj = min jzj z 2 Z[w] n R :

Claim 3: Z[w] = Z+ Zt.

To see this, let z 2 Z[w]. Since t is not real there exist a; b 2 Z and ; 2 R with j j; j j  1=2 such that z = (a + bt) + ( + t): Since t; z 2 Z[w] we have + t 2 Z[w]. But then, using t 62 R and jtj  1 (see (8.5)), we get j + tj  21 max(j1 + tj; j1 ? tj) < 21 (1 + jtj)  jtj: If + t 62 R we get + t = 0 by minimality of t. If + t 2 R then = 0; hence 2 Z[w]. Combining this with j j  1=2 we get = 0, by (8.5). In both cases z 2 Z+ Zt and our claim follows.

Approximation of Complex Numbers

25

To nish the proof we derive the contradiction w2 2 Z+ Zw. By Claim 3 we already know that w = a + bt and t2 = c + dt for suitable a; b; c; d 2 Z. Hence

w2 = (a + bt)w = aw + b(at + bt2) = aw + b(at + b(c + dt)) = aw + (a + bd)bt + b2c = aw + (a + bd)(w ? a) + b2c 2 Z+ Zw: This completes the proof of the Theorem. 2 In the same way as above we can also show that for real the set Z[ ] is dense in R if and only if is not an integer. This result suggests the following generalization of the general approximation algorithm GAA: suppose that Q(w) is a CM- eld [10, pp. 38], i.e., Q(w) = Q( )(i), where is a totally real element. Suppose further that we already know a set of units of the ring Z[wi + wi j i  0] with nonvanishing regulator, where bar means complex conjugation. Then in exactly the same way as in Section 5 we can construct an approximation algorithm in Z[w] whose worst case approximation error is O(1=M n ) if the absolute values of the coecients are bounded by M , where n is the maximal number of independent units of the ring. By Dirichlet's Unit Theorem [10] the number n equals [Q(w): Q]=2. Abelian number elds satisfy the above assumptions. Hence, our algorithm is readily extendable to all these elds.

References [1] C. Batut, D. Bernardi, H. Cohen, and M. Olivier. User's Guide to PARI-GP. Universite Bordeaux, 351 Cours de la Liberation, May 1995. Obtainable via anonymous ftp from megrez.math.u-bordeaux.fr. [2] M. Berkelaar. lp_solve 2.0 release. [email protected]. [3] M. Clausen and M. A. Shokrollahi. Dense Z-modules in C . Unpublished manuscript, 1988. [4] J.W. Cooley and J.W. Tukey. An algorithm for the machine calculation of complex Fourier series. Math. Comp., 19:297{301, 1965. [5] J. H. Cozzens and L. A. Finkelstein. Computing the discrete Fourier transform using residue number systems in a ring of algebraic integers. IEEE Transactions on Information Theory, 31(5):580{588, 1985. [6] R. A. Games. Complex approximations using algebraic integers. IEEE Transactions on Information Theory, 31(5):565{579, 1985. [7] R. A. Games. An algorithm for complex approximation in Z[e2i=8]. IEEE Transactions on Information Theory, 32(4):603{607, 1986. [8] M. W. Marcellin and Th. R. Fischer. Encoding algorithms for complex approximation in Z[e2i=8]. IEEE Transactions on Information Theory, 35(5):1133{1136, September 1989.

Approximation of Complex Numbers

26

[9] M. A. Shokrollahi and V. Stemann. Approximation of complex numbers in Z[e2i=8]. Technical Report TR{96{032, International Computer Science Institute, 1996. [10] L. C. Washington. Introduction to Cyclotomic Fields. Springer-Verlag, New York, 1982. M.A. Shokrollahi, V. Stemann

International Computer Science Institute 1947 Center Street, Suite 600 Berkeley, CA 94704{1198 USA

famin,[email protected]