cantens.red 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. module cantens; % header module tested for REDUCE 3.6 and 3.7.
  2. create!-package('(cantens ctintro auxitens gentens spaces
  3. partitns checkind opertens contrtns),
  4. '(contrib cantens));
  5. % This package requires ASSIST and DUMMY.
  6. %
  7. % ************************************************************************
  8. %
  9. % Authors: H. Caprasse <hubert.caprasse@ulg.ac.be>
  10. % : F. Fontaine <pascal.fontaine@ulg.ac.be>
  11. %
  12. % Version and Date: Version 1.11, 15 January 1999.
  13. %
  14. %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  15. % ***** This package is delivered for free. %
  16. % ***** No modification on it may be made without %
  17. % ***** due permission of H. Caprasse. %
  18. %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  19. %
  20. % Revision history to versions 1.0 and 1.1:
  21. % 15/12/98 : Flag 'LOOSE' removed on DEPENDS in order to
  22. % : allow its redefinition in CSL.
  23. % : SIMPTENSOR, NUM_EPSI_NON_EUCLID, MATCH_KVALUE and
  24. % : SIMPMETRIC modified.
  25. % : MAKE_PARTIC_TENS no longer protected by the 'reserved'
  26. % : flag.
  27. % : Modifications to SYMTREE_ZEROP and DV_SKEL2FACTOR1
  28. % : to allow proper compilation under CSL.
  29. %% ******************************************************************
  30. %
  31. % an extension of the REDUCE command 'depend':
  32. % patch to extend depend to tensors...
  33. remflag('(depends),'loose); % because of csl
  34. symbolic procedure depends(u,v);
  35. if null u or numberp u or numberp v then nil
  36. else if u=v then u
  37. else if atom u and u memq frlis!* then t
  38. %to allow the most general pattern matching to occur;
  39. else if (lambda x; x and ldepends(cdr x,v)) assoc(u,depl!*)
  40. then t
  41. else if not atom u and idp car u and get(car u,'dname) then
  42. (if depends!-fn then apply2(depends!-fn,u,v) else nil)
  43. where (depends!-fn = get(car u,'domain!-depends!-fn))
  44. else if not atom u
  45. and (ldepends(cdr u,v) or depends(car u,v)) then t
  46. else if atom v or idp car v and get(car v,'dname) then nil
  47. % else dependsl(u,cdr v);
  48. else if flagp(u,'tensor) and pairp v and u=car v then t
  49. else nil;
  50. % an "importation" from EXCALC:
  51. symbolic procedure permp!:(u,v);
  52. % True if v is an even permutation of u NIl otherwise.
  53. if null u then t else if car u = car v then permp!:(cdr u,cdr v)
  54. else not permp!:(cdr u,subst(car v,car u,cdr v));
  55. % global and fluid variables defined.
  56. lisp remflag(list 'minus,'intfn);
  57. global '(dimex!* sgn!* signat!* spaces!* numindxl!* pair_id_num!*) ;
  58. lisp (pair_id_num!*:= '((!0 . 0) (!1 . 1) (!2 . 2) (!3 . 3) (!4 . 4)
  59. (!5 . 5) (!6 . 6) (!7 . 7) (!8 . 8) (!9 . 9)
  60. (!10 . 10) (!11 . 11) (!12 . 12) (!13 . 13)));
  61. fluid('(dummy_id!* g_dvnames epsilon!*));
  62. % g_dvnames is a vector.
  63. switch onespace;
  64. !*onespace:=t; % working inside a unique space is the default.
  65. % Various smacros
  66. smacro procedure id_cov u;
  67. % to get the covariant identifier
  68. % u is the output of get_n_index
  69. cadr u;
  70. smacro procedure id_cont u;
  71. % to get the contravariant identifier
  72. % u is the output of get_n_index
  73. u;
  74. smacro procedure careq_tilde u;
  75. eqcar(u,'!~);
  76. smacro procedure careq_minus u;
  77. eqcar(u,'minus);
  78. smacro procedure lowerind u;
  79. list('minus,u);
  80. smacro procedure raiseind u;
  81. cadr u;
  82. smacro procedure id_switch_variance u;
  83. if eqcar(u,'minus) then cadr u
  84. else list ('minus, u);
  85. smacro procedure get!-impfun!-args u;
  86. % Get dependencies of id u.
  87. cdr assoc(u,depl!*);
  88. endmodule;
  89. end;