CENG536 Computer Engineering Department Çankaya University.

40
Advanced Computer Arithmetic RNS in the Complex Domain Week 13 CENG536 Computer Engineering Department Çankaya University

Transcript of CENG536 Computer Engineering Department Çankaya University.

Page 1: CENG536 Computer Engineering Department Çankaya University.

Advanced Computer Arithmetic

RNS in the Complex Domain Week 13

CENG536Computer Engineering Department

Çankaya University

Page 2: CENG536 Computer Engineering Department Çankaya University.

Introduction

2

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

Page 3: CENG536 Computer Engineering Department Çankaya University.

Introduction

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

3

In famous “Disquisitiones Arithmeticae” of German mathematician Carl Friedrich Gauss there were introduced integer complex numbers a + bi, where a and b are integer real numbers and , on the base of which was built the theory of congruences of the integer complex numbers. Hereinafter the “complex number” we mean “integer complex number”, unless otherwise specified. Let there is

,then numbers

obtained by multiplying of by – 1, i, and – i are numbers associated with number . Number obtained from by replacing of i by – i is conjugated number. Value

is the norm of complex number.

1i

Page 4: CENG536 Computer Engineering Department Çankaya University.

Introduction

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

4

Simple complex number is the complex number that can not be represented as a product of two complex numbers distinct of 1. In other case this number is a composite complex number. From this follows, that composite real number is at the same time a composite complex number. The reverse is not always true, for example

By the same way, any prime number of form

is the composite complex number, for example

If the prime numbers are represented as they can not be represented by this way and such numbers are the simple complex numbers.

Page 5: CENG536 Computer Engineering Department Çankaya University.

Introduction

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

5

Complex numbers poses important property of parity. As a complex “two” here is used number 1 + i . Complex number a + bi is odd if its not divisible by 1 + i. Complex number a + bi is even, if a and b are even. Such a numbers are always divisible by 1 + i. But there is another class of complex numbers, that are divisible by 1 + i, but they have odd values of a and b. This class of numbers is referred to as half-even complex numbers.

Page 6: CENG536 Computer Engineering Department Çankaya University.

Congruence of Complex Numbers

6

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

Page 7: CENG536 Computer Engineering Department Çankaya University.

Congruence of Complex Numbers

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

7

Complex number is multiple of complex number (or will be divisor of number ) if quotient of division is integer complex number.

Result of this division will be an integer complex number only if

The number is not divisible by if this condition is not satisfied. Let is such that is divisible of , so we can write

or is residue of number by modulo .

Page 8: CENG536 Computer Engineering Department Çankaya University.

Congruence of Complex Numbers

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

8

Example:Determine divisibility of numbers and Here we have

Necessary conditions are satisfied as

.

Page 9: CENG536 Computer Engineering Department Çankaya University.

Congruence of Complex Numbers

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

9

Theorem 27.Let there are numbers and let congruences are satisfied

(*)

In such case a congruence

will take place.

To proof we divide by that gives

Page 10: CENG536 Computer Engineering Department Çankaya University.

Congruence of Complex Numbers

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

10

To have after division integer complex number must be satisfied congruences

that are equivalent to (*). From this, if condition (*) is satisfied, the number is the residue of number by modulo

Page 11: CENG536 Computer Engineering Department Çankaya University.

Congruence of Complex Numbers

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

11

For complex numbers we cant say “greater” or “less” but may be introduced the least residue.If expressions xp + yq and yp – xq will be the least residui by real modulo p2 + q2, there may be determined complex number x + iy, that may be named the least residue of by modulo In other words, must be satisfied

Here should be distinguished least residues and absolute least residues. For first case we suppose that xp + yq and yp – xq are integer positive numbers that less then

p2 + q2 – 1 and for second case these values may be both positive and negative but by absolute value less than (p2 + q2) / 2.

Page 12: CENG536 Computer Engineering Department Çankaya University.

Congruence of Complex Numbers

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

12

If there are determined the least residues of expressions ap + bq

and bp – aq

of form

the least residue of number by modulo is

Page 13: CENG536 Computer Engineering Department Çankaya University.

Congruence of Complex Numbers

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

13

Example 1:Determine least residue of number by modulo

Lets write system of congruences

where ap + bq = 153 + 22 = 49 ,

bp – aq = 23 – 152 = – 24 .From this we have equations

Solving them gives i.e. 2 + 2i is the least residue.

