symchrep.red 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. module symchrep;
  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. % symchrep.red
  13. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  14. %
  15. % functions for representations in iternal structure
  16. %
  17. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  18. symbolic procedure mk!_internal(representation);
  19. % transfers the user given representation structure to the
  20. % internal structure
  21. begin
  22. scalar group,elems,generators,repgenerators,g,res;
  23. group:=get!_group!_out(representation);
  24. elems:=get!*elements(group);
  25. generators:=get!*generators(group);
  26. repgenerators:=mk!_rep!_relation(representation,generators);
  27. if not(hard!_representation!_check!_p(group,repgenerators)) then
  28. rederr("this is no representation");
  29. res:=for each g in elems collect
  30. list(g,
  31. mk!_rep!_mat(
  32. get!*elem!*in!*generators(group,g),
  33. repgenerators)
  34. );
  35. return append(list(group),res);
  36. end;
  37. symbolic procedure hard!_representation!_check!_p(group,repgenerators);
  38. % repgenerators -- ((g1,matg1),(g2,matg2),...)
  39. begin
  40. scalar checkp;
  41. checkp:=t;
  42. for each relation in get!*generator!*relations(group) do
  43. if not(relation!_check!_p(relation,repgenerators)) then
  44. checkp:=nil;
  45. return checkp;
  46. end;
  47. symbolic procedure relation!_check!_p(relation,repgenerators);
  48. begin
  49. scalar mat1,mat2;
  50. mat1:=mk!_relation!_mat(car relation, repgenerators);
  51. mat2:=mk!_relation!_mat(cadr relation, repgenerators);
  52. return equal!+matrices!+p(mat1,mat2);
  53. end;
  54. symbolic procedure mk!_relation!_mat(relationpart,repgenerators);
  55. begin
  56. scalar mat1,g;
  57. mat1:=mk!+unit!+mat(get!+row!+nr(cadr car repgenerators));
  58. for each g in relationpart do
  59. mat1:=mk!+mat!+mult!+mat(mat1,get!_mat(g,repgenerators));
  60. return mat1;
  61. end;
  62. symbolic procedure get!_mat(elem,repgenerators);
  63. begin
  64. scalar found,res;
  65. if elem='id then
  66. return mk!+unit!+mat(get!+row!+nr(cadr car repgenerators));
  67. found:=nil;
  68. while ((length(repgenerators)>0) and (null found)) do
  69. <<
  70. if elem = caar repgenerators then
  71. <<
  72. res:=cadr car repgenerators;
  73. found := t;
  74. >>;
  75. repgenerators:=cdr repgenerators;
  76. >>;
  77. if found then return res else
  78. rederr("error in get_mat");
  79. end;
  80. symbolic procedure mk!_rep!_mat(generatorl,repgenerators);
  81. % returns the representation matrix (internal structure)
  82. % of a group element represented in generatorl
  83. begin
  84. scalar mat1;
  85. mat1:=mk!+unit!+mat(get!+row!+nr(cadr(car(repgenerators))));
  86. for each generator in generatorl do
  87. mat1:=mk!+mat!+mult!+mat(mat1,
  88. get!_rep!_of!_generator(
  89. generator,repgenerators)
  90. );
  91. return mat1;
  92. end;
  93. symbolic procedure get!_rep!_of!_generator(generator,repgenerators);
  94. % returns the representation matrix (internal structure)
  95. % of the generator
  96. begin
  97. scalar found,mate,ll;
  98. if (generator='id) then return mk!+unit!+mat(
  99. get!+row!+nr(cadr(car(repgenerators))));
  100. found:=nil;
  101. ll:=repgenerators;
  102. while (not(found) and (length(ll)>0)) do
  103. <<
  104. if (caar(ll)=generator) then
  105. <<
  106. found:=t;
  107. mate:=cadr(car(ll));
  108. >>;
  109. ll:=cdr ll;
  110. >>;
  111. if found then return mate else
  112. rederr(" error in get rep of generators");
  113. end;
  114. symbolic procedure get!_group!_in(representation);
  115. % returns the group of the internal data structure representation
  116. begin
  117. return car representation;
  118. end;
  119. symbolic procedure eli!_group!_in(representation);
  120. % returns the internal data structure representation without group
  121. begin
  122. return cdr representation;
  123. end;
  124. symbolic procedure get!_rep!_matrix!_in(elem,representation);
  125. % returns the matrix of the internal data structure representation
  126. begin
  127. scalar found,mate,replist;
  128. found:=nil;
  129. replist:=cdr representation;
  130. while (null(found) and length(replist)>0) do
  131. <<
  132. if ((caar(replist)) = elem) then
  133. <<
  134. mate:=cadr(car (replist));
  135. found:=t;
  136. >>;
  137. replist:=cdr replist;
  138. >>;
  139. if found then return mate else
  140. rederr("error in get representation matrix");
  141. end;
  142. symbolic procedure get!_dimension!_in(representation);
  143. % returns the dimension of the representation (internal data structure)
  144. % output is an integer
  145. begin
  146. return change!+sq!+to!+int(mk!+trace(get!_rep!_matrix!_in('id,
  147. representation)));
  148. end;
  149. symbolic procedure get!_rep!_matrix!_entry(representation,elem,z,s);
  150. % get a special value of the matrix representation of group
  151. % get the matrix of this representatiuon corresponding
  152. % to the element elem
  153. % returns the matrix element of row z and column s
  154. begin
  155. return get!+mat!+entry(
  156. get!_rep!_matrix!_in(elem,representation),
  157. z,s) ;
  158. end;
  159. symbolic procedure mk!_resimp!_rep(representation);
  160. begin
  161. scalar group,elem,res;
  162. group:=get!_group!_in(representation);
  163. res:=for each elem in get!*elements(group) collect
  164. list(elem,mk!+resimp!+mat(get!_rep!_matrix!_in(elem,representation)));
  165. return append(list(group),res);
  166. end;
  167. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  168. %
  169. % functions for characters in iternal structure
  170. %
  171. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  172. symbolic procedure get!_char!_group(char1);
  173. % returns the group of the internal data structure character
  174. begin
  175. return car char1;
  176. end;
  177. symbolic procedure get!_char!_dim(char1);
  178. % returns the dimension of the internal data structure character
  179. % output is an integer
  180. begin
  181. return change!+sq!+to!+int(get!_char!_value(char1,'id));
  182. end;
  183. symbolic procedure get!_char!_value(char1,elem);
  184. % returns the value of an element
  185. % of the internal data structure character
  186. begin
  187. scalar found,value,charlist;
  188. found:=nil;
  189. charlist:=cdr char1;
  190. while (null(found) and length(charlist)>0) do
  191. <<
  192. if ((caar(charlist)) = elem) then
  193. <<
  194. value:=cadr(car (charlist));
  195. found:=t;
  196. >>;
  197. charlist := cdr charlist;
  198. >>;
  199. if found then return value else
  200. rederr("error in get character element");
  201. end;
  202. endmodule;
  203. end;