Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:prolog:pllib:vectors_inner_product [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +====== Vectors inner product ======
 +{{tag>​math}}
 +===== Description =====
 +Computing inner products of vectors iteratively.
 +
 +**Source**: ​ The Art of Prolog
 +===== Download =====
 +Program source code: {{vectors_inner_product.pl}}
 +===== Listing =====
 +<code prolog>
 +/*
 +   ​inner_product(Xs,​Ys,​Value) :- 
 + Value is the inner product of the vectors
 + represented by the lists of integers Xs and Ys.
 +*/
 +     ​inner_product(Xs,​Ys,​IP) :- inner_product(Xs,​Ys,​0,​IP).
 + 
 +     ​inner_product([X|Xs],​[Y|Ys],​Temp,​IP) :-
 +         Temp1 is X*Y+Temp, inner_product(Xs,​Ys,​Temp1,​IP).
 +     ​inner_product([],​[],​IP,​IP).
 +
 +%  Program 8.7b   ​Computing inner products of vectors iteratively
 +
 +</​code>​
 +===== Comments =====
  
pl/prolog/pllib/vectors_inner_product.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0