Page 14: CENG536 Computer Engineering Department Çankaya University.

Congruence of Complex Numbers

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

14

Example 2:Determine absolute least residue of number by modulo

Here we have49 (mod 13) = 10 (mod 13) = – 3,

– 24 (mod 13) = – 11 (mod 13) = 2.that gives system of equations

Solving them gives i.e. – 1 is the absolute least residue.

Page 15: CENG536 Computer Engineering Department Çankaya University.

Fundamental Gauss Theorem

15

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

Page 16: CENG536 Computer Engineering Department Çankaya University.

Fundamental Gauss Theorem

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

16

If two sets of numbers may be mutually reflected one to another without distortion of correlation between them, i.e. if each element a from set will have connection to the only element a from set X, so that correlation between any element of X will take place between appropriate elements of X and vice versa, these sets are referred to as isomorphic.As it was state before, the least residue of any complex number a + bi by complex modulo p + qi may be determined solving system of real congruences

(*)

where r and r– the least residui by real modulo N = p2 + q2.

Page 17: CENG536 Computer Engineering Department Çankaya University.

Fundamental Gauss Theorem

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

17

For r and r are possible values from set and there is correlation between them. Lets determine this connection between r and r. Multiplying first equation of (*) by p and second by q and then subtracting second from first we get

or

If p and q are coprime (relatively prime) numbers, the congruence has the only solution

where

and z is such that t is integer and less than p2 + q2.

Page 18: CENG536 Computer Engineering Department Çankaya University.

Fundamental Gauss Theorem

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

18

Example:Determine all possible pairs of r and r for modulo

Because 3 and 4 are coprime numbers , we have

and congruence has solution .

This gives next pairs of r and r:

(Here is applied technique of enumeration).

Page 19: CENG536 Computer Engineering Department Çankaya University.

Fundamental Gauss Theorem

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

19

Theorem 28. (The fundamental Gauss Theorem 1)For given complex modulo that has norm

and p and q are coprime, every integer complex number is congruent to the only residue from the set

From the number theory we know, that for pair of coprime numbers p and q there is possible to find such integer numbers u and v that gives

Lets write an identity (its easy to check)

Let there is a complex number

Page 20: CENG536 Computer Engineering Department Çankaya University.

Fundamental Gauss Theorem

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

20

We rewrite it by changing representation of i by introduced value.

Lets denote by h the least positive residue of number by modulo N and determine

In such case will be satisfied equality

or in form of congruence

Page 21: CENG536 Computer Engineering Department Çankaya University.

Fundamental Gauss Theorem

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

21

This is the proof that a + bi is congruent to one of numbers by modulo

Now lets proof, that this number is the only number of that set. Let there are two congruences

According property of congruences numbers h1 and h2 are congruent by modulo i.e.

or

and this congruence may be replaced by

Page 22: CENG536 Computer Engineering Department Çankaya University.

Fundamental Gauss Theorem

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

22

From last equality follows, that will be true

(this is multiplication of both sides by conjugated modulo)which is equivalent next two real equalities

Multiplying first by u, second by v and adding them gives

From which, taking in account , follows

or (*)

By hypothesis and from which follows that for (*) be true we need

Page 23: CENG536 Computer Engineering Department Çankaya University.

Fundamental Gauss Theorem

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

23

This shows impossibility of presence of two numbers h1 and h2 less than N, which will be congruent to a + bi by modulo There is the only number that can be determined from congruence

or

This theorem states isomorphism between integer complex numbers and real residui, determined by method shown.

Definition: Expression uq – vp set up connection between complex and real residui by modulo p + qi and is referred to as isomorphism coefficient that will be denoted by .

Page 24: CENG536 Computer Engineering Department Çankaya University.

Fundamental Gauss Theorem

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

24

Example:Solve congruence 16 + 7i h (mod 5 + 2i).Here p = 5, q = 2 and N = 25 + 4 = 29.We need up + vq = 1. Substituting gives 5u + 2v = 1.

Selecting u = 1 and v = –2 produce5u + 2v = 51 – 22 = 1

Isomorphism coefficient of modulo 5 + 2i isr = uq – vp = 12 – (–2) 5 = 2 + 10 = 12.

Now, a + b h (mod N)16 + 712 h (mod 29) or h 13 (mod 29)

So, result is 16 + 7i 13 (mod 5 + 2i).

