Example



next up previous WS Presentations Main Page
Next: Example Up: Document: ciao Previous: Example

Example

Is parallelized as:

:- module(user,[mmultiply / 3],ciao(q)).
:- entry(mmultiply(g,g,f)).
:- exit(mmultiply(A,B,C),[ground([A,B,C])],mmultiply).

mmultiply([],_1,[]).
mmultiply([V0|Rest],V1,[Result|Others]) :-
        multiply(V1,V0,Result)&
        mmultiply(Rest,V1,Others).

multiply([],_1,[]).
multiply([V0|Rest],V1,[Result|Others]) :-
        vmul(V0,V1,Result)&
        multiply(Rest,V1,Others).

vmul([],[],0).
vmul([H1|T1],[H2|T2],H1 * H2 + Result) :-
        vmul(T1,T2,Result).



Thu Jan 18 11:29:48 MET 1996 <herme@fi.upm.es>-<webmaster@clip.dia.fi.upm.es>