]> code.delx.au - gnu-emacs/blobdiff - lisp/calc/calc-vec.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / calc / calc-vec.el
index 5b807a55491b84864ffbd017dedf33aef6bbdf00..c861c00e524dfdb4ce346477694f7bf87919f5fd 100644 (file)
@@ -1,10 +1,8 @@
 ;;; calc-vec.el --- vector functions for Calc
 
-;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2016 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <daveg@synaptics.com>
-;; Maintainer: Jay Belanger <jay.p.belanger@gmail.com>
 
 ;; This file is part of GNU Emacs.
 
          (math-reject-arg n "*Index out of range")))))
 
 (defun calcFunc-subscr (mat n &optional m)
-  (setq mat (calcFunc-mrow mat n))
-  (if m
-      (if (math-num-integerp n)
-         (calcFunc-mrow mat m)
-       (calcFunc-mcol mat m))
-    mat))
+  (if (eq (car-safe mat) 'var) nil
+    (setq mat (calcFunc-mrow mat n))
+    (if m
+        (if (math-num-integerp n)
+            (calcFunc-mrow mat m)
+          (calcFunc-mcol mat m))
+      mat)))
 
 ;;; Get the Nth column of a matrix.
 (defun math-mat-col (mat n)
       (cons 'vec (nreverse (sort (copy-sequence (cdr vec)) 'math-beforep)))
     (math-reject-arg vec 'vectorp)))
 
-;; The variable math-grade-vec is local to calcFunc-grade and 
+;; The variable math-grade-vec is local to calcFunc-grade and
 ;; calcFunc-rgrade, but is used by math-grade-beforep, which is called
 ;; by calcFunc-grade and calcFunc-rgrade.
 (defvar math-grade-vec)
                  (setq bin (math-floor bin)))
             (and (natnump bin)
                  (< bin n)
-                 (aset res bin 
+                 (aset res bin
                        (math-add (aref res bin)
                                  (if wvec (car (setq wp (cdr wp))) wts)))))
            (cons 'vec (append res nil))))
                (while (and tbds (Math-lessp (car tbds) num))
                  (setq i (1+ i))
                  (setq tbds (cdr tbds)))
-               (aset res i 
+               (aset res i
                      (math-add (aref res i)
                                (if wvec (car (setq wp (cdr wp))) wts))))
              (setq vp (cdr vp)))
@@ -1550,7 +1549,7 @@ of two matrices is a matrix."
 ;; indirectly) by math-read-brackets.
 (defvar math-rb-close)
 
-;; The next few variables are local to math-read-exprs in calc-aent.el 
+;; The next few variables are local to math-read-exprs in calc-aent.el
 ;; and math-read-expr in calc-ext.el, but are set in functions they call.
 (defvar math-exp-pos)
 (defvar math-exp-str)
@@ -1675,5 +1674,4 @@ of two matrices is a matrix."
 
 (provide 'calc-vec)
 
-;; arch-tag: 7902a7af-ec69-440a-8635-ebb4db263402
 ;;; calc-vec.el ends here