function [X,W] = FullGridSC(d, p, s)

% First dimension
if strcmp(s{1}, 'legendre')
    [x,w] = legendre(0,1,1+p(1));
elseif strcmp(s{1}, 'hermite')
    [x,w] = hermite(1+p(1));
else
    error('Aaah! Something went terribly wrong!')
end

X = x; W = w;

% Loop over other dimensions
for k=2:d,
    if strcmp(s{k}, 'legendre')
        [x,w] = legendre(0,1,1+p(k));
    elseif strcmp(s{k}, 'hermite')
        [x,w] = hermite(1+p(k));
    else
        error('Aaah! Something went terribly wrong!')
    end
    
    nX = size(X,1);
    X = [kron(X,ones(1+p(k),1)), kron(ones(nX,1),x)];
    W = kron(W,ones(1+p(k),1)) .* kron(ones(nX,1),w);
end
