## [Maxima-commits] CVS: maxima/share/tensor symtry.lisp,1.3,1.4 itensor.lisp,1.4,1.5 gener.lisp,1.2,1.3

 [Maxima-commits] CVS: maxima/share/tensor symtry.lisp,1.3,1.4 itensor.lisp,1.4,1.5 gener.lisp,1.2,1.3 From: Wolfgang Jenkner - 2003-10-15 03:18:49 ```Update of /cvsroot/maxima/maxima/share/tensor In directory sc8-pr-cvs1:/tmp/cvs-serv27182 Modified Files: symtry.lisp itensor.lisp gener.lisp Log Message: Avoid a name clash with functions in the standard Maxima image by renaming MYSORT to ITENSOR-SORT, CLEANUP to ITENSOR-CLEANUP and EXTRACT to EXTRACT-ELEMENTS. Comment out the definition of INTERVAL since it does the same thing as the function in mstuff.lisp (the latter definition is a bit more complicated, though, apparently in order to optimize the case where the interval bounds are bignums but the interval length is a fixnum). Index: symtry.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/share/tensor/symtry.lisp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- symtry.lisp 6 Jan 2003 19:43:01 -0000 1.3 +++ symtry.lisp 15 Oct 2003 03:18:41 -0000 1.4 @@ -58,10 +58,10 @@ (add2lnc tensor \$symmetries) (return '\$DONE))) -(defun INTERVAL (i j) ;INTERVAL returns the list of integers from I thru J. - (do ((n i (1+ n)) (ans)) ;Thus (INTERVAL 3 5) yields (3 4 5) - ((> n j) (nreverse ans)) - (setq ans (cons n ans)))) +;; (defun INTERVAL (i j) ;INTERVAL returns the list of integers from I thru J. +;; (do ((n i (1+ n)) (ans)) ;Thus (INTERVAL 3 5) yields (3 4 5) +;; ((> n j) (nreverse ans)) +;; (setq ans (cons n ans)))) (defun CHECK-SYMARGS (ll n) ;Returns an ascending list of the unique ;elements of LL and checks that they are @@ -134,7 +134,7 @@ csign nil) ;Set when reordering antisymmetric indices. ;Indicates whether overall sign of ;expression needs changing. - (cond (\$allsym (setq cov (mysort cov) contr (mysort contr))) + (cond (\$allsym (setq cov (itensor-sort cov) contr (itensor-sort contr))) ((zl-member tensor (cdr \$symmetries)) (do ((q symtypes (cdr q)) (type)) ((null q)) @@ -142,18 +142,18 @@ (do ((props (car (zl-get tensor type)) (cdr props)) (p)) ((null props)) (setq p (car props) - cov (inserts (symsort (extract p cov) type) + cov (inserts (symsort (extract-elements p cov) type) cov p))) (do ((props (cdr (zl-get tensor type)) (cdr props)) (p)) ((null props)) (setq p (car props) - contr (inserts (symsort (extract p contr) + contr (inserts (symsort (extract-elements p contr) type) contr p)))))) (setq tensor (mysubst0 (append (list (car e) (consmlist cov) (consmlist contr)) - (mysort deriv)) e)) + (itensor-sort deriv)) e)) (cond (csign (setq tensor (neg tensor)))) (return tensor))) @@ -167,8 +167,8 @@ (cond ((not (eq dumx (car b))) (setq l (cons (cons (car b) dumx) l)))))) -(defun EXTRACT (a b) ;Extracts the elements from B specified by the indices in - ;i.e. (EXTRACT '(2 5) '(A B C D E F)) yields (B E) +(defun EXTRACT-elements (a b) ;Extracts the elements from B specified by the indices in A, + ;i.e. (EXTRACT-elements '(2 5) '(A B C D E F)) yields (B E) (do ((a a) (b b (cdr b)) (n 1 (1+ n)) (l)) ((null a) (nreverse l)) (cond ((equal (car a) n) Index: itensor.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/share/tensor/itensor.lisp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- itensor.lisp 29 Jan 2003 21:06:33 -0000 1.4 +++ itensor.lisp 15 Oct 2003 03:18:41 -0000 1.5 @@ -518,7 +518,7 @@ E)) ((AND E (MEMQ B E)) (NCONC (LIST (CAR G) C D) - (MYSORT (SUBST A B E)))) + (itensor-SORT (SUBST A B E)))) ((AND (CDR D) (MEMQ A (CDR D))) (SETQ D (SUBST B A (CDR D))) (AND (CDR C) @@ -790,7 +790,7 @@ (delta (ncons x) (cdaddr e))) (t (NCONC (LIST (CAR E) (CADR E) (CADDR E)) (COND ((NULL (CDDDR E)) (NCONS X)) - (T (MYSORT (APPEND (CDDDR E) (NCONS X))))))))) + (T (itensor-SORT (APPEND (CDDDR E) (NCONS X))))))))) @@ -969,7 +969,7 @@ ((ATOM E) E) ((OR (RPOBJ E) (EQ (CAAR E) 'MTIMES));If an indexed object or a product ((LAMBDA (L) - (SIMPTIMES (REORDER (COND (L (SUBLIS (CLEANUP L INDEX) E))(T E))) 1 T)) + (SIMPTIMES (REORDER (COND (L (SUBLIS (itensor-CLEANUP L INDEX) E))(T E))) 1 T)) (CDADDR (\$INDICES E)) ;Gets list of dummy indices )) (T ;Otherwise map \$RENAME on each of the subparts e.g. a sum @@ -988,19 +988,19 @@ (COND ((RPOBJ X) (NCONC (LIST (CAR X) ;(\$F SIMP) (CONS SMLIST - (COND (\$ALLSYM (MYSORT (COPY (CDADR X)))) + (COND (\$ALLSYM (itensor-SORT (COPY (CDADR X)))) (T (CDADR X)))) ;(\$A \$B) (CONS SMLIST (COND (\$ALLSYM - (MYSORT (COPY (CDADDR X)))) + (itensor-SORT (COPY (CDADDR X)))) (T (CDADDR X))))) ;(\$C \$D) - (MYSORT (COPY (CDDDR X))))) ;(\$E \$F) + (itensor-SORT (COPY (CDDDR X))))) ;(\$E \$F) (T X))) (COND ((EQ (CAAR E) 'MTIMES) (CDR E)) (T (NCONS E))))) E)) -(DEFUN CLEANUP (A N)((LAMBDA (DUMX)(CLEANUP1 A)) NIL)) ;Sets DUMX to NIL +(DEFUN itensor-CLEANUP (A N)((LAMBDA (DUMX)(CLEANUP1 A)) NIL)) ;Sets DUMX to NIL (DEFUN CLEANUP1 (A) (AND A (SETQ DUMX (IMPLODE (NCONC (EXPLODEN \$DUMMYX) ;Keep proper order of @@ -1011,7 +1011,7 @@ (DECLARE-TOP (NOTYPE N INDEX)(UNSPECIAL N DUMX INDEX)) -(DEFUN MYSORT (L) (COND ((CDR L) (SORT L 'LESS)) (T L))) +(DEFUN itensor-SORT (L) (COND ((CDR L) (SORT L 'LESS)) (T L))) ;Sort into ascending order (DEFMFUN \$REMCOMPS (TENSOR) Index: gener.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/share/tensor/gener.lisp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gener.lisp 10 Jun 2002 03:27:32 -0000 1.2 +++ gener.lisp 15 Oct 2003 03:18:41 -0000 1.3 @@ -31,7 +31,7 @@ (merror "Cannot assign to indexed objects with derivative ~ indices:~%~M" (ishow lhs)))) - (setq free (nreverse (mysort (cdadr free))) ;Set FREE to just the + (setq free (nreverse (itensor-sort (cdadr free))) ;Set FREE to just the indlist nil) ;free indices (and \$METRICCONVERT (boundp '\$METRIC) (setq lhs (changename \$METRIC t 0 2 '\$UG @@ -146,7 +146,7 @@ (cond ((not (null indexed)) (do ((indxd (simptimes (cons '(MTIMES) indexed) 1 nil)) - (dummy (mysort dummy2) (cdr dummy))) + (dummy (itensor-sort dummy2) (cdr dummy))) ((null dummy) (ncons indxd)) (setq indxd (nconc (ncons '(\$SUM)) (ncons indxd) ```

