PROGRAM mul USE naivmat USE bettmat USE dotmat IMPLICIT none real(kind=4), dimension(:,:), allocatable :: mat1, mat2, res real :: start, end integer :: dim = 10 DO WHILE (dim < 2000) call init_random_seed(123456) allocate(mat1(dim,dim)) allocate(mat2(dim,dim)) allocate(res(dim,dim)) call random_number(mat1) call random_number(mat2) call cpu_time(start) res = naivmull(mat1, mat2) call cpu_time(end) print '(I11," ",ES11.5)', dim, end - start dim = dim * 2 deallocate(mat1) deallocate(mat2) deallocate(res) END DO CONTAINS SUBROUTINE init_random_seed(seed) integer, intent(in) :: seed integer :: i, n call random_seed(size = n) call random_seed(put = (/ ((seed + i) * 37, i = 1, n) /)) END SUBROUTINE init_random_seed END PROGRAM mul