symhandl.red 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. module symhandl;
  2. %
  3. % Symmetry Package
  4. %
  5. % Author: Karin Gatermann
  6. % Konrad-Zuse-Zentrum fuer
  7. % Informationstechnik Berlin
  8. % Heilbronner Str. 10
  9. % W-1000 Berlin 31
  10. % Germany
  11. % Email: Gatermann@sc.ZIB-Berlin.de
  12. % symhandl.red
  13. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  14. %
  15. % functions to get the stored information of groups
  16. % booleans first
  17. %
  18. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  19. symbolic procedure available!*p(group);
  20. % returns true, if the information
  21. % concerning irreducible representations
  22. % of the group are in this database
  23. begin
  24. if not(idp(group)) then rederr("this is no group identifier");
  25. return flagp(group,'available);
  26. end;
  27. symbolic procedure storing!*p(group);
  28. % returns true, if the information concerning generators
  29. % and group elements
  30. % of the group are in this database
  31. begin
  32. return flagp(group,'storing);
  33. end;
  34. symbolic procedure g!*element!*p(group,element);
  35. % returns true, if element is an element of the abstract group
  36. begin
  37. if memq(element,get!*elements(group)) then return t else return nil;
  38. end;
  39. symbolic procedure g!*generater!*p(group,element);
  40. % returns true, if element is a generator of the abstract group
  41. begin
  42. if memq(element,get!*generators(group)) then return t else return nil;
  43. end;
  44. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  45. %
  46. % operators for abstract group
  47. %
  48. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  49. symbolic procedure get!*available!*groups;
  50. % returns the available groups as a list
  51. begin
  52. return get('availables,'groups);
  53. end;
  54. symbolic procedure get!*order(group);
  55. % returns the order of group as integer
  56. begin
  57. return length(get!*elements(group));
  58. end;
  59. symbolic procedure get!*elements(group);
  60. % returns the abstract elements of group
  61. % output list of identifiers
  62. begin
  63. scalar ll;
  64. return get(group,'elems);
  65. end;
  66. symbolic procedure get!*generators(group);
  67. % returns a list abstract elements of group which generates the group
  68. begin
  69. return get(group,'generators);
  70. end;
  71. symbolic procedure get!*generator!*relations(group);
  72. % returns a list with relations
  73. % which are satisfied for the generators of the group
  74. begin
  75. return get(group,'relations);
  76. end;
  77. symbolic procedure get!*product(group,elem1,elem2);
  78. % returns the element elem1*elem2 of group
  79. begin
  80. scalar table,above,left;
  81. table:=get(group,'grouptable);
  82. above:= car table;
  83. left:=for each row in table collect car row;
  84. return get!+mat!+entry(table,
  85. give!*position(elem1,left),
  86. give!*position(elem2,above));
  87. end;
  88. symbolic procedure get!*inverse(group,elem);
  89. % returns the inverse element of the element elem in group
  90. % invlist = ((g1,g2,..),(inv1,inv2,...))
  91. begin
  92. scalar invlist;
  93. invlist:=get(group,'inverse);
  94. return nth(cadr invlist,give!*position(elem,car invlist));
  95. end;
  96. symbolic procedure give!*position(elem,ll);
  97. begin
  98. scalar j,found;
  99. j:=1; found:=nil;
  100. while (null(found) and (j<=length(ll))) do
  101. <<
  102. if (nth(ll,j)=elem) then found:=t else j:=j+1;
  103. >>;
  104. if null(found) then rederr("error in give position");
  105. return j;
  106. end;
  107. symbolic procedure get!*elem!*in!*generators(group,elem);
  108. % returns the element representated by the generators of group
  109. begin
  110. scalar ll,found,res;
  111. ll:=get(group,'elem!_in!_generators);
  112. if (elem='id) then return list('id);
  113. found:=nil;
  114. while (null(found) and (length(ll)>0)) do
  115. <<
  116. if (elem=caaar ll) then
  117. <<
  118. res:=cadr car ll;
  119. found:=t;
  120. >>;
  121. ll:=cdr ll;
  122. >>;
  123. if found then return res else
  124. rederr("error in get!*elem!*in!*generators");
  125. end;
  126. symbolic procedure get!*nr!*equi!*classes(group);
  127. % returns the number of equivalence classes of group
  128. begin
  129. return length(get(group,'equiclasses));
  130. end;
  131. symbolic procedure get!*equi!*class(group,elem);
  132. % returns the equivalence class of the element elem in group
  133. begin
  134. scalar ll,equic,found;
  135. ll:=get(group,'equiclasses);
  136. found:=nil;
  137. while (null(found) and (length(ll)>0)) do
  138. <<
  139. if memq(elem,car ll) then
  140. <<
  141. equic:=car ll;
  142. found:=t;
  143. >>;
  144. ll:=cdr ll;
  145. >>;
  146. if found then return equic;
  147. end;
  148. symbolic procedure get!*all!*equi!*classes(group);
  149. % returns the equivalence classes of the element elem in group
  150. % list of lists of identifiers
  151. begin
  152. return get(group,'equiclasses);
  153. end;
  154. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  155. %
  156. % functions to get information of real irred. representation of group
  157. %
  158. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  159. symbolic procedure get!*nr!*real!*irred!*reps(group);
  160. % returns number of real irreducible representations of group
  161. begin
  162. return get(group,'realrepnumber);
  163. end;
  164. symbolic procedure get!*real!*character(group,nr);
  165. % returns the nr-th real character of the group group
  166. begin
  167. return mk!_character(get!*real!*irreducible!*rep(group,nr));
  168. end;
  169. symbolic procedure get!*real!*comp!*chartype!*p(group,nr);
  170. % returns true if the type of the real irreducible rep.
  171. % of the group is complex
  172. begin
  173. if eqcar( get(group,mkid('realrep,nr)) ,'complextype) then return t;
  174. end;
  175. symbolic procedure get!*real!*irreducible!*rep(group,nr);
  176. % returns the real nr-th irreducible matrix representation of group
  177. begin
  178. return mk!_resimp!_rep(append(list(group),
  179. cdr get(group,mkid('realrep,nr))));
  180. end;
  181. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  182. %
  183. % functions to get information of
  184. % complex irreducible representation of group
  185. %
  186. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  187. symbolic procedure get!*nr!*complex!*irred!*reps(group);
  188. % returns number of complex irreducible representations of group
  189. begin
  190. return get(group,'complexrepnumber);
  191. end;
  192. symbolic procedure get!*complex!*character(group,nr);
  193. % returns the nr-th complex character of the group group
  194. begin
  195. return mk!_character(get!*complex!*irreducible!*rep(group,nr));
  196. end;
  197. symbolic procedure get!*complex!*irreducible!*rep(group,nr);
  198. % returns the complex nr-th irreduciblematrix representation of group
  199. begin
  200. return mk!_resimp!_rep(append(list(group),
  201. get(group,mkid('complexrep,nr))));
  202. end;
  203. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  204. %
  205. % set information upon group
  206. %
  207. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  208. symbolic procedure set!*group(group,equiclasses);
  209. %
  210. begin
  211. put(group,'equiclasses,equiclasses);
  212. end;
  213. symbolic procedure set!*elems!*group(group,elems);
  214. %
  215. begin
  216. put(group,'elems,elems);
  217. end;
  218. symbolic procedure set!*generators(group,generators);
  219. %
  220. begin
  221. put(group,'generators,generators);
  222. end;
  223. symbolic procedure set!*relations(group,relations);
  224. %
  225. begin
  226. put(group,'relations,relations);
  227. end;
  228. symbolic procedure set!*available(group);
  229. begin
  230. scalar grouplist;
  231. flag(list(group),'available);
  232. grouplist:=get('availables,'groups);
  233. grouplist:=append(grouplist,list(group));
  234. put('availables,'groups,grouplist);
  235. end;
  236. symbolic procedure set!*storing(group);
  237. begin
  238. flag(list(group),'storing);
  239. end;
  240. symbolic procedure set!*grouptable(group,table);
  241. %
  242. begin
  243. put(group,'grouptable,table);
  244. end;
  245. symbolic procedure set!*inverse(group,invlist);
  246. % stores the inverse element list in group
  247. begin
  248. put(group,'inverse,invlist);
  249. end;
  250. symbolic procedure set!*elemasgen(group,glist);
  251. %
  252. begin
  253. put(group,'elem!_in!_generators,glist);
  254. end;
  255. symbolic procedure set!*representation(group,replist,type);
  256. %
  257. begin
  258. scalar nr;
  259. nr:=get(group,mkid(type,'repnumber));
  260. if null(nr) then nr:=0;
  261. nr:=nr+1;
  262. put(group,mkid(mkid(type,'rep),nr),replist);
  263. set!*repnumber(group,type,nr);
  264. end;
  265. symbolic procedure set!*repnumber(group,type,nr);
  266. %
  267. begin
  268. put(group,mkid(type,'repnumber),nr);
  269. end;
  270. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  271. %
  272. % functions to build information upon group
  273. %
  274. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  275. symbolic procedure mk!*inverse!*list(table);
  276. % returns ((elem1,elem2,..),(inv1,inv2,..))
  277. begin
  278. scalar elemlist,invlist,elem,row,column;
  279. elemlist:=cdr(car (mk!+transpose!+matrix(table)));
  280. invlist:=for each elem in elemlist collect
  281. <<
  282. row:=give!*position(elem,elemlist);
  283. column:=give!*position('id,cdr nth(table,row+1));
  284. nth(cdr(car table),column)
  285. >>;
  286. return list(elemlist,invlist);
  287. end;
  288. symbolic procedure mk!*equiclasses(table);
  289. % returns ((elem1,elem2,..),(inv1,inv2,..))
  290. begin
  291. scalar elemlist,restlist,s,r,tt,ts;
  292. scalar rows,rowt,columnt,columnr,equiclasses,equic,firstrow;
  293. elemlist:=cdr(car (mk!+transpose!+matrix(table)));
  294. restlist:=elemlist;
  295. firstrow:=cdr car table;
  296. equiclasses:=nil;
  297. while (length(restlist)>0) do
  298. <<
  299. s:=car restlist;
  300. rows:=give!*position(s,elemlist);
  301. equic:=list(s);
  302. restlist:=cdr restlist;
  303. for each tt in elemlist do
  304. <<
  305. columnt:=give!*position(tt,firstrow);
  306. rowt:=give!*position(tt,elemlist);
  307. ts:=get!+mat!+entry(table,rows+1,columnt+1);
  308. columnr:=give!*position(ts,cdr nth(table,rowt+1));
  309. r:=nth(firstrow,columnr);
  310. equic:=union(equic,list(r));
  311. restlist:=delete(r,restlist);
  312. >>;
  313. equiclasses:=append(equiclasses,list(equic));
  314. >>;
  315. return equiclasses;
  316. end;
  317. endmodule;
  318. end;