580 likes | 721 Views
CENG536 Computer Engineering Department Ç ankaya University . Advanced Computer Arithmetic Algorithms Of Non-Modular Operations Week 9. There are the group of non-modular (positional) operations that need information about whole value of the number.
E N D
CENG536 Computer Engineering Department Çankaya University Advanced Computer ArithmeticAlgorithms Of Non-Modular OperationsWeek 9
There are the group of non-modular (positional) operations that need information about whole value of the number. Determining number’s sign while comparing the numbers magnitude its important to know position of the number in the range. In many cases its enough to know number of interval, in which is located the number. Full range is divided in two parts, and analyzing in which part lies the number we decide about its sign. From knowing the number of interval in which is the number we know its sign. Comparing the values of two numbers we determine which is greater by analyzing sign of the difference. Introduction CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
For this analysis we introduce concept of correct pair for two digits iand I , if for the sum of two minimal pseudo-orthogonal numbers and takes place relationship and this pair of two digits iand iwill be non correct pair, if Additional parameter is the weight of the minimal orthogonal number that is the binary fraction of the length l for which takes place Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
for Connection between value of minimal pseudo-orthogonal number and its weight is defined by the next theorem. Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Theorem 16. If in system with moduli is given minimal pseudo-orthogonal number with weight of length l the value of is connected to weight by relationship (*) In accordance with definition of the weight of the number if the pair is non correct and adding minimal pseudo-orthogonal number to itself gives Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
or in another form If the pair is correct and from this or Combining inequalities we can write It is clear, that similar inequality may be written for any (**) Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Lets apply method of induction. Suppose (*) is correct for Lets show that its correct for Let there is (***) First of all we see that But basing on (***) we can write from which (****) Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Inequality (**) may be rewritten in form or but since then that proof the theorem. Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
First consequence of theorem. If for a given modulo pi there will be determined integer number ithat satisfies congruence then the following equality takes place (*****) where k is integer. Variable iis referred to as length of the weight Setting in (****), we get or because of definition for ithere is Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
we can write () that match to (*****) for Second consequence of theorem. From () follows representation of in form () Let there is given number Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
We form the sum using minimum numbers each of which have weight that is We suppose, that the least common multiple of numbers is such, that satisfies condition for . Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Now for each of selected minimal pseudo-orthogonal numbers for minimal weight of length in accordance to () we get and finally expression for the sum take the form () Lets state the theorem on minimal trace of the number. Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Theorem 17. • If there is the number that has weight • of length , which is not a multiple of the and has the trace , then the minimal trace of the given number is defined by equality • In accordance with () and the conditions of the theorem • we have • Therefore, number MA is in interval, which is separated from the interval by value . Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
As minimal form A* of the number A has trace and number A has trace SA, then and from this that is the assertion of the theorem. This method affords to accurately determine the value of minimal trace of number and the interval in which it is located. Comparison of and SA gives precise value of the character of the number. Operating with the numbers in wide range, length of the weight in general case needs to add long numbers, which makes this method difficult to implement. Method of Weight Characteristics CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Method of Zeroing CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Zeroing is such method of number transforming, which leads to increasing of zeros in representation of the number at each stage of algorithm realization, and no transition of the number being converted over the range. Minimal zeroing number is the minimal number of form (*) where It is evident, that total number of minimal zeroing numbers for given system of moduli will be . Method of Zeroing CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Theorem 18. (The limiting zeroing theorem.) • Let in system of moduli is given a number • that is located in interval • and let is given a minimal zeroing number • Then, the sum of this numbers • is located in the same interval or on its right border. Method of Zeroing CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
If the minimal zeroing number will be added to A, the result will not be greater than If there will takes place inequality There will be possible select a number from numbers (*) which will satisfy condition But in this case there will take place inequality which violates definition of minimal zeroing number. From this follows Method of Zeroing CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Theorem 19. • Let in system of moduli is given a number • and after applying to this number method of zeroing by using minimal zeroing numbers is obtained number of form • then the minimal trace of A will be determined from equality • (*) • Consistently applying zeroing theorem to A and to intermediate results (n-1) times, we get Method of Zeroing CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Number A will be in interval As minimal trace of A is a such digit by last modulo that the number is in first interval, the minimal trace may be determined by analyzing and . Lets examine different relationships between these residues. Case 1. Let By definition of minimal trace follows that that coincides to (*). Case 2. Let Here the minimal trace will be determined as that again coincides to (*). Method of Zeroing CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Lets illustrate method of zeroing in system with moduli For sequential zeroing we need the minimal zeroing numbers. By modulo By modulo By modulo Method of Zeroing CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
By modulo • Example: • Lets realize sequential zeroing of A = (0, 1, 3, 4, 13) and determining of its minimal trace. • Step 1. Method of Zeroing CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Step 2. Step 3. Step 4. Because and from we get Method of Zeroing CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Let there is the system of moduli , range P1, orthogonal bases that have weights By definition In this system is given number Now let there is expanded system , in which is included additional modulo range of which is orthogonal bases and their weights are and Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Number A in this system will be of form We need, knowing digits in basic system, determine value of number A in expanded system of moduli. It's evident, that number A in expanded system will be correct number; by other words, we need to determine minimal trace of number in expanded system. Let’s write expressions for A in basic and expanded systems Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Equating right hand parts of these equations we determine value of residue by modulo or (*) To simplify this equation we proof the lemma. Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Lemma 1. If there is the basic system of moduli that has range P, and weights of orthogonal bases and there is expanded system of moduli that has range and weights of orthogonal bases then the value is multiple to pi. In accordance to definition of the orthogonal basis we have or, in another form Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
By the same way there we have or where - integer non negative numbers. Producing subtraction gives As P has piin first power and in right hand part is the factor pi2in second power, then should have factor pi, that proof the lemma. Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Lets introduce integer number Then equation (*) nay be presented in form or (**) The value is called a generalized sum of digits of number A or simply generalized sum. Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
We represent A in form where k and q are integer non negative numbers, and Now, equation (**) may be represented in form or (***) This expression is the formula of range expanding or, in other words, transition from representation of number in main range to representation of number in expanded range. Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Now we should analyze how to use this formula to represent the number in expanded range. As we know, for the given system of moduli there exist one and the only one set of minimal pseudo-orthogonal numbers. These numbers are: By modulo p1: with the ranks By modulo p2: with the ranks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . By modulo pn-1: with the ranks Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Constructing the number by adding minimal pseudo-orthogonal numbers we get That has rank (rank of the sum theorem) (****) After this operation we have number MA, that has known rank and that match by all digits with original number A except the digit by last modulo. Then, we know, that as it is obtained by summing of n – 1 minimal pseudo-orthogonal numbers, its largest possible value is (*****) and its located to the left of (n – 1) interval P/pn. Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
For the expanded system of moduli there is another set of minimal pseudo-orthogonal numbers. For example, minimal pseudo-orthogonal numbers by modulo pn are of form and are determined by the formulas Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Hereinafter, each of these numbers will accompany by index that shows their multiplication factor with respect to smallest number. Expanding number MA by using (***) and value of rank (****) gives In expanded system number A’ differs of A by last two digits. Because expansion does not change the value of number, but redefines digit by modulo pn-1, from (*****) we know, that it is not greater than i.e. its lie in first interval of expanded system and is correct number. Now lets add to A’ such a minimal pseudo-orthogonal number that digit by modulo pn to n, that is with multiplication factor where Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
After addition there will be created number If there was satisfied transform of the A’ is not necessary and we have If we have For this case, if multiplication factor of was not greater than i.e. there is possible to declare, that is the expansion of A, as to number which is not greater then is added number Which is not greater than and the sum of this numbers is not greater than P. Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Indefiniteness arises when In this case number may be located in last parts of first interval or in first parts of second interval and then the desired number is Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Lets illustrate this method analyzing an example. Let the main system is presented by moduli The orthogonal bases and the weights are: Main range of the system is Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Lets calculate minimal pseudo-orthogonal numbers with their ranks and multiplication factors. By modulo p1=5: Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
By modulo p2=7: Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
By modulo p3=11: Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
By modulo p4=13: Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
By modulo p5=17: Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
By modulo p6=19: Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Let the expanded system is created by using moduli with expanded range that has parameters: Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
Minimal pseudo-orthogonal numbers and multiplication factors: By modulo p1=5: Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
By modulo p2=7: Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
By modulo p3=11: Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV
By modulo p4=13: Method of the range expanding CENG 536 - Spring 2012-2013 Dr. Yuriy ALYEKSYEYENKOV