function u = sigmapi(d);
% SIGMAPI  Compute a certain sum of products:
%   u = \sum_{i=1}^n \prod_{j=1}^i d_j

n = length(d);
if prod(size(d)) ~= n, error('d must be a vector'), end

u = d(n);
for i = n-1:-1:1
  u = d(i) * (1+u);
end
