Monday 8 February 2010

LU Decomposition in Prolog


:- use_module(library(clpr)).


// various obvious bits of matrix machinary.

lu_decompose(M, L*U) :-
 dimensions(M,N*N),
 dimensions(L,N*N),
 dimensions(U,N*N),
 lower(L),
 upper(U),
 matrix_multiply(L,U,M).