[BACK]Return to drivers_for_symmetry_group_io.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Symmetry

File: [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Symmetry / drivers_for_symmetry_group_io.adb (download)

Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:31 2000 UTC (23 years, 7 months ago) by maekawa
Branch: PHC, MAIN
CVS Tags: v2, maekawa-ipv6, RELEASE_1_2_3, RELEASE_1_2_2_KNOPPIX_b, RELEASE_1_2_2_KNOPPIX, RELEASE_1_2_2, RELEASE_1_2_1, HEAD
Changes since 1.1: +0 -0 lines

Import the second public release of PHCpack.

OKed by Jan Verschelde.

with text_io,integer_io;                 use text_io,integer_io;
with Communications_with_User;           use Communications_with_User;
with Numbers_io;                         use Numbers_io;
with Symbol_Table,Symbol_Table_io;       use Symbol_Table;
with Symbolic_Symmetry_Group_io;

package body Drivers_for_Symmetry_Group_io is

  procedure Read_Permutation_Group
               ( n : in natural; g,v : in out List_of_Permutations;
                 allperms : out boolean ) is

    ans : character;
    nb : natural;

  begin
    new_line;
    put("Is the group the full permutation group ? (y/n) ");
    Ask_Yes_or_No(ans);  allperms := (ans = 'y');
    if ans = 'y'
     then
       g := SymGrp(n);
     else
       put("The neutral element of the group is represented as ");
       for i in 1..n loop
         declare
           sb : Symbol;
         begin
           sb := (sb'range => ' ');
           sb := Symbol_Table.Get(i);
           Symbol_Table_io.put(sb);
           put(" ");
         end;
       end loop;
       new_line;
       put("Give the number of generating elements in the group : ");
       Read_Natural(nb);
       put("Give "); put(nb,1);
       put_line(" vector representations of the generating elements :");
       Symbolic_Symmetry_Group_io.Get(g,n,nb);
    end if;
    put("Do you want the generation of the group ? (y/n) ");
    Ask_Yes_or_No(ans);
    if ans = 'y'
     then v := Generate(g);
     else v := g;
    end if;  -- v = either full group or group supplied by user
  end Read_Permutation_Group;

  procedure Read_Symmetry_Group
               ( n : in natural; g,v : in out List_of_Permutations;
                 allperms,signsym,allsigns : out boolean ) is
   
    ans : character;
    nb : natural;
    pv,fv,fg : List_of_Permutations;

  begin
    Read_Permutation_Group(n,pv,fv,allperms);
    put("Is there any sign symmetry to take into account ? (y/n) ");
    Ask_Yes_or_No(ans);
    signsym := (ans = 'y');
    if ans = 'y'
     then
       put("Contains the group all sign permutations ? (y/n) ");
       Ask_Yes_or_No(ans);
       if ans = 'y'
        then
          allsigns := true;
        else
          allsigns := false;
          signsym := false;  -- fv will contain these permutations
          allperms := false; -- fv will be used for the generating solutions
          put("The sign inversion of all elements is represented as ");
          for i in 1..n loop
            put('-');
            declare
              sb : Symbol;
            begin
              sb := (sb'range => ' ');
              sb := Symbol_Table.get(i);
              Symbol_Table_io.put(sb); put(" ");
            end;
          end loop;
          new_line;
          put("Give the number of generating elements in the group : ");
          Read_Natural(nb);
          put("Give "); put(nb,1);
          put_line(" vector representations of the generating elements :");
          Symbolic_Symmetry_Group_io.Get(fg,n,nb);
       end if;
       put("Do you want the generation of the group ? (y/n) ");
       Ask_Yes_or_No(ans);
       if ans = 'y'
        then fv := Generate(Union(fg,pv));
        else fv := Union(fg,pv);
       end if;
     else
       allsigns := false;
    end if;
    g := Union(fg,pv); v := fv;
  end Read_Symmetry_Group;

end Drivers_for_Symmetry_Group_io;