1#############################################################################
2##
3##  projective.gi      recog package
4##                                                        Max Neunhoeffer
5##                                                            Ákos Seress
6##
7##  Copyright 2006-2008 by the authors.
8##  This file is free software, see license information at the end.
9##
10##  Generic code for projective groups.
11##
12#############################################################################
13
14InstallGlobalFunction( IsOneProjective,
15  function(el)
16    local s, n, i, j, zero;
17    n := Length(el[1]);
18    Assert(1, DimensionsMat(el) = [n,n]);
19    s := el[1,1];
20    if IsZero(s) then return false; fi;
21    zero := Zero(s);
22    for i in [1..n] do
23        if el[i,i] <> s then return false; fi;
24        for j in [1..n] do
25            if i <> j and el[i,j] <> zero then return false; fi;
26        od;
27    od;
28    return true;
29  end );
30
31InstallGlobalFunction( IsEqualProjective,
32  function(a,b)
33    local p,s,i;
34    p := PositionNonZero(a[1]);
35    s := b[1,p] / a[1,p];
36    for i in [1..Length(a)] do
37        if s*a[i] <> b[i] then return false; fi;
38    od;
39    return true;
40  end );
41
42##
43##  This program is free software: you can redistribute it and/or modify
44##  it under the terms of the GNU General Public License as published by
45##  the Free Software Foundation, either version 3 of the License, or
46##  (at your option) any later version.
47##
48##  This program is distributed in the hope that it will be useful,
49##  but WITHOUT ANY WARRANTY; without even the implied warranty of
50##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
51##  GNU General Public License for more details.
52##
53##  You should have received a copy of the GNU General Public License
54##  along with this program.  If not, see <http://www.gnu.org/licenses/>.
55##
56
57