0001 function n = fact_dke_jd(n)
0002
0003
0004
0005
0006
0007
0008 N = n(:);
0009
0010 if any(fix(N) ~= N) || any(N < 0) || ~isreal(N)
0011 error('MATLAB:factorial:NNegativeInt', ...
0012 'N must be a matrix of non-negative integers.')
0013 end
0014
0015 if isa(N,'double'),
0016
0017 n(N>170) = 171;
0018 m = max([1; n(:)]);
0019 N = [1 1 cumprod(2:m)];
0020 n(:) = N(n+1);
0021
0022 elseif isa(N,'single'),
0023
0024 n(N>34) = 35;
0025 m = max([1; n(:)]);
0026 N = [1 1 cumprod(2:m)];
0027 n(:) = N(n+1);
0028
0029 else
0030 error('Input must be double or single')
0031 end
0032
0033
0034
0035