function B=rescale(A,mx), B=A*(mx/max(A(isfinite(A))));
% rescale - rescale array values so maximum value is MX
%
% rescale :: [DIM->real], real -> [DIM->real]
%
% eg, B=rescale(A,10)
% returns matrix K*A such that maximum finite value is 10

