请输入您要查询的字词:

 

单词 MethodOfRepeatedSquaring
释义

method of repeated squaring


Theorem 1.

Given a semigroupPlanetmathPlanetmath S and an nZ+ then the functionf:SS defined by f(a)=an has an SLP representations ofcomputational length O(log2n). Inparticular, if we can compute anusing only O(log2n) multiplications.

Proof.

Let f0:SS be the map f(x)=x andf1:SS be defined by f1(x)=xx. So far werecognize that f0(x) evaluates to x1=x20 andf1(x) evaluates to x2=x21. But we caution thatwe do not define these functions with exponents because we wantto demonstrate that from an algorithm to multiply we can createan efficient algorithm to exponentiate.

For 1<ik define (recalling that fi+1 may use the outputof any previous fi evaluation)

fi+1(x):=f1(fi(x)).

Evidently, fi+1(x) evaluates to fi(x)2. By induction,fi(x) evaluates to x2i and thus fi+1(x) evaluates to(x2i)2=x2i+1. Therefore we establish that fj(x)=x2jfor all nonnegative integers j. Furthermore, to evaluate fj(x) usesj multiplications.

Now write n in binary: n=a020+a121++ak2k withai=0,1 for 0i<klog2n. Let 0i1<i2<<isk bethe indices for which ait0, 1ts. Then define

gn(x)=fi1(x)fi2(x)fis(x)

Thus, gn(x) evaluates to:

(x2i1)(x2i2)(x2is)=(x20)a0(x21)a1(x2k)ak
=xa020+a121++ak2k
=xn.

Because each fi+1(x) uses the output of fi(x), the cost ofevaluating gn is the cost of evaluating fis(x) plus the finalcost of multiplying fi1(x)fis(x). Thus, evaluating gnuses is+(s-1) multiplications. As slog2n it follows thatevaluating gn uses no more than 2log2n multiplications.∎

随便看

 

数学辞典收录了18232条数学词条,基本涵盖了常用数学知识及数学英语单词词组的翻译及用法,是数学学习的有利工具。

 

Copyright © 2000-2023 Newdu.com.com All Rights Reserved
更新时间:2025/5/5 0:14:13