Page 25: CENG536 Computer Engineering Department Çankaya University.

Arithmetic in Complex Domain

25

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

Page 26: CENG536 Computer Engineering Department Çankaya University.

Arithmetic in Complex Domain

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

26

Lets check validity of the next statement. Let there are two numbers and .

Let for this numbers exist such and that

then, there will be correct

where N – is norm of

Page 27: CENG536 Computer Engineering Department Çankaya University.

Arithmetic in Complex Domain

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

27

We start from congruence introduced before(*)

Before this moment there were analyzed Gauss theorem and solution of this congruence having that p and q are coprime numbers. Now lets consider case of p , q and N = p2 + q2 having common factor d. Now we have p = ed , q = fd andN = (e2 + f2)d2.In concordance with (*) in this case there will be d solutions of form

Page 28: CENG536 Computer Engineering Department Çankaya University.

Arithmetic in Complex Domain

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

28

where satisfies congruence

, (**)

in which is satisfied condition of coprime property for e and f and solution of which is obtained by general way.

Page 29: CENG536 Computer Engineering Department Çankaya University.

Arithmetic in Complex Domain

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

29

Example:Determine all possible pairs of r and r for p + qi = 3 + 6i

For this example we have that congruence

will be of form

Here common factor is d = 3, and now p = 13, q = 23that give for

result of form

Solution of this congruence is

Page 30: CENG536 Computer Engineering Department Çankaya University.

Arithmetic in Complex Domain

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

30

This congruence has three groups of solutions

Here is the table for all pairs of Group 1.

Group 2.

Group 3.

Page 31: CENG536 Computer Engineering Department Çankaya University.

Arithmetic in Complex Domain

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

31

Gauss isomorphism theorem is established, for the modulo with relatively prime (coprime) components, that implementation of rational operations on a complex residui can be replaced by implementation of these operations with the corresponding real residui by modulo that equal to the norm of the complex modulo. These operations may be executed by using arithmetic units of traditional type and on the base of tables.For the complex modulo of which components have common factor, that means absence of isomorphism, mathematic operations may be realized by using real equivalents of complex residui only on the base of tables.

Page 32: CENG536 Computer Engineering Department Çankaya University.

Geometric Interpretation

32

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

Page 33: CENG536 Computer Engineering Department Çankaya University.

Geometric Interpretation

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

33

Complex numbers are represented by points on a plane. Let we apply rectangular system of coordinates (introduced by René Descartes) that has axes X and Y and point of origin O. Abscissa axis will be used for representation of real parts of complex numbers and ordinate axis – for imaginary parts. Point M with coordinates (p, q) represents complex number p + qi, line OM is value N, and the norm N is square area built on the line OM (square ORLM). Here OR = OM = RL = LM = N.

Page 34: CENG536 Computer Engineering Department Çankaya University.

Geometric Interpretation

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

34

X

Y

O

R

L

M

Page 35: CENG536 Computer Engineering Department Çankaya University.

The method of determining of boundaries

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

35

Let is given modulo and x + yi least residue by this modulo. Determining the boundaries should be satisfied conditions

or, in another form

For absolute least residues this equations will be of form

or

Page 36: CENG536 Computer Engineering Department Çankaya University.

The method of determining of boundaries

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

36

Geometric representationof full system of least residuesby modulo

Page 37: CENG536 Computer Engineering Department Çankaya University.

The method of determining of boundaries

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

37

Example:Determine full system of absolute least residues by modulo

System of inequalities will be of form

For there will possible values – 12, – 11, . . . , 0, 1, . . . , 12. From this system we get an equation

Value of x will get the largest positive value for

i.e. from which or

Page 38: CENG536 Computer Engineering Department Çankaya University.

The method of determining of boundaries

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

38

The smallest negative value x will have at

that gives

So for x possible values are – 3, – 2, – 1, 0, 1, 2, 3.Lets compute corresponding values for y.1.

Checking inequalities we state, that only y = 0 satisfies them.2.

Here we get

Page 39: CENG536 Computer Engineering Department Çankaya University.

The method of determining of boundaries

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

39

3.

Values of y are 4.

For y we have

5.

That gives6.

Here values of y are

Page 40: CENG536 Computer Engineering Department Çankaya University.

The method of determining of boundaries

CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV

40

7.

Where we get Totally we have N = 25 absolute least residues. All of them are inside the square, shown below.

xO