Matrix multiplication: Difference between revisions

m
(→‎{{header|ALGOL 68}}: A recursive version sutable for a multicore processors.)
Line 101:
( -0.00, -0.00, -0.00, 1.00));
 
Alternatively, for multicore CPUs, the following recursive algorithm can be used:
SEMA spare cpus = LEVEL 2; # increase to match the number of CPU spare to allocate #
Line 119:
VOID: end :=a[MID a+1:] * b[MID b+1:]
);
IF LEVEL spare cpus <= 1 THEN ( # use existing CPU #
FOR thread TO UPB thread list DO thread list[thread] OD
) ELSE PAR ( # run in parallel #
Line 141:
VOID: ( 2 LWB b /= 2 UPB b AND LWB a /= UPB a | out[1 MID a+1:, 2 MID b+1:] := a[1 MID a+1:, ] * b[, 2 MID b+1:])
);
IF LEVEL spare cpus <= 1 THEN ( # use existing CPU #
FOR thread TO UPB thread list DO thread list[thread] OD
) ELSE PAR ( # run in parallel #