Function: math-stirling-number
math-stirling-number is a byte-compiled function defined in
calc-comb.el.gz.
Signature
(math-stirling-number N M K)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-comb.el.gz
(defun math-stirling-number (n m k)
(or (math-num-natnump n) (math-reject-arg n 'natnump))
(or (math-num-natnump m) (math-reject-arg m 'natnump))
(if (consp n) (setq n (math-trunc n)))
(or (integerp n) (math-reject-arg n 'fixnump))
(if (consp m) (setq m (math-trunc m)))
(or (integerp m) (math-reject-arg m 'fixnump))
(if (< n m)
0
(let ((math-stirling-local-cache (aref math-stirling-cache k)))
(while (<= (length math-stirling-local-cache) n)
(let ((i (1- (length math-stirling-local-cache)))
row)
(setq math-stirling-local-cache
(vconcat math-stirling-local-cache
(make-vector (length math-stirling-local-cache) nil)))
(aset math-stirling-cache k math-stirling-local-cache)
(while (< (setq i (1+ i)) (length math-stirling-local-cache))
(aset math-stirling-local-cache i (setq row (make-vector (1+ i) nil)))
(aset row 0 0)
(aset row i 1))))
(if (= k 1)
(math-stirling-1 n m)
(math-stirling-2 n m)))))