magistraleinformaticanetworking:spm:exercise1617spm
Differenze
Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.
Entrambe le parti precedenti la revisioneRevisione precedenteProssima revisione | Revisione precedente | ||
magistraleinformaticanetworking:spm:exercise1617spm [12/10/2016 alle 13:50 (9 anni fa)] – [Matrix multiplication] Marco Danelutto | magistraleinformaticanetworking:spm:exercise1617spm [12/10/2016 alle 15:36 (9 anni fa)] (versione attuale) – [Hints] Marco Danelutto | ||
---|---|---|---|
Linea 11: | Linea 11: | ||
* use < | * use < | ||
- | | + | < |
- | * use plain < | + | int main(int argc, char * argv[]) { |
+ | int n = atoi(argv[1]); | ||
+ | int m = atoi(argv[2]); | ||
+ | ... | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | | ||
+ | < | ||
+ | std:: | ||
+ | start = std:: | ||
+ | ... | ||
+ | end = std:: | ||
+ | std:: | ||
+ | </ | ||
+ | |||
+ | |||
+ | * use plain < | ||
+ | < | ||
+ | srand(123); | ||
+ | for(....) { | ||
+ | ... = ((float) (rand() % MAX)) / ((float) RAND_MAX); | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Average neighbours ===== | ||
+ | Write a program that generates an N by N matrix A and then executed a number Niter of iterations where at each iteration A[i][j] is substituted by the average of A[i][j] and the four neighbours (north, south, east and west). At the borders, the missing elements in the neighbourhood have to be assumed to be 0. All the new A[i][j] values must be computed summing up values **at the current iteration** for the neighbours. | ||
+ | Computation of the single iteration should be parallelized using threads. |
magistraleinformaticanetworking/spm/exercise1617spm.1476280225.txt.gz · Ultima modifica: 12/10/2016 alle 13:50 (9 anni fa) da Marco Danelutto