function b = bspline_multivariate(xi,x)
% BSPLINE_MULTIVARIATE: multivariate B-spline
% b = bspline_multivariate(xi,x)
% values b(j1,...) at (x{1}(j1),...) 
% of a multivariate B-spline with knots xi{k1},...

b = 1;
for j=length(x):-1:1
   bj = bspline(xi{j},x{j});
   dim(j) = length(x{j});
   b = bj*b(:)';   
end
b = reshape(b,[dim 1]);
