changeset 86501:9c534c544c8c

(math-map-binop): Declare as a function. (math-nlfit-make-matrix, math-nlfit-find-qmax, math-nlfit-fit) (math-nlfit-fit-curve, calc-fit-hubbert-linear-curve): Replace `mapcar*' by `math-map-binop'. (math-nlfit-make-matrix): Replace `copy-list' with `copy-sequence'.
author Jay Belanger <jay.p.belanger@gmail.com>
date Tue, 27 Nov 2007 04:57:57 +0000
parents 83c2e8f0909e
children 1f48ff31771c
files lisp/calc/calc-nlfit.el
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calc/calc-nlfit.el	Tue Nov 27 04:56:53 2007 +0000
+++ b/lisp/calc/calc-nlfit.el	Tue Nov 27 04:57:57 2007 +0000
@@ -61,10 +61,11 @@
 ;;; Code:
 
 (require 'calc-arith)
+(require 'calcalg3)
 
 ;; Declare functions which are defined elsewhere.
 (declare-function calc-get-fit-variables "calcalg3" (nv nc &optional defv defc with-y homog))
-
+(declare-function math-map-binop "calclalg3" (binop args1 args2))
 
 (defun math-nlfit-least-squares (xdata ydata &optional sdata sigmas)
   "Return the parameters A and B for the best least squares fit y=a+bx."
@@ -192,7 +193,7 @@
 ;;; the maximum value of q.
 
 (defun math-nlfit-find-qmax (qdata pdata tdata)
-  (let* ((ratios (mapcar* 'math-div pdata qdata))
+  (let* ((ratios (math-map-binop 'math-div pdata qdata))
          (lsdata (math-nlfit-least-squares ratios tdata))
          (qmax (math-max-list (car qdata) (cdr qdata)))
          (a (math-neg (math-div (nth 1 lsdata) (nth 0 lsdata)))))
@@ -299,7 +300,7 @@
         (mat nil)
         (k 0))
     (while (< k i)
-      (setq mat (cons (copy-list row) mat))
+      (setq mat (cons (copy-sequence row) mat))
       (setq k (1+ k)))
     mat))
 
@@ -517,7 +518,7 @@
           (let* ((Ctilda (math-nlfit-make-Ctilda C lambda))
                  (dtilda (math-nlfit-make-dtilda d (length (car C))))
                  (zeta (math-nlfit-givens Ctilda dtilda))
-                 (newparms (mapcar* 'math-add (copy-tree parms) zeta))
+                 (newparms (math-map-binop 'math-add (copy-tree parms) zeta))
                  (newchisq (math-nlfit-chi-sq xlist ylist newparms fn slist)))
             (if (math-lessp newchisq chisq)
                 (progn
@@ -696,7 +697,8 @@
                (nth 0 sigmacovar)))
           (finalparms 
            (if sigmas
-               (mapcar* (lambda (x y) (list 'sdev x y)) finalparms sigmas)
+               (math-map-binop 
+                (lambda (x y) (list 'sdev x y)) finalparms sigmas)
              finalparms))
           (soln (funcall solnexpr finalparms var)))
      (let ((calc-fit-to-trail t)
@@ -756,7 +758,7 @@
                      (mapcar (lambda (x) (math-get-sdev x t)) pdata)
                    nil))
           (pdata (mapcar (lambda (x) (math-get-value x)) pdata))
-          (poverqdata (mapcar* 'math-div pdata qdata))
+          (poverqdata (math-map-binop 'math-div pdata qdata))
           (parmvals (math-nlfit-least-squares qdata poverqdata sdata sdevv))
           (finalparms (list (nth 0 parmvals)
                             (math-neg