Function: math-vector-avg
math-vector-avg is a byte-compiled function defined in calc-vec.el.gz.
Signature
(math-vector-avg VEC)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-vec.el.gz
;;; Replace a vector [a b c ...] with a vector of averages
;;; [(a+b)/2 (b+c)/2 ...]
(defun math-vector-avg (vec)
(let ((vp (sort (copy-sequence (cdr vec)) 'math-beforep))
(res nil))
(while (and vp (cdr vp))
(setq res (cons (math-div (math-add (car vp) (cadr vp)) 2) res)
vp (cdr vp)))
(cons 'vec (reverse res))))