' Tempi per moltiplicazione tra matrici (quadrate) ' -> Matematica e Calcolatore, sch.8, es.2 ' Per computer recenti il tempo di calcolo e' molto basso. Se vuoi rallentare ' l'esecuzione e esegui Step by Step (dal menu Debug o piu' semplicemente) ' premendo F8: tieni premuto F8, a richiesta introduci l'input, quando ' compare la finestra di lista ripremi F8, ... DECLARE SUB MOLT (A!(), B!(), c!(), m!, h!, n!) nmax = 80: DIM A(nmax, nmax), B(nmax, nmax) PRINT Via: PRINT "ordine max="; nmax FOR i = 1 TO nmax: FOR j = 1 TO nmax: A(i, j) = RND: NEXT: NEXT 10 INPUT ; "ordine"; n IF n > nmax THEN PRINT " -->> "; : GOTO Via t1 = TIMER MOLT A(), A(), B(), n, n, n t2 = TIMER PRINT TAB(15); FIX((t2 - t1) * 100); "(sec/100)" GOTO 10 SUB MOLT (A(), B(), c(), m, h, n) STATIC ' c() Š la matrice m*n prodotto di a() m*h per b() h*n FOR i% = 1 TO m: FOR j% = 1 TO n c = 0 FOR k% = 1 TO h: c = c + A(i%, k%) * B(k%, j%): NEXT c(i%, j%) = c NEXT j%, i% END SUB