summaryrefslogtreecommitdiff
path: root/lisp/calc/calc-ext.el
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2005-11-01 06:23:08 +0000
committerKaroly Lorentey <lorentey@elte.hu>2005-11-01 06:23:08 +0000
commitcd0cf71c4f41023a8d9c20b3a26e44b980992b5a (patch)
treeb763cfec551254e2228335be4e218ed7a9a19109 /lisp/calc/calc-ext.el
parentc40bb1ba81a5df164f0b9b61e3480c55808717b7 (diff)
parent895725e10c0fb68ed21abb48183cc8843bcaadf3 (diff)
downloademacs-cd0cf71c4f41023a8d9c20b3a26e44b980992b5a.tar.gz
emacs-cd0cf71c4f41023a8d9c20b3a26e44b980992b5a.tar.bz2
emacs-cd0cf71c4f41023a8d9c20b3a26e44b980992b5a.zip
Merged from miles@gnu.org--gnu-2005 (patch 142-148, 615-628)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-615 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-616 Add lisp/mh-e/.arch-inventory * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-617 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-618 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-619 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-620 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-622 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-623 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-624 Update from CVS: lisp/smerge-mode.el: Add 'tools' to file keywords. * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-625 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-626 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-627 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-628 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-142 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-143 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-144 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-145 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-146 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-147 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-148 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-435
Diffstat (limited to 'lisp/calc/calc-ext.el')
-rw-r--r--lisp/calc/calc-ext.el33
1 files changed, 31 insertions, 2 deletions
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index db370f766d9..563bcd9b023 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -659,7 +659,7 @@
("calc-alg" calc-has-rules math-defsimplify
calc-modify-simplify-mode calcFunc-collect calcFunc-esimplify
calcFunc-islin calcFunc-islinnt calcFunc-lin calcFunc-linnt
-calcFunc-simplify calcFunc-subst math-beforep
+calcFunc-simplify calcFunc-subst calcFunc-writeoutpower math-beforep
math-build-polynomial-expr math-expand-formula math-expr-contains
math-expr-contains-count math-expr-depends math-expr-height
math-expr-subst math-expr-weight math-integer-plus math-is-linear
@@ -923,7 +923,7 @@ calc-force-refresh calc-locate-cursor-element calc-show-edit-buffer)
("calc-alg" calc-alg-evaluate calc-apart calc-collect calc-expand
calc-expand-formula calc-factor calc-normalize-rat calc-poly-div
calc-poly-div-rem calc-poly-gcd calc-poly-rem calc-simplify
-calc-simplify-extended calc-substitute)
+calc-simplify-extended calc-substitute calc-writeoutpower)
("calcalg2" calc-alt-summation calc-derivative
calc-dump-integral-cache calc-integral calc-num-integral
@@ -2107,6 +2107,35 @@ calc-kill calc-kill-region calc-yank))))
(and (cdr dims)
(= (car dims) (nth 1 dims)))))
+;;; True if MAT is an identity matrix.
+(defun math-identity-matrix-p (mat &optional mul)
+ (if (math-square-matrixp mat)
+ (let ((a (if mul
+ (nth 1 (nth 1 mat))
+ 1))
+ (n (1- (length mat)))
+ (i 1))
+ (while (and (<= i n)
+ (math-ident-row-p (nth i mat) i a))
+ (setq i (1+ i)))
+ (if (> i n)
+ a
+ nil))))
+
+(defun math-ident-row-p (row n &optional a)
+ (unless a
+ (setq a 1))
+ (and
+ (not (memq nil (mapcar
+ (lambda (x) (eq x 0))
+ (nthcdr (1+ n) row))))
+ (not (memq nil (mapcar
+ (lambda (x) (eq x 0))
+ (butlast
+ (cdr row)
+ (- (length row) n)))))
+ (eq (elt row n) a)))
+
;;; True if A is any scalar data object. [P x]
(defun math-objectp (a) ; [Public]
(or (integerp a)