User Tools

Site Tools


caveat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

caveat [2014/05/30 11:49]
caveat [2014/05/30 11:49] (current)
Line 1: Line 1:
 +
 +You may have noticed that in the original, mathematical equation at the top of the page, there were **bounds** on the summation, <latex>$\sum_{k=1}^{i-1}$</latex> In the Alphabets program we wrote, we did not include these bounds.  In this equation, this is safe, for a rather subtle reason (which will be clearer when you know more about Alpha).  In general, it is always safe to include these bounds explicitly in your program by making the reduction body a RestrictExpression to explicitly specify the range of indices where the expression inside the reduction is defined, as shown below.
 +
 +<sxh alphabets; gutter:true>
 +U[i,j] = case
 +   {|1==i} : A[i,j];
 +   {|1<i} : A[i,j] - reduce(+, [k], {|1<=k<i} : L[i,k]*U[k,j]);
 +esac;
 +</sxh>
  
caveat.txt ยท Last modified: 2014/05/30 11:49 (external edit)