### Thread view

 [Maxima-commits] CVS: maxima/share/tensor symtry.lisp,1.3,1.4 itensor.lisp,1.4,1.5 gener.lisp,1.2,1.3 From: Wolfgang Jenkner - 2003-10-15 03:18:49 ```Update of /cvsroot/maxima/maxima/share/tensor In directory sc8-pr-cvs1:/tmp/cvs-serv27182 Modified Files: symtry.lisp itensor.lisp gener.lisp Log Message: Avoid a name clash with functions in the standard Maxima image by renaming MYSORT to ITENSOR-SORT, CLEANUP to ITENSOR-CLEANUP and EXTRACT to EXTRACT-ELEMENTS. Comment out the definition of INTERVAL since it does the same thing as the function in mstuff.lisp (the latter definition is a bit more complicated, though, apparently in order to optimize the case where the interval bounds are bignums but the interval length is a fixnum). Index: symtry.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/share/tensor/symtry.lisp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- symtry.lisp 6 Jan 2003 19:43:01 -0000 1.3 +++ symtry.lisp 15 Oct 2003 03:18:41 -0000 1.4 @@ -58,10 +58,10 @@ (add2lnc tensor \$symmetries) (return '\$DONE))) -(defun INTERVAL (i j) ;INTERVAL returns the list of integers from I thru J. - (do ((n i (1+ n)) (ans)) ;Thus (INTERVAL 3 5) yields (3 4 5) - ((> n j) (nreverse ans)) - (setq ans (cons n ans)))) +;; (defun INTERVAL (i j) ;INTERVAL returns the list of integers from I thru J. +;; (do ((n i (1+ n)) (ans)) ;Thus (INTERVAL 3 5) yields (3 4 5) +;; ((> n j) (nreverse ans)) +;; (setq ans (cons n ans)))) (defun CHECK-SYMARGS (ll n) ;Returns an ascending list of the unique ;elements of LL and checks that they are @@ -134,7 +134,7 @@ csign nil) ;Set when reordering antisymmetric indices. ;Indicates whether overall sign of ;expression needs changing. - (cond (\$allsym (setq cov (mysort cov) contr (mysort contr))) + (cond (\$allsym (setq cov (itensor-sort cov) contr (itensor-sort contr))) ((zl-member tensor (cdr \$symmetries)) (do ((q symtypes (cdr q)) (type)) ((null q)) @@ -142,18 +142,18 @@ (do ((props (car (zl-get tensor type)) (cdr props)) (p)) ((null props)) (setq p (car props) - cov (inserts (symsort (extract p cov) type) + cov (inserts (symsort (extract-elements p cov) type) cov p))) (do ((props (cdr (zl-get tensor type)) (cdr props)) (p)) ((null props)) (setq p (car props) - contr (inserts (symsort (extract p contr) + contr (inserts (symsort (extract-elements p contr) type) contr p)))))) (setq tensor (mysubst0 (append (list (car e) (consmlist cov) (consmlist contr)) - (mysort deriv)) e)) + (itensor-sort deriv)) e)) (cond (csign (setq tensor (neg tensor)))) (return tensor))) @@ -167,8 +167,8 @@ (cond ((not (eq dumx (car b))) (setq l (cons (cons (car b) dumx) l)))))) -(defun EXTRACT (a b) ;Extracts the elements from B specified by the indices in - ;i.e. (EXTRACT '(2 5) '(A B C D E F)) yields (B E) +(defun EXTRACT-elements (a b) ;Extracts the elements from B specified by the indices in A, + ;i.e. (EXTRACT-elements '(2 5) '(A B C D E F)) yields (B E) (do ((a a) (b b (cdr b)) (n 1 (1+ n)) (l)) ((null a) (nreverse l)) (cond ((equal (car a) n) Index: itensor.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/share/tensor/itensor.lisp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- itensor.lisp 29 Jan 2003 21:06:33 -0000 1.4 +++ itensor.lisp 15 Oct 2003 03:18:41 -0000 1.5 @@ -518,7 +518,7 @@ E)) ((AND E (MEMQ B E)) (NCONC (LIST (CAR G) C D) - (MYSORT (SUBST A B E)))) + (itensor-SORT (SUBST A B E)))) ((AND (CDR D) (MEMQ A (CDR D))) (SETQ D (SUBST B A (CDR D))) (AND (CDR C) @@ -790,7 +790,7 @@ (delta (ncons x) (cdaddr e))) (t (NCONC (LIST (CAR E) (CADR E) (CADDR E)) (COND ((NULL (CDDDR E)) (NCONS X)) - (T (MYSORT (APPEND (CDDDR E) (NCONS X))))))))) + (T (itensor-SORT (APPEND (CDDDR E) (NCONS X))))))))) @@ -969,7 +969,7 @@ ((ATOM E) E) ((OR (RPOBJ E) (EQ (CAAR E) 'MTIMES));If an indexed object or a product ((LAMBDA (L) - (SIMPTIMES (REORDER (COND (L (SUBLIS (CLEANUP L INDEX) E))(T E))) 1 T)) + (SIMPTIMES (REORDER (COND (L (SUBLIS (itensor-CLEANUP L INDEX) E))(T E))) 1 T)) (CDADDR (\$INDICES E)) ;Gets list of dummy indices )) (T ;Otherwise map \$RENAME on each of the subparts e.g. a sum @@ -988,19 +988,19 @@ (COND ((RPOBJ X) (NCONC (LIST (CAR X) ;(\$F SIMP) (CONS SMLIST - (COND (\$ALLSYM (MYSORT (COPY (CDADR X)))) + (COND (\$ALLSYM (itensor-SORT (COPY (CDADR X)))) (T (CDADR X)))) ;(\$A \$B) (CONS SMLIST (COND (\$ALLSYM - (MYSORT (COPY (CDADDR X)))) + (itensor-SORT (COPY (CDADDR X)))) (T (CDADDR X))))) ;(\$C \$D) - (MYSORT (COPY (CDDDR X))))) ;(\$E \$F) + (itensor-SORT (COPY (CDDDR X))))) ;(\$E \$F) (T X))) (COND ((EQ (CAAR E) 'MTIMES) (CDR E)) (T (NCONS E))))) E)) -(DEFUN CLEANUP (A N)((LAMBDA (DUMX)(CLEANUP1 A)) NIL)) ;Sets DUMX to NIL +(DEFUN itensor-CLEANUP (A N)((LAMBDA (DUMX)(CLEANUP1 A)) NIL)) ;Sets DUMX to NIL (DEFUN CLEANUP1 (A) (AND A (SETQ DUMX (IMPLODE (NCONC (EXPLODEN \$DUMMYX) ;Keep proper order of @@ -1011,7 +1011,7 @@ (DECLARE-TOP (NOTYPE N INDEX)(UNSPECIAL N DUMX INDEX)) -(DEFUN MYSORT (L) (COND ((CDR L) (SORT L 'LESS)) (T L))) +(DEFUN itensor-SORT (L) (COND ((CDR L) (SORT L 'LESS)) (T L))) ;Sort into ascending order (DEFMFUN \$REMCOMPS (TENSOR) Index: gener.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/share/tensor/gener.lisp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gener.lisp 10 Jun 2002 03:27:32 -0000 1.2 +++ gener.lisp 15 Oct 2003 03:18:41 -0000 1.3 @@ -31,7 +31,7 @@ (merror "Cannot assign to indexed objects with derivative ~ indices:~%~M" (ishow lhs)))) - (setq free (nreverse (mysort (cdadr free))) ;Set FREE to just the + (setq free (nreverse (itensor-sort (cdadr free))) ;Set FREE to just the indlist nil) ;free indices (and \$METRICCONVERT (boundp '\$METRIC) (setq lhs (changename \$METRIC t 0 2 '\$UG @@ -146,7 +146,7 @@ (cond ((not (null indexed)) (do ((indxd (simptimes (cons '(MTIMES) indexed) 1 nil)) - (dummy (mysort dummy2) (cdr dummy))) + (dummy (itensor-sort dummy2) (cdr dummy))) ((null dummy) (ncons indxd)) (setq indxd (nconc (ncons '(\$SUM)) (ncons indxd) ```