[Advcomparch] Διευκρίνιση στην εκφώνηση της 4ης άσκησης

Georgios Ioannidis el06041 at mail.ntua.gr
Fri Jun 18 04:47:59 EEST 2010


ÊáëçìÝñá óáò. Óôï ðáñÜñôçìá Á ôùí åêöùíÞóåùí ôçò 4çò óåéñÜò áñ÷éêïðïéåßôå ôïõò
ðßíáêåò ùò åîÞò:

init_matrix(A, N);
init_matrix(B, N);
init_matrix(C, N);

Ôá óôïé÷åßá ôïõ ðßíáêá C üìùò äåí èá ðñÝðåé íá áñ÷éêïðïéçèïýí óôï 0; Ãéáôß
Ýôóé üëá ôá óôïé÷åßá ðëçí ôïõ C[0][0] åßíáé ìç ìçäåíéêÜ êáé ëüãù ôïõ "C[i][j]
+=" ðïõ Ýðåôáé, ôï áðïôÝëåóìá ðïõ ðñïêýðôåé åßíáé ïõóéáóôéêÜ C=A*A+A áíôß ãéá
C=A*A. Áí êáé áõôü êáíïíéêÜ äåí áíáìÝíåôáé íá åðçñåÜóåé ôá áðïôåëÝóìáôÜ ìáò,
óùóôÜ;

Åðß ôç åõêáéñßá óôéò äéáöÜíåéåò ôçò "Lec6-caches-10.pdf", óåë. 33, õðÜñ÷åé ôï
åîÞò: for (j = jj; j < min(jj+B-1,N); j = j+1)
Ôï óùóôü äåí èá Ýðñåðå íá åßíáé: for (j = jj; j < min(jj+B,N); j = j+1) ??

×áñáêôçñéóôéêü ðáñÜäåéãìá üôáí B=1, jj<N ôüôå äåí ðñïêýðôåé êáíÝíá iteration
ãéáôß ãßíåôáé: for (j = jj; j < jj; j = j+1)

Åõ÷áñéóôþ



----------------------------------------
e-mail se latinikous xarakthres
----------------------------------------

Kalhmera sas. Sto pararthma A twn ekfwnhsewn ths 4hs seiras arxikopoieite tous
pinakes ws ekshs:

init_matrix(A, N);
init_matrix(B, N);
init_matrix(C, N);

Ta stoixeia tou pinaka C omws den 8a prepei na arxikopoih8oun sto 0? Giati
etsi ola ta stoixeia plhn tou C[0][0] einai mh mhdenika kai logw tou "C[i][j]
+=" pou epetai, to apotelesma pou prokuptei einai ousiastika C=A*A+A anti gia
C=A*A. An kai auto kanonika den anamenetai na ephreasei ta apotelesmata mas,
swsta?

Epi th eukairia stis diafaneies ths "Lec6-caches-10.pdf", sel. 33, uparxei to
ekshs: for (j = jj? j < min(jj+B-1,N)? j = j+1)
To swsto den 8a eprepe na einai: for (j = jj? j < min(jj+B,N)? j = j+1) ?

Xarakthristiko paradeigma otan B=1, jj<N tote den prokuptei kanena iteration
giati ginetai: for (j = jj; j < jj; j = j+1)

Euxaristw




More information about the Advcomparch mailing list