0 12 3 1 0 4 1 3 5 01 3 6 6 0 0 0 0 0 1 3 7 6 class10 ppt 0 7 6 0 3 01 33 33 33 0 9 3 1 00 0 3 7 3 0 0 1 0 0 8 6 0 3 Page 1 8 0 3 1 1 6 0 10 01 6 4 01 33 0 1 6 0 1 10 6 1 0 01 33 0 01 0 0 01 0 33 0 1 1 1 3 3 0 0 1 6 0 1 3 3 1 00 9 001 31 8 3 0 3 33 4 0 0 7 6 0 3 0 0 3 3 5 0 3 6 3 30 for i int ni for j a ni 6 0 01 3 8 0 0 01 0 3 01 01 9 for i 0 i n i for j 0 j n j a n i j b j DE 0 3 b b j p p j loop scaled by 4 b j scaled by 4 if j n 3 1 F int ni 0 for i 0 i n i for j 0 j n j a ni j b j ni n 0 50 3 06 1 0 1 0 01 C i n a p a i n scaled by 4 6 6 0 1 0 3 x 4 3 B 0 i n i n i a ni 0 j n j b j D 01 1 imull ebx eax movl 8 ebp edi leal edi eax 4 edx Inner Loop L40 movl 12 ebp edi movl edi ecx 4 eax movl eax edx addl 4 edx incl ecx jl L40 0 i n i n i 0 j n j j b j 16 x 1 for i int ni int p for j p for i 0 i n i for j 0 j n j a n i j b j 0 3 6 0 for i 0 i n i for j 0 j n j a n i j b j A 16 6 00 06 1 001 0 0 0 G Page 2 6 0 0 0 1 3 E0 4 0 0 9 0 3 4 3 0 0 I 9 I 1 int inj i n up val inj down val inj left val inj right val inj sum up down 9 B I 5 001 0 0 6 8 B 5 I 0 1 01 6 8 4 0 00 7 9 G 8 6 1 L L 5I B Page 3 1 0 L 8 4 3 3 0 1000 900 800 700 600 500 400 300 200 100 0 vsum1 0 L vsum2 0 L 0 0 H 50 1 0 3 0 30 N N 3 7 K M K 0 8 L 9 5 for i 0 i n i 2 c i a i b i c i 1 a i 1 b i 1 1 0 void vsum2 int n int i for i 0 i n i c i a i b i 00 7 K G 1 0 K 0 8 50 9 5 0 0 01 I 4 3 1 0 void vsum1 int n int i 0 8 1 0 3 1 0 3 L34 0 j n n 1 1 left right 0 0 1 001 4 0 DEJE 3 H H 0 1 Sum neighbors of i j up val i 1 n j down val i 1 n j left val i n j 1 right val i n j 1 sum up down left right E D 4 1 0 50 O 100 3 50 150 200 F E 0 1 2 length data 54 void combine1 vec ptr v int dest int i dest 0 for i 0 i vec length v i int val get vec element v i val dest val length 1 vec ptr new vec int len 3 3 0 int get vec element vec ptr v int index int dest 0 I 3 3 3 3 0 int get vec start vec ptr v 0 1 5 06 1 0 0 3 00 0 9 3 0 0 3 0 3 3 0 8 1 0 9 void combine1 goto vec ptr v int dest int i 0 int val dest 0 if i vec length v goto done 1 iteration loop get vec element v i val dest val i if i vec length v goto loop done 33 50 0 1 0 F 3 00 0 P void combine1 vec ptr v int dest int i dest 0 for i 0 i vec length v i int val get vec element v i val dest val 0 8 54 0 3 0 3 int vec length v vec ptr v 0 5 Page 4 1 vec length 0 00 1 06 1 vec length 00 3 54 void combine2 vec ptr v int dest int i int length vec length v dest 0 for i 0 i length i int val get vec element v i val dest val 00 vec length F 0 5 3 54 01 3 0 0 3 3 0 256k 128k 64k 32k 16k 8k 4k 2k 00 HHG void lower char s int i 0 if i strlen s goto done loop if s i A s i Z s i A a i if i strlen s goto loop done 30 6 1k strlen 4 256 0 G 1000 100 10 1 0 1 0 01 0 001 0 0001 512 6 3 H 6 Q void lower char s int i for i 0 i strlen s i if s i A s i Z s i A a C 6 4 0 vec length 0 3 9 0 2 0 strlen 0 Page 5 00 3 1 3 03 0 3 6 void lower char s int i int len strlen s for i 0 i len i if s i A s i Z s i A a 0 3 0 30 6 0 6 3 10000 0 6 100 0 6 1 00 strlen 30 3 0 01 0 0001 0 0 1 strlen 1 strlenR 8 0 3 0 0 0 vec len R 8 3 00 0 1 strlen 0 0 0 1 0 8 3 00 33 00 33 0 3 3 0 vec len R 0 1 256k vec len 128k 64k 32k 16k 8k 4k 2k 512 256 1k 0 000001 3 lower 0 4 0 6 strlen 3 int square int attribute const 8 3 1 strlenR Page 6 0 0 8 3 vec len 0 1 strlen 1 1 strlenR 1 00 33 33 0 3 0 0 0 0 4 R vec len 0 R 3 1 8 0 8 8 3 6 void combine2 vec ptr v int dest int i int length vec length v dest 0 for i 0 i length i int val get vec element v i val dest val 33 vec len 0 0 …
View Full Document