function alpha=minscalarprod(u,v)
% Compute minimal scalar product
u=reshape(u,length(u),1);
v=reshape(v,length(v),1);
t=abs(length(u)-length(v));
if length(u)>=length(v),
	v=[v; zeros(t,1)];
else
	u=[u; zeros(t,1)];
end
u=sort(u);
v=-sort(-v);
alpha=u'*v;
