Ciao Preprocessor (integrated Alpha version)
 | This is an alpha distribution, meant only for testing. Please do let us 
 | know at ciaopp-bugclip.dia.fi.upm.es any problems you may have.

{Reading /tmp/tmp6Oabrw/mmatrix.pl
}
{loaded in 3432.214 msec.}
{preprocessed for plai in 4.0 msec.}
{analyzed by plai using det with local-control off in 40.002 msec.}
{written file /tmp/tmp6Oabrw/mmatrix_det_co.pl}
:- module(_1,[mmultiply/3],[assertions]).

:- entry mmultiply(A,B,C)
         : ( ground(A), ground(B) ).

:- true pred mmultiply(A,B,C)
         : ( native_props:mshare([[C]]), ground([A,B]), gnd(A), gnd(B), term(C) )
        => ( ground([A,B,C]), rt43(A), gnd(B), rt45(C) )
         + ( is_det, mut_exclusive ).

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

:- true pred multiply(_2,_1,_3)
         : ( native_props:mshare([[_3]]), ground([_2,_1]), gnd(_2), gnd(_1), term(_3) )
        => ( ground([_2,_1,_3]), rt32(_2), gnd(_1), rt37(_3) )
         + ( is_det, mut_exclusive ).

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

:- true pred vmul(_1,_2,Result)
         : ( native_props:mshare([[Result]]), ground([_1,_2]), gnd(_1), gnd(_2), term(Result) )
        => ( ground([_1,_2,Result]), rt25(_1), rt22(_2), num(Result) )
         + ( is_det, mut_exclusive ).

:- true pred vmul(_1,_2,Result)
         : ( native_props:mshare([[Result]]), var(Result), ground([_1,_2]), gnd(_1), gnd(_2), term(Result) )
        => ( ground([_1,_2,Result]), rt14(_1), rt16(_2), num(Result) )
         + ( is_det, mut_exclusive ).

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

trans_m([[]|_1],[]).
trans_m(M,[C1|Cn]) :-
        trans_v(M,C1,R),
        trans_m(R,Cn).

trans_v([],[],[]).
trans_v([[C11|C1n]|C],[C11|X],[C1n|Y]) :-
        trans_v(C,X,Y).

makematrix(N,Matrix) :-
        makevector(N,Vec),
        makematrix(N,Vec,Matrix).

makematrix(0,_1,[]).
makematrix(Rows,Vector,[Vector|T]) :-
        Rows>0,
        Nextrow is Rows-1,
        makematrix(Nextrow,Vector,T).

makevector(0,[]).
makevector(Cols,[Cols|T]) :-
        Cols>0,
        Nextcol is Cols-1,
        makevector(Nextcol,T).


:- regtype rt44/1.

rt44([]).
rt44([A|B]) :-
        gnd(A),
        rt44(B).


:- regtype rt43/1.

rt43([]).
rt43([A|B]) :-
        gnd(A),
        rt44(B).


:- regtype rt48/1.

rt48([]).
rt48([A|B]) :-
        num(A),
        rt48(B).


:- regtype rt47/1.

rt47([]).
rt47([A|B]) :-
        num(A),
        rt48(B).


:- regtype rt46/1.

rt46([]).
rt46([A|B]) :-
        rt47(A),
        rt46(B).


:- regtype rt45/1.

rt45([]).
rt45([A|B]) :-
        rt47(A),
        rt46(B).


:- regtype rt36/1.

rt36([]).
rt36([A|B]) :-
        arithexpression(A),
        rt36(B).


:- regtype rt35/1.

rt35([]).
rt35([A|B]) :-
        arithexpression(A),
        rt36(B).


:- regtype rt34/1.

rt34([]).
rt34([A|B]) :-
        arithexpression(A),
        rt35(B).


:- regtype rt33/1.

rt33([]).
rt33([A|B]) :-
        rt34(A),
        rt33(B).


:- regtype rt32/1.

rt32([]).
rt32([A|B]) :-
        rt34(A),
        rt33(B).


:- regtype rt38/1.

rt38([]).
rt38([A|B]) :-
        num(A),
        rt38(B).


:- regtype rt37/1.

rt37([]).
rt37([A|B]) :-
        num(A),
        rt38(B).


:- regtype rt27/1.

rt27([]).
rt27([A|B]) :-
        arithexpression(A),
        rt27(B).


:- regtype rt26/1.

rt26([]).
rt26([A|B]) :-
        arithexpression(A),
        rt27(B).


:- regtype rt25/1.

rt25([]).
rt25([A|B]) :-
        arithexpression(A),
        rt26(B).


:- regtype rt24/1.

rt24([]).
rt24([A|B]) :-
        arithexpression(A),
        rt24(B).


:- regtype rt23/1.

rt23([]).
rt23([A|B]) :-
        arithexpression(A),
        rt24(B).


:- regtype rt22/1.

rt22([]).
rt22([A|B]) :-
        arithexpression(A),
        rt23(B).


:- regtype rt15/1.

rt15([]).
rt15([A|B]) :-
        arithexpression(A),
        rt15(B).


:- regtype rt14/1.

rt14([]).
rt14([A|B]) :-
        arithexpression(A),
        rt15(B).


:- regtype rt17/1.

rt17([]).
rt17([A|B]) :-
        arithexpression(A),
        rt17(B).


:- regtype rt16/1.

rt16([]).
rt16([A|B]) :-
        arithexpression(A),
        rt17(B).