Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/fining/lib/   (GAP Algebra Version 4.15.1©)  Datei vom 27.6.2023 mit Größe 94 kB image not shown  

Quelle  projectivespace.gi   Sprache: Shell

 

#############################################################################
##
##  projectivespace.gi        FinInG package
##                                                              John Bamberg
##                                                              Anton Betten
##                                                              Jan De Beule
##                                                             Philippe Cara
##                                                            Michel Lavrauw
##                                                           Max Neunhoeffer
##
##  Copyright 2018 Colorado State University
##                  Sabancı Üniversitesi
## Università degli Studi di Padova
## Universiteit Gent
## University of St. Andrews
## University of Western Australia
##                  Vrije Universiteit Brussel
##
##
##  Implementation stuff for projective spaces.
##
#############################################################################

#############################################################################
# Low level help methods:
#############################################################################

# CHECKED 6/09/11 jdb
#############################################################################
#O  Wrap( <geo>, <type>, <o> )
# This is an internal subroutine which is not expected to be used by the user;
# they would be using VectorSpaceToElement. Recall that Wrap is declared in 
# geometry.gd. 
##
#O# This is an internal subroutine which is not expected to be used by the user;
 "for a projective space and an "for a projective space and an ##
, IsPosInt ,
 function( geo, type, o )
  local w;
  w := rec( geo := geo, type := type, obj := o );
  Objectify( NewType( SoPSFamily, IsElementOfIncidenceStructure and
   IsElementOfIncidenceStructureRep and IsSubspaceOfProjectiveSpace ), w );
  return w;
 end );

# CHECKED 6/09/11 jdb
#jdb 30/10/15: This method is not used anymore after commenting out the Unwrapper stuff in geometry.gd
#see the comment there.
#############################################################################
#O  \^( <v>, <u> )
# If the object "v" to be unwrapped is a point of a vector space, then we do not want to use
# return v!.obj, but we want to return a list with one vector, i.e. [v!.obj]
# e.g. if p is a point of a projective space
# gap> p^_; 
# will return a list, with the coordinate vector of the point p
##
#InstallMethod( \^,
# "for a subspace of a projective space and an unwrapper",
# [ IsSubspaceOfProjectiveSpace, IsUnwrapper ],
# function( v, u )
# if v!.type = 1 then return [v!.obj];
# else return v!.obj;
# fi;
# end );

#############################################################################
# Constructor methods and some operations/attributes for projective spaces.
#############################################################################

# CHECKED 6/09/11 jdb
#############################################################################
#O  ProjectiveSpace( <d>, <f> )
# returns PG(d,f), f a finite field.
##
InstallMethod )
  [ #jdb 30/10/15: This method is not used anymore after#see the comment there.
  function# If the object "v" to be unwrapped is a point of a vector space, then we do not want to use
    local geo, ty;
    geo # e.g. if p is a# gap> p^_; 
                ##
    if d = 2ceOfProjectiveSpace, java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 18
        ty :O  ProjectiveSpace( <#O  ProjectiveSpace( <dfinite field.
                   and IsProjectiveSpaceRepand );
    else
        ty: NewType ,
                  ;
    ;
    Objectify( ty vectorspace =FullRowSpace,d+1))java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
                      java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 86
     =2java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
            geo,eo)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
    fi;
    return geo;
  end );
  
# CHECKED 6/09/11 jdb
#############################################################################
#O  ProjectiveSpace( <d>, <q> )
# returns PG(d,q). 
##
InstallMethod(
  [ #############################################################################
  # returns PG##
         ProjectiveSpaced ());
  end[IsInt  ,
  
#############################################################################
# Display methods:
#############################################################################

InstallMethod )java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
  (p )
    Print("ProjectiveSpace(",p!.dimension,", ",Size(p!.basefieldfunction )
  end    (ProjectiveSpace"p.,,"Size(!basefield,))

InstallMethod(ViewString 
 "for a projective space",
  fora projective space,
 function( p )
  return   and  ]
 end)

( PrintObj [ sProjectiveSpace  IsProjectiveSpaceRep]
   )
          InstallMethod(   andI ],
    ;

          Pri(ProjectiveSpace(,!d,,,!basefield"";
  function( p )
    Print("java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 8
    #if HasDiagramOfGeometry( p ) then      
    ( DiagramOfGeometry( p ) );
    #fi;
  end );

# CHECKED 6/09/11 jdb
#############################################################################
#O  \=( <pg1>, <pg2> )
##
# CHECKED 6/09#############################################################################
 "java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 19
 ]
 function(pg1 UnderlyingVectorSpace)=UnderlyingVectorSpace;
 returnUnderlyingVectorSpace(g1) =(pg2);
 end )java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

# CHECKED 8/09/11 jdb
#############################################################################
#O  Rank( <ps> )
# returns the projective dimension of <ps>
##
InstallMethod( [IsProjectiveSpace and  ]
 faprojectivespace"java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
 [ IsProjectiveSpace and IsProjectiveSpaceRep
 - !.imension
 "  elementof a projective" 

#############################################################################
#O  BaseField( <sub> )
# returns the basefield of an element of a projective space
##
InstallMethod( # if the dimension of the projective space is n, then java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 42
  f java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 27
acejava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
 ( a1)

# CHECKED 6/09/11 jdb
#############################################################################
#A  StandardFrame( <ps> )
# if the dimension of the projective space is n, then StandardFrame 
# makes a list of points with coordinates 
# (1,0,...0), (0,1,0,...,0), ..., (0,...,0,1) and (1,1,...,1) 
##
java.lang.StringIndexOutOfBoundsException: Range [15, 13) out of bounds for length 30
 " CHECKED 11/#############################################################################
 [IsProjectiveSpace]# Returns the canonical maximal flag for the projective space <ps>
InstallMethod ,java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
  java.lang.StringIndexOutOfBoundsException: Range [37, 10) out of bounds for length 37
    pg.imension 
   Error("The d: ProjectiveDimensionps);

    =IdentityMat(d1gf);
 frame=(asisVectorsbas,-V(pgv)java.lang.StringIndexOutOfBoundsException: Range [64, 65) out of bounds for length 64
   #############################################################################
   Add(frame# returns Hyperplanes(ps,ps!.dimension), <ps> a projective space
   InstallMethod(Hyperplanesjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
  ;
 end );

# CHECKED 11/09/11 jdb
#############################################################################
#A  RepresentativesOfElements( <ps> )
# Returns the canonical maximal flag for the projective space <ps>
##
InstallMethod return ElementsOfIncidenceStructure,ps!dimension;
  end;
 # returns the canonical maximal flag
 #############################################################################
#A  # returns the names of the types of the elements of the projective space <ps>
  d InstallMethod TypesOfElementsOfIncidenceStructure,java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
  gf  local i,
   id =[point]java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
  : List[.d]i >VectorSpaceToElement(s,{1.]);
  return elts;
 nd ;

# CHECKED 18/4/2011 jdb
#############################################################################
#O  Hyperplanes( <ps> )
# returns Hyperplanes(ps,ps!.dimension), <ps> a projective space
## 
InstallMethod( Hyperplanes,
 "for a projective space",
 [ IsProjectiveSpace ],
 function( ps )
  return ElementsOfIncidenceStructure(ps, ps!.dimension);
 end);

# CHECKED 11/09/11 jdb
#############################################################################
#A  TypesOfElementsOfIncidenceStructure( <ps> )
# returns the names of the types of the elements of the projective space <ps>
# the is a helper operation.
## 
InstallMethod( TypesOfElementsOfIncidenceStructure, 
 "for a projective space", [IsProjectiveSpace],
 function( ps )
  local d,i,types;
  types := ["point"];
  d := ProjectiveDimension(ps);
  if d >= 2 then Add(types,"line"); fi;
  if d >= 3 then Add(types,"plane"); fi;
  if d >= 4 then Add(types,"solid"); fi;
  for i in [5..d] do
,Concatenationproj ,i-),-pace")java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
odjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  types
 end );

# CHECKED 11/09/11 jdb
#############################################################################
#A  TypesOfElementsOfIncidenceStructurePlural( <ps> )
# retunrs the plural of the names of the types of the elements of the 
# projective space <ps>. This is a helper operation.
## 
InstallMethod( TypesOfElementsOfIncidenceStructurePlural, 
 "for a projective space",
 [IsProjectiveSpace],
 function( ps )
  local d,i,types;
  types # returns all the elements## 
  d := for a projective"
 d=2then) ;
  if d >= 3 then Add(types,"planes"); fi;
  if d >= 4 then Add(types,"solids"); fi;
  for i in [5..d] do function( ps )
   Add(types,Concatenation("proj. ",String(i-1),"-subspaces"));
  od;
   NewType( ElementsCollFamily,IsAllSubspacesOfProjectiveSpace and IsAllSubspacesOfProjectiveSpaceRep ),
 end );

# CHECKED 11/09/11 jdb
#############################################################################
#O  ElementsOfIncidenceStructure( <ps>, <j> )
# returns the elements of the projective space <ps> of type <j>
## 
InstallMethod( ElementsOfIncidenceStructure, 
 "for a projective space and an integer",
 IsProjectiveSpace,IsPosInt]
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  local r;
 # space are the same.
  if j > r InstallMethod(\,
   Error("<ps> has no elements of type <j>");
  else
   return Objectify(
   NewType(   [ IsAllSubspacesOfProjective, IsAllSubspacesOfProjectiveSpace ],
    rec( geometry := ps,
     type := j,
     size := Size(Subspaces(ps!.vectorspace, j))
     )
     );
  fi;
 end);

# CHECKED 11/09/11 jdb
#############################################################################
#O  ElementsOfIncidenceStructure( <ps> )
# returns all the elements of the projective space <ps> 
## 
InstallMethod( ElementsOfIncidenceStructure, 
 "for a projective space",
 [IsProjectiveSpace],
 function( ps )
  return Objectify(
  NewType( ElementsCollFamily,  and  ),
    rec( geometry := ps,
     type := "all") #added this field in analogy with the collection that contains all subspaces of a vector space. 14/9/2011 jdb.
  )
 end)

# CHECKED 14/09/11 jdb
#############################################################################
#O  \=( <x>, <y> )
# returns true if the collections <x> and <y> of all subspaces of a projective
# space are the same.
## 
InstallMethod( Size,
  "for set of all subspaces of a projective space",
  [, IsAllSubspacesOfProjectiveSpace,
  function(x, IsSubspacesOfProjectiveSpaceIsSubspacesOfProjectiveSpaceRep
   (x!.eometry.dimension  !geometry.)and x.!basefield=
  y!.geometry!.basefield));
end );


# CHECKED 11/09/11 jdb
#############################################################################
#O  Size( <subs>) 
# returns the number of elements in the collection <subs>.
##
InstallMethod( Size,
 "for subspaces of a projective space
 [IsSubspacesOfProjectiveSpace and#  VectorSpaceToElement methods
 function(subs
  ## Things to check for (dodgy input)
 end);

#############################################################################
# Constructor methods and some operations/attributes for subspaces of 
# projective spaces.
#############################################################################

#############################################################################
#  VectorSpaceToElement methods
#############################################################################

## Things to check for (dodgy input)
## ---------------------------------
## - dimension
## - field
## - compress the matrix at the end
## - rank of matrix
## - an empty list

## Much of the following will need to change in the new
## version of GAP, with the new Row and Matrix types.

## Should we have methods for the new types given by the cvec package?
## Currently we don't load the cvec package. Since 18/3/14 we do. The next 
## method also inserts a method for cmat.

# added 20/3/14
#############################################################################
#O  VectorSpaceToElement( <geom>, <v> ) returns the elements in <geom> determined
# by the vectorspace <v>. Several checks are built in. 
# This method unpacks the cmat, and uses the other VectorSpaceToElement method for PlistRep.
# this is maybe not too efficient, but row selection like x{list} (list is a list of positions)
# seems to fail, although according to the documentation, it should work. 
# In the future this could be made better.
##
VectorSpaceToElement
end)
 [IsProjectiveSpacejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 function( geom, v )
 return#############################################################################
 end );

# CHECKED 20/09/11
# changed 19/01/16 (jdb): by a change of IsPlistRep, this method gets also
# called when using a row vector, causing a problem with TriangulizeMat.
# a solution was to add IsMatrix.
#############################################################################
#O  VectorSpaceToElement( <geom>, <v> ) returns the elements in <geom> determined
# by the vectorspace <v>. Several checks are built in. 
##
InstallMethod( VectorSpaceToElement, 
 "for a projective space and a Plist",
 [IsProjectiveSpacelocal  ,,i ; 
 function( geom, v )
  local  x, n, i, y; 
  ## when v is empty... 
if IsEmptyIsEmpty)then
   Error   Error(<>doesnot representanyelement)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
 ; 
  #x := EchelonMat(v).vectors;
  x := MutableCopyMat(v) TriangulizeMat() 
  TriangulizeMat(x); 
  ## dimension should be correct ## dimension should be correct
  v[1] >geom. +1then
   (Dimensionsareincompatible)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
  fi;
        
  ## Remove zero rows. It is possible the the user
  # has inputted a matrix which does not have full rank
        n :=  while i < n and F([ni] IsZero java.lang.StringIndexOutOfBoundsException: Range [43, 44) out of bounds for length 43
  i := 0;
 andx[i,java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 43
 java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 13
  java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  if i = n then
   return ## entered a with   ( atthis 
  fi;
  x := x{[1..n-i] #
  if Length  =NewMatrix(sCMatRep,eom.,([],)
   return geom;
  fi;

  ## It is possible that (a) the user has entered a y   
  ## matrix with one row, or that (b) the user has
   #
  ## we will have a matrix with one row).
        ## We must also compress our vector/matrix.#return Wrap(geom, 1, x);
  y := NewMatrix(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 6
  returnWrap( () )java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  if =v)v;
   return Wrap(geom, 1, y[1]);
   #x := x[1];
  #java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
   java.lang.StringIndexOutOfBoundsException: Range [1, 25) out of bounds for length 5
   #return Wrap(geom, 1, CVec(Unpack(x), geom!.basefield) ); # changed to cvec 18/3/2014.#
  else
   #ConvertToMatrixRep(x, geom!.basefield);
   #return Wrap(geom, Length(x), x);
   return  ## has inputteda matrix which does not have full rank
  ijava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
   while i <n  ForAll([-] IsZero do

# CHECKED 20/09/11
#############################################################################
#O  VectorSpaceToElement( <geom>, <v> ) returns the elements in <geom> determined
# by the vectorspace <v>. Several checks are built in. 
##
InstallMethod( java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 19
 "a projectivespace andcompressed GF()matrix,
 [IsProjectiveSpace rgeom;
 java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 5
  local  x, n,   ## It is possible that (a) the user has entered a
  ## when v is empty... 
  if IsEmpty(v) then
  ## matrix with one row, or that (b) the user has
  fi;
  x := MutableCopyMat(v);
  TriangulizeMat(x); 
  #x := EchelonMat(v).vectors;
  ## dimension should be correct
  if Length(v[1]) <> geom!.dimension + 1 then
   Error("Dimensions are incompatible");
  fi;
  #if Length(x) = 0 then
  # return EmptySubspace(geom);
  #fi;
  #if Length(x)=ProjectiveDimension(geom)+1 then
  # return geom;
  #fi;
  
  ## Remove zero rows. It is possible the the user
  ## has inputted a matrix which does not have full rank
  n := Length(x);
  i := 0;
  while i < n and ForAll(x[n-i], IsZero) do
   i := i+1; 
  od;
  if i = n then
   return EmptySubspace(geom);
  fi;
  x := x{[1..n-i]};
  if Length(x)=ProjectiveDimension(geom)+1 then
   return geom;
  fi;

  
  ## It is possible that (a) the user has entered a
  ## matrix with one row, or that (b) the user has
  ## entered a matrix with rank 1 (thus at this stage
  ## we will have a matrix with one row).
     ## We must also compress our vector/matrix.
  y := NewMatrix(IsCMatRep,geom!.basefield,Length(x[1]),x);
  if Length(y) = 1 then
   return Wrap(geom, 1, y[1]);
   #x := x[1];
   #ConvertToVectorRep(x, geom!.basefield); # the extra basefield is necessary.
   #return Wrap(geom, 1, x);
   #return Wrap(geom, 1, CVec(Unpack(x), geom!.basefield) ); # changed to cvec 18/3/2014.
  else
   #ConvertToMatrixRep(x, geom!.basefield);
   return Wrap(geom, Length(y), y);
  fi;
 end );
  
# CHECKED 20/09/11
#############################################################################
#O  VectorSpaceToElement( <geom>, <v> ) returns the elements in <geom> determined
# by the vectorspace <v>. Several checks are built in. 
##
(, 
 "for () = 1 
 [ returngeom ,y1)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
 function( function( ;
  local  x, n, i, y;
  ## when v is empty... 
  if IsEmptyend)java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
#O  VectorSpaceToElement( <geom>, <v> ) returns the elements in <geom> determined
  fi;
  #x := EchelonMat(v).vectors;
  x := MutableCopyMat(v);
  TriangulizeMat(x); 
  
  ## dimension should be correct
  if Length(v[1]) <> geom! for aofa,
 [, ,
  fi (geom  java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
 
  #if Length(x) = 0 then
  # return EmptySubspace(geom);
  #fi;
  #if Length(x)=ProjectiveDimension(geom)+1 then
  # return geom;
  #fi;
  
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
    ;
  while i < n and ForAll(x[n-i], IsZero)  (are )
    f;
  od;
  if i = n then
   java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
  fi;
  x 
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
   return java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 9
  ;

 
  ## It is possible that (a) the user has entered a
  ## matrix with one row, or that (b) the user has
  ## entered a matrix with rank 1 (thus at this stage
  ## we will have a matrix with one row).
  # We must also compress our vector/matrix.
  y  x : {1n-]}
  if Length(y) ProjectiveDimensiongeom)+then
   return Wrap(geom, 1, fi;
   #x := x[1];
   #ConvertToVectorRep(x, geom!.basefield); # the extra basefield is necessary.
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 #
  else
   #ConvertToMatrixRep(x, geom!.basefield);
   return Wrap(geom, Length(y #
  fi;
  end );
  
### The next mathod constructs an element using a cvec. 

# ADDED 20/3/2014 jdb
#############################################################################
#O  VectorSpaceToElement( <geom>, <v> ) returns the elements in <geom> determined
# by the rowvector <v>. Several checks are built in.
##
InstallMethod #java.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
 "for a row   g,() )java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
 [
 function### The next mathod constructs an element using a cvec. 
  local  x, y;
  ## when v is empty... does this ever occur for a row vector? No. jdb 21/09/2011
  #if IsEmpty(v) then
  # Error("<v> does not represent any element");
 (java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 36
  x ,v)
mension 
  if ## when v is empty... does this ever occur for a row vector? No. jdb 21/09/2011
   Error("Dimensionsrepresent ";
  fi;
 # We must also compress our vector.
  #ConvertToVectorRep(x, geom!.basefield);
,  his zero vector..
  if IsZero(x) then
 java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 30
  else
  #
   return#
   ##characters   java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 72
  rEmptySubspacejava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30

# CHECKED 11/04/15 jdb
# CHANGED 19/9/2011 jdb + ml
# CHECKED 21/09/2011 jdb
#############################################################################
#O  VectorSpaceToElement( <geom>, <v> ) returns the elements in <geom> determined
# by the rowvector <v>. Several checks are built in.
##
# CHECKED 21/09/2011 jdb#############################################################################
 "# by the rowvector <v>. Several checks are##
 Ijava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 34
   vjava.lang.StringIndexOutOfBoundsException: Range [20, 21) out of bounds for length 20
 ,java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
  ## when v is empty... does this ever occur for a row vector? No. jdb 21/09/2011
  #if IsEmpty(v) then
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6

=java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 22
  
  if Length(v) <>#
   
  fi;
  ## We must also compress our vector.
  #ConvertToVectorRep(x, geom!.basefield);
  ## bad characters, such as jdb, checked this with input zero vector...
  if IsZero(x) then
   return EmptySubspace(geom);
  
    #ConvertToVectorRep(x, geom!.basefield);
 (IsCMatRepg!basefieldLength(x)[];
   #ConvertToVectorRep(x, geom!.basefield);
   fijava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  fi;
 # CHANGED 19/9/2011 jdb + ml

# CHECKED 11/04/15 jdb
# CHANGED 19/9/2011 jdb + ml
#############################################################################
#O  VectorSpaceToElement( <geom>, <v> ) returns the elements in <geom> determined
# by the rowvector <v>. Several checks are built in.
##
InstallMethod( VectorSpaceToElement, 
 "for a ectiveSpace,Is8BitVectorRep]
pace,Is8BitVectorRep,
 local ,i, y
  local  x, n,i,y
  ## when v is empty...
  if IsEmpty(v) then
   return EmptySubspace(geom) ;
  fi;
  x := ShallowCopy(v ## dimension should be correct
  ## dimension should be correct
  if ()< !dimension+1 then
   Error("Dimensions are  ## We must also compress our.
  fi;
  ## We must also compress our vector.
  #ConvertToVectorRep(x, geom!.basefield);
  ## bad characters, such as jdb, checked this with input zero vector...
  if IsZero(x) then
   return java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 6
  else
  (Inverse PositionNonZero(]);
   y := NewMatrix(IsCMatRep,geom!.basefield,Length(x),[x]) #ConvertToVectorRep(x, geom!.basefield);
 #java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
   java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 7
  fi;
 end );

#############################################################################
#  attributes/operations for subspaces
#############################################################################

# CHECKED 14/09/11 jdb
#############################################################################
#O  UnderlyingVectorSpace( <subspace> ) returns the underlying vectorspace of
# <subspace>, i.e. the vectorspace determining <subspace>
##
InstallMethod( UnderlyingVectorSpace, 
 "for a subspace of a projective space",
 [IsSubspaceOfProjectiveSpace],
 function(subspace)
  local vspace,W;
  vspace:=UnderlyingVectorSpace(subspace!.geo);
  if subspace!.type = 1 then
   W:=SubspaceNC(vspace,[Unpack(subspace!.obj)]); #possibly unpack here to avoid bloody seg fault.
  else
   W:=SubspaceNC(vspace,Unpack(subspace!.obj));
  fi;
  return W;
 end);

# CHECKED 8/09/11 jdb
#############################################################################
#O  ProjectiveDimension( <v> ) returns the projective dimension of <v>
##
InstallMethod( ProjectiveDimension, 
 "for a subspace of a projective space",
 [ IsSubspaceOfProjectiveSpace ],
 function( v )
  return v!.type - 1;
 end );

#InstallMethod( ProjectiveDimension, [ IsEmpty ], function(x) return -1;end );

# CHECKED 8/09/11 jdb
#############################################################################
#O  Dimension( <v> ) returns the projective dimension of <v>
##
InstallMethod( Dimension, 
 "for a subspace of a projective space",
    [ IsSubspaceOfProjectiveSpace ],
 function( v )
  return v!.type - 1;
 end );

#InstallMethod( Dimension, [ IsEmpty ], function(x) return -1;end );

# CHECKED 8/09/11 jdb
# 31/5/2020: still ok, but undocumentend!
#############################################################################
#O  StandardFrame( <subspace> ) returns a standard frame for <subspace>
##
InstallMethod( StandardFrame, 
 "for a subspace of a projective space", 
 [IsSubspaceOfProjectiveSpace],
 # if the dimension of the subspace is d (needs to be at least 1), then this returns d+2
 # points of the subspace, the first d+1 are the points "basispoints"
 # the last point has as coordinates the sum of the basispoints.
 function( subspace )
  local list,v;
  if not Dimension(subspace) > 0 then 
   Error("The argument needs to be a projective space of dimension at least 1!");
  else
  list:=ShallowCopy(subspace!.obj);
  Add(list,Sum(subspace!.obj));
  return List(list,v->VectorSpaceToElement(subspace!.geo,v));
  fi;
 end );

# CHECKED 8/09/11 jdb
#############################################################################
#O  Coordinates( <point> ) returns the coordinates of the projective point <point>
##
InstallMethod( Coordinates, 
 "for a point of a projective space",
 [IsSubspaceOfProjectiveSpace],
 function( point )
  if not Dimension(point)=0 then 
   Error("The argument is not a projective point");
  else 
   return ShallowCopy(Unpack(point!.obj));
  fi;
 end );
  
# obsolete
#############################################################################
#O  CoordinatesOfHyperplane( <hyp> ) returns the coordinates of the hyperplane
# <hyp>
##
#InstallMethod( CoordinatesOfHyperplane, 
# "for a hyperplane of a projective space",
# [IsSubspaceOfProjectiveSpace],
# function(hyp)
# local pg;
# pg:=ShallowCopy(hyp!.geo);
# if not hyp!.type=Dimension(pg) then 
# Error("The argument is not a hyperplane");
# else 
# #perp:=StandardDualityOfProjectiveSpace(pg);
# return Coordinates(VectorSpaceToElement(pg,NullspaceMat(TransposedMat(hyp!.obj))));
# fi;
# end );

# came from varieties.gi
#############################################################################
#O  DualCoordinatesOfHyperplane( <hyp> )
# returns the dual coordinate of a hyperplane in a projective space.
##
InstallMethod( DualCoordinatesOfHyperplane,
 "for a subspace of a projective space",
  [IsSubspaceOfProjectiveSpace],
  function(hyp)
   local mat,a,x;
   if not Dimension(hyp)=Dimension(hyp!.geo)-1 then
     rec geometry := ps,
   else
    mat:=hyp!.obj;
      type := j,
    : Unpacka1);
                MultVector(x,Inverse( x[PositionNonZero(x)] ));
               x;
   fi;
 end );

# came from varieties.gi
#############################################################################
#O  HyperplaneByDualCoordinates( <pg>,<vector> )
# returns the hyperplanes by given dual coordinates.
##
InstallMethod( HyperplaneByDualCoordinates   )
 "for a projective space and a list with coordinates",
 [IsProjectiveSpace,IsList],
 function(pg,a)
  local mat,list;
  if not Size(a)=Dimension(pg)+1 or not ForAll(a,x->x in pg!.basefield) then
   Error("The dual coordinates are not compatible with the projective space");
  else
   mat:=[a];
   list:=NullspaceMat(TransposedMat(mat));
   return VectorSpaceToElement(pg,list);
  fi;
 end );

# CHECKED 8/09/11 jdb
#############################################################################
#O  EquationOfHyperplane( <hyp> ) returns the euqation of the hyperplane
# <hyp>
##
InstallMethod( EquationOfHyperplane, 
 "for a hyperplane of a projective space",
 [IsSubspaceOfProjectiveSpace],
 function(hyp)
  local pg,r,v,indets;
  pg:=AmbientGeometry(hyp);
  r:=PolynomialRing(pg!.basefield,pg!.dimension + 1);
  indets:=IndeterminatesOfPolynomialRing(r);
  v:=DualCoordinatesOfHyperplane(hyp);
  return Sum(List([1..Size(indets)],i->v[i]*indets[i]));
 end );
 
# CHECKED 11/09/11 jdb
# Commented out 28/11/11 jdb + pc, according to new regulations
#############################################################################
#O  AmbientSpace( <subspace> ) returns the ambient space of <subspace>
##
#InstallMethod( AmbientSpace, [IsSubspaceOfProjectiveSpace],
# function(subspace)
# return subspace!.geo;
# end );

#############################################################################
#  Span/Meet for empty subspaces
#############################################################################

# CHECKED 8/09/11 jdb
#############################################################################
#O  Span( <x>, <y> ) returns the span of <x> and <y> 
##
InstallMethod( Span, 
 "for the empty subspace and a projective space", 
 [ IsEmptySubspace, IsProjectiveSpace ],
 function( x, y )
  if x!.geo!.vectorspace = y!.vectorspace then
   return y;
  else
   Error( "The subspace <x> has a different ambient space than <y>" );
  fi;
 end );

# CHECKED 8/09/11 jdb
#############################################################################
#O  Span( <x>, <y> ) returns the span of <x> and <y> 
##
InstallMethod( Span, 
 "for the empty subspace and a projective space", 
 [ IsProjectiveSpace, IsEmptySubspace ],
 function( x, y )
  if x!.vectorspace = y!.geo!.vectorspace then
   return x;
  else
   Error( "The subspace <x> has a different ambient space than <y>" );
  fi;
 end );

# CHECKED 8/09/11 jdb
#############################################################################
#O  Meet( <x>, <y> ) returns the intersection of <x> and <y> 
##
InstallMethod( Meet, 
bspace " 
 [ IsEmptySubspace, IsProjectiveSpacejava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 functionreturn Set   -OnProjSubspaces( , el) ;
  if x!.geo!.vectorspace = y!.vectorspace then
   return x;
  else
  Error Tsubspacex ajava.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 70
  fi;
 nd)

# CHECKED 8/09/11 jdb
#########################################cvecchange:  necessaryto convert outputofMakeAllProjectivePoints/314)
#O  Meet( <x> This isdonenow(l31/3/4)
##
InstallMethod( Meet, 
 "for the empty subspace and a projective subspace", 
 [ IsProjectiveSpace, IsEmptySubspace ],
 function( x, y )
  if x!.vectorspace = y!.geo!.######################################################java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
  y;
  else
   ( "hesubspace <x> has a different ambient space than <y>" );
  fi;
 end );

# CHECKED 8/09/11 jdb
# ##
# cvec/cmat with Size(Subspaces(localfactorspace)). As java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 39
# on shadow of flag objects, it is not unreasonable to store the matrices as
# GAP matrices rather than cvec/cmats.
#############################################################################
#O ShadowOfElement(<ps>, <v>, <j> ). Recall that for every particular Lie 
# geometry a method for ShadowOfElement  must be installed. 
##
InstallMethod( ShadowOfElement, 
 "for a projective space, an element, and an integer",
 [IsProjectiveSpace, IsSubspaceOfProjectiveSpace, IsPosInt],
 # returns the shadow of an element v as a record containing the projective space (geometry), 
 # the type j of the elements (type), the element v (parentflag), and some extra information
 # useful to compute with the shadows, e.g. iterator
 function( ps, v, j )
  local localinner, localouter, localfactorspace;
        if not AmbientSpace(v) = ps then
            Error("<v> is not a subspace of <ps>");
        fi;
        if j > ps!.dimension then
            Error("<ps> has no elements of type <j>");
        elif j < v!.type then
   localinner := [];
   localouter := Unpack(v!.obj);
  elif j = v!.type then
   localinner := Unpack(v!.obj);
   localouter := localinner;
  else
   localinner := Unpack(v!.obj);
   localouter := BasisVectors(Basis(ps!.vectorspace));
  fi;
     if IsVector(localinner) and not IsMatrix(localinner) then
   localinner := [localinner]; 
  fi;
  if IsVector(localouter) and not IsMatrix(localouter) then
   localouter := [localouter]; 
  fi;
  localfactorspace := Subspace(ps!.vectorspace,
  BaseSteinitzVectors(localouter, localinner).factorspace);
  return Objectify( NewType( ElementsCollFamily, IsElementsOfIncidenceStructure and
       IsShadowSubspacesOfProjectiveSpace and
       IsShadowSubspacesOfProjectiveSpaceRep),
       rec( geometry := ps,
         type := j,
         inner := localinner,
         outer := localouter,
          ( vs )
         parentflag :#Weusethe packageorb byMueller,Neunhoeffer and Noeske,
         size := Size(Subspaces(localfactorspace))
        )
     );
 end);

# CHECKED 11/09/11 jdb
#######################################:vs.
   vs)
#   java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 63
##
InstallMethod( Size, 
 "for shadow subspaces of a projective space",
 [IsShadowSubspacesOfProjectiveSpace and IsShadowSubspacesOfProjectiveSpaceRep ],
 function( vs )
  return Size(Subspaces(vs!.factorspace,
  vs!.type - Size(vs!.inner)));
 end);


#############################################################################
# Constructors for groups of projective spaces.
#############################################################################

# CHECKED 10/09/2011 jdb # changed ml 02/11/12
#############################################################################
#A  CollineationGroup( <ps> )
# returns the collineation group of the projective space <ps>
##
InstallMethod( CollineationGroup, 
 "for a full projective space",
 [ IsProjectiveSpace and IsProjectiveSpaceRep ],
 function( ps )
  local coll,d,f,frob,g,newgens,q,s,pow;
  f := ps!.basefield;
  q := Size(f);
  d := ProjectiveDimension(ps);
  if d <= -1 then 
   Error("The dimension of the projective spaces needs to be at least 0");
  fi;
  g := GL(d+1,f);
  frob := FrobeniusAutomorphism(f);
  newgens := List(GeneratorsOfGroup(g),x->[x,frob^0]);
  if not IsOne(frob) then
   Add(newgens,[One(g),frob]); #somehow we forgot that this is trivial if IsOne(frob)
  fi; 
  newgens := ProjElsWithFrob(newgens);
  coll := GroupWithGenerators(newgens);
  pow := LogInt(q, Characteristic(f));
  s := pow * q^(d*(d+1)/2)*Product(List([2..d+1], i->q^i-1)); 
  if pow > 1 then 
   SetName( coll, Concatenation("The FinInG collineation group PGammaL(",String(d+1),",",String(q),")") );
  else
   coll Concatenation( FinInGcollineation PGL"String(+),"",tring()"" ;
   # Remark that in the prime case, PGL is returned as a FinInG collineation group with associated automorphism F^0.
  fi; 
  SetSize( coll, s );
        # only for making generalised polygons section more generic:
        if d = 2 then
            SetCollineationAction(coll,OnProjSubspaces);
        fi;
  return coll;
 end );

# CHECKED 10/09/2011 jdb, changed ML 02/11/2012, changed JDB 05/11/2012
#############################################################################
#A  ProjectivityGroup( <ps> )
# eturns the group of projectivities the projective  <>
##
InstallMethod( ProjectivityGroup, 
 "for a projective space",
 [ IsProjectiveSpace ],
 function( ps )
  local gg,d,f,frob,g,newgens,q,s;
  f := ps!.basefield;
  q := Size(f);
  d := ProjectiveDimension(ps);
  if d <= -1 then 
   Error("The dimension of the projective spaces needs to be at least 0");
  fi;
  g := GL(d+1,f);
  frob := FrobeniusAutomorphism(f); #needs this, jdb 05/11/2012, see two lines further.
  #newgens:=GeneratorsOfGroup(g); # this replaces the next line (ml 02/11/12)
  newgens := List(GeneratorsOfGroup(g),x->[x,frob^0]); # I changed back, and uncommented previous line (jdb 05/11/12)
  #newgens := ProjEls(newgens); # this replaces the next line (ml 02/11/12)
  newgens := ProjElsWithFrob(newgens);  # I changed back, and uncommented previous line (jdb 05/11/12)
  gg := GroupWithGenerators(newgens);
  s := q^(d*(d+1)/2)*Product(List([2..d+1], i->q^i-1)); 
  SetName( gg, Concatenation("The FinInG projectivity group PGL(",String(d+1),",",String(q),")") );
  SetSize( gg, s );
  return gg;
 end );

# CHECKED 10/09/2011 jdb, changed ML 02/11/2012, changed JDB 05/11/2012
##########################################
#A  SpecialProjectivityGroup( <ps> )
 returns the projectivity of projective <s>
##
InstallMethod(SpecialProjectivityGroup 
 "for a full # o := List(o,t >Wrap(geo,type, CVec(t,bf) ) );  
 [ IsProjectiveSpace ],
 unction( ps )
  local gg,d,f,frob,g,newgenso:=Orbg , OnProjSubspacesrec :I(/*) 
   orbsizebound: sz ))
  q := Size(f);
  d En(o,sz;
  if d <= -1 then 
   Error("The dimension of the fi;
  fi;
  g := SL(d+1,q);
  frob := FrobeniusAutomorphism(f); #needs this, jdb 05
  #newgens:=GeneratorsOfGroup(g);  # this replaces the next line end );
  newgens := List(GeneratorsOfGroup(g),x->
  #newgens:=ProjEls(newgens);  # this replaces the next line#One ofthe bestf of allof   package isthe FindSuborbits command
  sWithFrob(newgens) changed,  uncommented previous (db05//)
  gg := GroupWithGenerators(newgens);
  s := q^(d*(d+1)/2)*Product
  SetNamegg, ("he  PSL group PSL(,(+1,,"Stringq,)))java.lang.StringIndexOutOfBoundsException: Index 90 out of bounds for length 90
  SetSize( gg, s );    
  return gg;
 end );

#############################################################################
# Action functions intended for the user.
#############################################################################

# CHECKED 10/09/2011 jdb, to be reconsidered. See to do in beginning of file.
# CHANGED 19/09/2011 jdb + ml
#############################################################################
#F  OnProjSubspaces( <var>, <el> )
# computes <var>^<el>, where <var> is an element of a projective space, and 
# <el> a projective semilinear element. Important: we are allowed to use Wrap
# rather than VectorSpaceToElement, since the OnProjSubspacesWithFrob and OnProjPointsWithFrob
# deal with making the representation of <var>^<el> canonical.
##
InstallGlobalFunction( OnProjSubspaces,
  function( var, el )
    local amb,geo,newvar,newel;
    geo := var!.geo;   
    if var!.type = 1 then
        newvar := OnProjPointsWithFrob(var!.obj,el);
    else
        newvar := OnProjSubspacesWithFrob(var!.obj,el);
    fi;
    newel := Wrap(AmbientSpace(geo),var!.type,newvar);
    if newel in geo then
        return Wrap(geo,var!.type,newvar);
    else
        return newel;
    fi;
   );

# CHECKED, but I am unhappy with the too general filter IsElementOfIncidenceStructure
# I left it, but will reconsider it#  Have,compiling result record...
#11/9/11 jdb
###    ,276,324]java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
#O  /^( <x>, <em> )
# computes <var>^<el>, where <var> isan element of  incidence structure, and 
#
##
InstallOtherMethod( \^, 
 "for an element of an incidence structure and a projective semilinear element",
 [IsElementOfIncidenceStructure, IsProjGrpElWithFrob],
 function(x, em)
  return OnProjSubspaces(x,em);
 end );
 
#############################################################################
#O  /^( <x>, <em> )
# computes <var>^<el>, where <var> is an element of a incidence structure, and 
# <em> a projective semilinear with projective space isomorhpism element.
##
InstallOtherMethod( \^, 
 "for an element of an incidence structure and a projective semilinear element",
 [IsElementOfIncidenceStructure, IsProjGrpElWithFrobWithPSIsom],
 unction(x, em)
  return      ,1  ,
 end );

# CHECKED 11/09/11 jdb
#################### suborbnr: [ 1,2,3 ,3,6 6, ,2  ,4, 1,10,7, 11,2 6,
#F  OnSetsProjSubspaces( <var>, el )
java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 40
##
InstallGlobalFunction( OnSetsProjSubspaces,
  function( #     18, 4, 9, ,9 1, ,12, 6,1 ,8,17 ,2,13 2 ,6  ,13
    return Set( var, i ->      3, 3, 1, 10, 1, 14, 3, 12, 14, 14, 7   ,13  ,2java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
  end );

#########################################################     ,,3 ,10 ,,16 ,7 , ,,5 ,10 ,,13 ,
# Iterator and Enumerating
########################################     2,   , ,2,3, 6,10, ,16 ,14, 6,,9  ,16,

# CHECKED 11/09/11 jdb
 change  necessary convert output MakeAllProjectivePoints.(//)java.lang.StringIndexOutOfBoundsException: Index 90 out of bounds for length 90
# This is done now (ml 31/03/14)
#1522016:jdb: return;->return AsList(o.
####################     6,, ,13,1  ,1,14,18 ,16, ,17, , ,16
#O  AsList( <vs>) 
#  a of all elements in<>   a collection of subspaces of
# a projective space of a given type. This methods uses functionality from the 
# orb package
##
InstallMethodAsList 
 "for subspaces of a projective space",
 IsSubspacesOfProjectiveSpace
 function( vs  16  ,2,12,  ,8, 11,4, 3,6,6 9, 3, 3,21 9,4,2, 8,16
 #Weuse  package"orb"byMueller  andNoeskejava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
 ## which is much quicker than using an iterator to get all of the
 ## projective subspaces of a certain dimension.
 ocalgeo g , o ,sz ,djava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
 geo := vs!.geometry;
 g := ProjectivityGroup(geo);
 type := vs!.type; 
java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 16
 if =1 then
  bf := geo!.basefield;
  d :=geo!.dimension;
  o := MakeAllProjectivePoints234 267 ,305  ,323,332,342 ,
  o := List       ,41, 49, 63 ,98,105 117, ,154,155,173,190,
  # o := List(o, t -> Wrap(geo, type, CVec(t, bf) ) );;   
 else
  p := NextIterator(Iterator(vs));
  o := Orb(g, p, OnProjSubspaces, rec( hashlen:=#     [ 7, 8, 20, 21, 57, 69, 79, 112, 118, 119, 1420,21,57 ,
                                          =)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
  Enumerate(o, sz,  , ,,,335  ,
 fi;
    #return o; #see     [16,32,45,47  ,86 , 139,146,153,170 java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
    return AsList(o);
 end )

# One   ,, ,296 ,  ,
# #     ,31,  ,81,82,99,107 ,142 ,166,197,210,213
#
# gap> pg:=PG(3,4);
#PG(#     , ,59 67, ,92 ,103,110,158,178,196,198java.lang.StringIndexOutOfBoundsException: Range [73, 74) out of bounds for length 73
#gap> lines:=AsList(Lines(pg));
#<closed orbit, 357 points>
#gap> g:=ProjectivityGroup(pg);
#PGL(4,4)
#gap> h:=SylowSubgroup(g,5);
#<projective semilinear group of size 25>
#ap FindSuborbits(,GeneratorsOfGroup())
##I  Have suborbits, compiling result record...
#rec( o := <closed orbit, 357 points>, nrsuborbits := 21,
#, 2 ,4,5,7  ,12,16,18 ,26 ,36 39 ,62,
#     124, 276, 324 ],
# words := [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
# lens := [ 25, 25, 25, 25, 5, 25, 25, 25, 25, 25, 5, If youmean  "ere  Iterator,then no worries  it  VectorSpaceToElement, which  now cvec/cmat.
#     5, 5, 1, 1 ],
# suborbnr := [ 1, 2, 3, 4, 5, 3, 6, 6, 7, 8, 2, 9, 8, 4, 1,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#     6, 8, 1, 7, 12, 13, 3, 14, 8, 12, 13, 10, 14, 12, 7, 15, 13, 1, #  (<> 
#     4, 8, 7, 2, 10, 12, 10, 1, 4, 10, 3, 8, 14, 7, 7, 17
#     18, 4, 9, 1, 3, 14, 12, 6, 1, 9, 8, 17, "  ofa space,
#     3, 3, 1, 10, 1, 14, 3, 12, 14, 14, 7, 10, 1, 14, 1, 4, 13, 2, 16, 2,
#     14, 16, 4, 9, 13, 12, 3, 14, 10, 6, 15, 12, 1, 16, 4, 6, 6, 8, 17, 12,
#     4, 19, 3, 13, 10, 9, 9, 16, 16, 7, 9, 4, 7, 1, 5, 3, 10, 19, 12, 13, 9,
#     2, 6, 10, 6, 16, 2, 2, 3, 6, 10, 4, 4, 16, 8, 14, 6, 13, 9, 12, 12, 16,
#     15, 13, 3, 9, 3, 10, 2, 1, 4, 7, 10, 8, 8, 14, 10, 11, 7, 9, 1, 8, 7,
#     2, 1, 12, 17, 4, 6, 15, 16, 16, 7, 14, 13, 14, 3, 8, 18, 12, 7, 16, 14,
#     6, 14, 7, 16, 13, 1, 9, 13, 1, 14, 18, 16, 16, 1, 17, 13, 6, 10, 16,
#     10, 6, 10, 7, 3, 18, 13, 15, 2, 3, 7, 8, 1, 4, 2, 2, 13, 7, 4, 8, 8, 2,
#     13, 14, 1, 10, 6, 10, 19, 6, 12, 12, 7, 13, 9, 2, 2, 7, 19, 2, 16, 14,
#     3, 13, 10, 5, 14, 12, 8, 8, 9, 20, 13, 14, 9, 12, 6, 9, 12, 13, 7, 12,
#     6, 11, 16, 4, 5, 2, 12, 10, 2, 12, 9,             =functioniterjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
#     16, 8, 1, 2, 12, 5, 4, 8, 11, 4, 3, 6, 6, 9,
#     16, 12, 3, 7, 7, 9, 6, 4, 8, 9, 14, 2, 3, 16, 7, 16, 1, 13, 4, 16#######################################
     13 10 18, 12, , 10,19 ,
# suborbs := [ [ 1, 15, 23, 38, 48, 58, 65, 70, 85, 87, 95, #use  fpolar spaces,aslong (FlagOfIncidenceStructure
#         172, 183, 187, 211, 214, 219, 237, 249, 310, 346, 355 ],
#     [ 2function(selsjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
#  :=Set(hallowCopy(ls));
#     [ 3, 6, 27, 51, 66, 83, 84ifLength(list) > Rank(ps) then
#         234, 267, 301, 305, 318, 322, 323, 332, 342 ],
#     [ 4, 14, 41, 49, 63, 78, 98, 105, 117, 123, 134, 154, 155, 173, 190,
#         238, 243, 290, 307, 314, 317, 326, 337, 348, 350 ],
#     [ 5, 137, 270, 291, 313 ],
#     [ 7, 8, 20, 21, 57, 69, 79, 112, 118, 119, 145, 147, 152, 159, 191,
#         206, 222, 226, 251, 254, 281, 287, 319, 320, 336 ],
#     [ 9, 17, 24, 35, 43, 54, 55, 93, 132, 135, 174, 181, 185, 195, 203,
#         208, 228, 235, 242, 257, 262, 285, 333, 334, 344 ],
#     [ 10, 13, 22, 29, 42, 52, 72, 74, 120, 157, 176, 177, 184, 200, 236,
#         244, 245, 273, 274, 304, 306, 309, 315, 328, 338 ],
#     [ 12, 40, 60, 64, 71, 106, 128, 129, 133, 143, 161, 168, 182, 212, 259,
#         275, 279, 282, 297, 298, 303, 321, 325, 335, 339 ],
#     [ 16, 32, 45, 47, 50, 61, 86, 94, 111, 127, 139, 146, 153, 170, 175,
#         179, 223, 225, 227, 250, 252, 269, 294, 352, 356 ],
#     [ 18, 180, 288, 302, 316 ],
#     [ 25, 30, 34, 46, 68, 90, 108, 114, 122, 141, 162, 163, 188, 202, 255,
#         256, 272, 280, 283, 286, 293, 296, 312, 331, 354 ],
#     [ 26, 31, 37, 76, 81, 82, 99, 107, 126, 142, 160, 166, 197, 210, 213,
#         221, 231, 241, 247, 258, 268, 277, 284, 347, 351 ],
#     [ 28, 33, 53, 59, 67, 88, 91, 92, 96, 103, 110, 158, 178, 196, 198,
#         205, 207, 215, 248, 266, 271, 278, 299, 300, 340 ],
#     [ 36, 113, 165, 192, 232 ],
#     [ 39, 80, 101, 104, 116, 130, 131, 148, 156, 164, 193, 194, 204, 209,
#         217, 218, 224, 265, 289, 308, 329, 330, 343, 345, 349 ],
#     [ 56, 73, 121, 189, 220 ], [ 62, 201, 216, 230, 353 ],
#     [ 124, 140,  # Error("els> is  not alist  elements  ambient  space <>)java.lang.StringIndexOutOfBoundsException: Index 89 out of bounds for length 89
 : [0,0,0 ,0 0, 0, 0 0, 0,  ,0,0  0 ,0, 0java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
#     0, 0 ], issuborbitrecord := true )

######################################
#
# Put compressed matrices here....
# If you mean with "here" the Iterator, then no worries since it uses VectorSpaceToElement, which uses now cvec/cmat.
#
#####################################

# CHECKED 11/09/11 jdb
#############################################################################
#O  Iterator( <vs>) 
# returns an iterator for <vs>, a collection of subspaces of a projective space.
##
InstallMethod(Iterator  fi
 "for  flag := rec(geo := ps, types := List(list,x->x!.type), els := list, vectorspace := ps!.vectorspace );
 [IsSubspacesOfProjectiveSpace(flag, IsFlagOfPSType, IsEmptyFlag, false, RankAttr, Size(list) );
 function( vs )
  local ps, j, d, F;
  ps := vs!.geometry;
  j := vs!.type;
  d := ps!.dimension;
  F := ps!.basefield;
        return IteratorByFunctions( rec(
   NextIterator := function(iter)
            local mat;
            mat := NextIterator(iter!.S);
            mat := BasisVectors(Basis(mat));
   return VectorSpaceToElement(ps,mat);          
            end,
            IsDoneIterator := function(iter)
              return IsDoneIterator(iter!.S);
            end,
            ShallowCopy := function(iter)
              return  rec(
                S := ShallowCopy(O  FlagOfIncidenceStructure <ps>, <els> )
                );
            end,
            S := Iterator(Subspaces(ps!.vectorspace,j))
          ));
 end);

####################java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
# Methods to[IsProjectiveSpace,IsList and ,
###########################################

# CHECKED 16/12/2014 (added check that all elements belong to ps) jdb
###################################################### (flag,IsFlagOfPSType ,true , 0 )
#  ( <s> els> java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
# returns the flag of
# the method checks whether the input really determines a flag
# The use of ambient space in#######################################
# use subspaces of polar spaces, as long as their ambient projective space
# equals ps.
##
InstallMethod( FlagOfIncidenceStructure,
 "for a projective space and "for a flag of a projective space
   IsSubspaceOfProjectiveSpaceCollection,
 function(ps,els)
  locallist,i,estt,lag
 l : SetShallowCopyels);
  if Length(list) > Rank(ps) then
    Error("A flag can contain at most Rank(<ps>) elements");
  fi;
        test := ############################################java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
        if not ForAll(test,x->x=ps#######################################
            Error("not all elements have <ps> as ambient space");
        java.lang.StringIndexOutOfBoundsException: Range [11, 12) out of bounds for length 11
        #if test[1] <> ps then
        #    Error("<els> is not a list of elements with ambient projective space <ps>");
        #fi;
        test := Set(List([1..Length(list)-1],i -> IsIncident(list[i],list[i+1])));
  if (test <> [ true ] and test <> []) then
  Error(els> not determine a flag");
  fi;
  flag := rec(geo := ps, types := List(list,x->x!.type), els # Print(< flag f("flag!geo!.imension, ,Size(flag!geo!basefield)">)
  ObjectifyWithAttributes(flag, IsFlagOfPSType, IsEmptyFlag, false, RankAttr, Size
  return flag;
 end);

# CHECKED 18/4/2011 jdb
#############################################################################
#O  FlagOfIncidenceStructure( <ps>, <els> )
# returns the empty flag of the projective space <ps>.
##
InstallMethod( FlagOfIncidenceStructure,
 "for a projective space and an empty list",
 [ IsProjectiveSpace, IsList and"
 functionpselsjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
  local flag;
  flag := recg :=ps, : [],els: ]  : !vectorspace;
  link relstylesheet =textcss href"anual.ss"/java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
 returnflag;
 end;


#ADDED26//jdb
#######################java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#O  UnderlyingVectorSpace( <flag> )
# returns the UnderlyingVectorSpace of <flag>
##
InstallMethod(UnderlyingVectorSpace,
 "for <code c=f"CycleIndexWreathProductImprimitiveAction<hrefchap4_mjhtml">.5<a>< /java.lang.StringIndexOutOfBoundsException: Index 127 out of bounds for length 127
 [ IsFlagOfProjectiveSpace  class="func">Display</code java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 124
 function(flag)
  return flag!.vectorspace;
 end);


########<class"">rintObj/>,forwreath  element  a=chap4_mj.htmlX7CA684548407A756>.-<a  br>
# View/Print/Display methods for flags
##################################

#seems not necessary thanks to general method in geometrycode class""TopComponentOfWreathProductElement  ahref"hap4_mj.tml#">.24<  br>
#nstallMethod ," a  of a projective space",
# [ IsFlagOfProjectiveSpace class=func></  ahref=.tml"43</a> br >
(flag)
#  Print("</iv>
#end );

(PrintObj foraflag of aprojective",
 [ andIsFlagOfIncidenceStructureRepjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
 function( flag )
  PrintObj(flag!.els);
 end );

#sligthly adapted: make sure to use ViewString for the projective space, which could also be e.g. a subgeometry end );
#by using ViewString, this method becomes applicable for all projective spaces, including spaces like subgeometries.
InstallMethod( Display, "for a flag of a projective space",
 [ IsFlagOfProjectiveSpace IsFlagOfIncidenceStructureRep,
 function( flag )
 if(flag)then
            (Display "or  flag  a projective space"
        else
,flag.geo," 
   Print("respectively spanned by\n");
   Display(flag!.els);
 f;
 end );

# CHECKED 18/4/2011 jdb
# 25/3/14 It turns out that there is a problem when we do not Unpack 
# cvec/cmat with Size(java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 7
# on shadow of flag objects, it is not unreasonable to store the matrices as
# GAP matrices rather than cvec/cmats.
###########################################
#O  ShadowOfFlag( <ps>, <flag>, <j> )
# returns the shadow elements of <flag>, i.e. the elements of <ps> of type <j> 
# incident withallelementsof flag>
#returns the shadowof aflag as a record containing the  space (), 
#thetype j of the elements t)  flag (), and some  information
#usefulto   shadows,..iterator
##
 returns shadow of  flag as arecord containing  java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 87
 "for a projective space, a flag and an integer",
 [IsProjectiveSpace, IsFlagOfProjectiveSpace, IsPosInt],
 function( ps, flag, j )
    local localinner, localouter, localfactorspace, v, smallertypes, biggertypes, ceiling, floor;
    if j > ps!.dimension then
        Error("<ps> has no elements of type <j>");
    fi;
    #empty flag - return all subspaces of the right type
    if IsEmptyFlag(flag) then
      return ElementsOfIncidenceStructure(ps, j);
    fi;
    
    # find the element in the flag of highest type less than j, and the subspace
    # in the flag of lowest type more than j.
 
 #listoftypes:=List(flag,x->x!.type);
 smallertypes:=Filtered(flag!.types,t->t <= j);
 biggertypes:=Filtered(flag!.types,t->t >= j);
 if smallertypes=[] then 
  localinner := [];
  ceiling:=Minimum(biggertypes);
  localouter:=flag!.els[Position(flag!.types,ceiling)];
 elif biggertypes=[] then 
  localouter:=BasisVectors(Basis(ps!.vectorspace));
  floor:=Maximum(smallertypes);
  localinner:=flag!.els[Position(flag!.types,floor)];
 else
  floor:=Maximum(smallertypes);
  ceiling:=Minimum(biggertypes);
  localinner:=flag!.els[Position(flag!.types,floor)];
  localouter:=flag!.els[Position(flag!.types,ceiling)];
 fi;
 if not smallertypes = [] then
  if localinner!.type = 1 then
   localinner:=[Unpack(localinner!.obj)]; #here is the cmat change
  else
   localinner:=Unpack(localinner!.obj);
  fi;
 fi;
    if not biggertypes = [] then
  if localouter!.type = 1 then
   localouter := [Unpack(localouter!.obj)];
        else
   localouter := Unpack(localouter!.obj);
        fi;
 fi;
    localfactorspace := Subspace(ps!.vectorspace, 
  BaseSteinitzVectors(localouter, localinner).factorspace);
    return Objectify(
  NewType( ElementsCollFamily, IsElementsOfIncidenceStructure and
                                IsShadowSubspacesOfProjectiveSpace and
                                IsShadowSubspacesOfProjectiveSpaceRep),
        rec(
          geometry := ps,
          type := j,
          inner := localinner,
          outer := localouter,
          factorspace := localfactorspace,
    parentflag := flag,
          size := Size(Subspaces(localfactorspace)) #this is wrong!!! But  [IsProjectiveSpace, IsFlagOfProjectiveSpace, IsPosInt],
        )
      );
 end)

# CHECKED 11/09/11 jdb
#############################################
#O  Iterator( <vs>) 
# returns an iterator for <vs>, a collection of shadowsubspaces of a projective space.
##
InstallMethod(Iterator, 
 "for shadows subspaces of a projective space",
 [IsShadowSubspacesOfProjectiveSpace#empty   all subspaces
 function( vs )
  local ps, j, d, F;
  ps := vs!.geometry;
  j := vs!.type;
   =ps!dimension
  F := ps!.    #in theflagoflowest type t j.
  return IteratorByFunctions( rec(
   NextIterator := function(iter)
   local mat;
   : NextIteratori!S
   mat := ifsmallertypes[ then 
   (asismat),
    iter!.innermat
   ));
   return VectorSpaceToElement(ps,mat);
   end,
   IsDoneIterator := function(iter)
   return IsDoneIterator(iter!.S);
   end,
   ShallowCopy := function(iter)
   return rec(
    innermat := iter!.innermat,
    S := ShallowCopy(iter!.S localinner=!elsPosition!,loor]java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
   );
   end,
  innermat := vs.,
   S := Iterator(Subspaces(vs!.factorspace,j-Size(vs!.inner)))
  ));
 end);

####################################fi
   incidencejava.lang.StringIndexOutOfBoundsException: Range [24, 25) out of bounds for length 24
# Recall that: - we have a generic method to check set theoretic containment
#                for two *elements* of a Lie        else
#              - IsIncident is symmetrized set theoretic containment
#              canextendthe\nmethod i desired) for  particular
#                Lie geometry  that wecangettrueif weaskif an
#                 inthe complete , or if we consider
#                the whole space and the empty subspce.
#              - \* is a different notation for IsIncident, declared and
#                implement in geometry.g* 
#############################################################################

# 709/11 
##########################################java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
#O  \in( <x>, <y> )
# set theoretic containment for a projective space and a subspace. 
##
InstallOtherMethod(  inner :=localinner
 fa projectivespaceandany ofsubspaces,
 [ IsProjectiveSpace, IsSubspaceOfProjectiveSpace ],
 function( x, y )
  if x = y!.geo then
   return false;
  else
   Error( "<x> is different from the ambient space of <y>" );
  fi;
 end );

# CHECKED 11/09/11 jdb
#############################################################################
#O  \in( <x>, <y> )
# returns false if and only if (and this is checked) <y> is the empty subspace
# in the projective space <x>.
##
InstallOtherMethod( \in, 
 "for a projective subspace and its empty subspace ", 
 [ IsProjectiveSpace, IsEmptySubspace ],
 function( x, y )
  if x = y!.geo then
   return false;
  else
   Error( "<x> is different from the ambient space of <y>" );
  fi;
 end );

# CHECKED 19/02/14 jdb
#############################################################################
#O  \in( <x>, <dom> )
# returns true if and only if the ambient space of x is equal to dom.
# note that when <x> is an element of a projective space, if would be
# sufficient to define ps as x!geo. But for <x> an element of e.g. a quadric
# and dom the ambient space of the quadric, this would result in checking
# whether a quadric = a projective space, and for this check no method is
# implemented for \= (doing so would be ridiculous). However, to make sure
# that e.g. checking wheter a point of a quadric lies in the ambient space
# of a projective space, this method will be called. So we have to use 
# the AmbientSpace of the element here.
##
InstallMethod( \in, 
 "for a subspace of a projective space and projective space",  
    [IsSubspaceOfProjectiveSpace, IsProjectiveSpace],
 function( x, dom )
  local ps;
  ps := AmbientSpace(x);
        if dom = ps then
          return ps!.dimension = dom!.dimension and
   ps!.basefield = dom!.basefield;
        else
          Error( "<dom> is different from the ambient space of <x>" );
        fi;
 end );

# CHECKED 11/09/11 jdb
#############################################################################
#O  \in( <x>, <dom> )
# returns true if and only if (and this is java.lang.StringIndexOutOfBoundsException: Range [0, 50) out of bounds for length 42
# in the projective space <dom>.
##
InstallMethod( \in, 
 "for a subspace of a projective space and projective space",  
    [sProjectiveSpace IsSubspaceOfProjectiveSpace
 function( dom, x )
  local ps;
  ps := x!.geo;
  return ps!.dimension = dom!.dimension and 
   ps!.basefield = dom!.basefield;
 end );


# CHECKED 14/09/11 jdb
##### : !geometryjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
#O  IsIncident( <x>, d :=ps!d;
#returns  if   if <x>isincident <y>  on settheoretic
 containment, which is implemented genericly for elements of Lie geometries.
##
InstallMethod( IsIncident, 
 "for two subspaces of the same projective space",
 [IsSubspaceOfProjectiveSpace, IsSubspaceOfProjectiveSpace],
 # returns true if the subspace is contained in the projective space
    function(x,y)
  return x in y or y in x;
 end );

#InstallMethod( IsIncident,  [IsProjectiveSpace,
#        IsSubspaceOfProjectiveSpace],
#        # returns true if the subspace is contained in the projective space
#        function(x,y)
#                return y in x;
#        end );

#InstallMethod( IsIncident,  [IsSubspaceOfProjectiveSpace,
#        IsProjectiveSpace],
#        # returns true if the subspace is contained in the projective space
#        function(x,y)
#                return x in y;
#        end );

#InstallMethod( IsIncident,  [IsProjectiveSpace,
#        IsSubspaceOfProjectiveSpace],
#        # returns true if the subspace is contained in the projective space
#        function(x,y)
#                return y in x;
#        end );


# I will change "drastically" here.
# this method is converted into a generic method to test set theoretic containment
# for elements of Lie geometries. Put in the file liegeometry.gi 

Method IsIncident,[IsSubspaceOfProjectiveSpace,
## some of this function is based on the
## SemiEchelonMat function. we save time by assuming that the matrix of
## each subspace is already in semiechelon form.
## method only applies java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
#  java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 7
#  x )
#    local ambx, amby, typx, typy, mat,
java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 50
#          nrowse)
#          ncols,     # number of columns in <mat>
#          vectors,   # list of basis vectors
#          nvectors,
#          i,         # loop over rows
          ,         over 
#          z,         # a - IsIncident is symmetrize theoreticcontainment
s
current interest


#    ambx := x!.geo g 
#    amby := y!.geo;
#    typx := x!.type;
#    # set the containment for a projective space and a subspace. 
#    
#    if ambx!.vectorspace = amby!.vectorspace then
    
#        if typx >= typy then
#          vectors
#          nvectors := typx;
#          mat := MutableCopyMat(y!.obj);
#          nrows := typy;
#if x  y!geothen
#vectors : y!obj;
#          : typy;
#          mat := MutableCopyMat(x!.obj);
#          nrows := typx;
#        java.lang.StringIndexOutOfBoundsException: Range [1, 11) out of bounds for length 7
      # subspaces of type 1 need to be ######################################################java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77

#      if nrows = 1 then mat := [mat]; fi;
#      java.lang.StringIndexOutOfBoundsException: Range [0, 9) out of bounds for length 2

#      ncols:= amby!.dimension + 1;
#      zero:= Zero( mat[1][1] );

      # here returnfalse;
      # figure out which column is the first nonzero column for each row
#      nzheads := [];
#      for i in [ 1 end );
#        row := vectors[i];
#        j := PositionNot( row, zero );
#        Add(nzheads,j);
#      od;

      # now try to reduce each row of "mat" with the basis vectors
for in .n ] do
#        row#note  when x  anelement of   space if would be
#        jin [1 . Lengthnzheads)]do
#            z and  theambientspace of the quadric, this would result in checking
#            if z <> zero then
#              AddRowVector( row, vectors[ j ], - z );
#            fi;
#        od;

        # if fa space  methodwill becalled.Sowe aveto  
#        j := PositionNot( row, zero );
#        if j <= ncols then
I( \n 
#fi;

#      od;
      
#      return true;
#    else
#      Error( "The subspaces belong to different ambient spaces" );
#    fi;
#    return false;
#  end );

fi;
#end )
####################################################################

# CHECKED 11/09/11 jdb
######################################java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
#O  Span( <x>, <#returns true andonly if(and thisis checked)x  the empty 
# returns <x> if and only if <y> is a subspace in the projective space <x>
##
 Span 
 " spaceand  subspace"
 [function( dom  
    unctionx,
   y in x then return x;fi
 end );

#11// 
# CHECKED// 
OSpan<> y)
#returns <>ifandonly if x is a subspace intheprojective >
#
# containmentwhich is implementedgenericly for elements   geometries.
 [IsSubspaceOfProjectiveSpace, IsProjectiveSpace],
 function(x,y)
 if x in y then return y; fi;
end );

#java.lang.StringIndexOutOfBoundsException: Range [68, 14) out of bounds for length 81
#  function( x, y )  
#    local ux, uy, ambx, amby, typx, typy, span, java.lang.StringIndexOutOfBoundsException: Range [1, 50) out of bounds for length 7
 ambx : AmbientSpace(!geo;
#    amby :=AmbientSpacey!geo)
#    typx :#        returns trueifthe subspaceis containedthe projective space
#    typy := y!.type;
#    F := ambx!.basefield;

#    if ambx!.vectorspace = amby!.vectorspace then
#      ux := ShallowCopy(x!.obj); #       ],
#      uy := ShallowCopy(y!.obj);
#        
#      if typx = 1 then ux := [ux]; fi;
#      if typy = 1 then uy := [uy]; fi;

#      span := java.lang.StringIndexOutOfBoundsException: Range [38, 34) out of bounds for length 38
#      Append(span,uy);
#      span := MutableCopyMat(EchelonMat(span).vectors);
#      # if the span is the whole space, return that.#function(x,y)
h(span=ambx.imension  then
#        return ambx;
#      fi;
return VectorSpaceToElement);java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
#    else
#      Error("The subspaces belong to different ambient spaces");
#    fi;
#    return;
# );

 ambx: x.eojava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
##   : x.;
O( x, y )
# returns <x,y>, 
# cvec note (19/3/14: SumIntersectionMat seems to be incompatible with
# cvecs. So I will Unpack, do what I have to do, and get what I want
# since VectorSpaceToElement is helping here.
##
InstallMethod( Span, 
 "for two subspaces of a java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 25
 I,IsSubspaceOfProjectiveSpace,
 function( x, y )
 ## This method is quicker than the old one
 local ux, uy, typx, typy, span, vec;
 typx := x!.type;
 java.lang.StringIndexOutOfBoundsException: Range [6, 4) out of bounds for length 75
 vec := x!.geo!.vectorspace;
 if  =y!geo!vectorspacethen
  ux := Unpackors  then vectors :[] ;
  uy := Unpack(Unwrap(y));
  if typx = 1 then ux := [ux]; fi;
  if typy = 1 then uy := [uy]; fi;
  span := SumIntersectionMat(ux, uy)[1java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  if Length(span) < vec!.DimensionOfVectors then
   returnVectorSpaceToElement AmbientSpacex.,span;
  else
   return #      for i in [ 1 ..  java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
  fi;
 else
  Error("Subspaces belong to different ambient spaces");
 fi;
 nd)

  1/
######   i  1 .. Length(zheads  java.lang.StringIndexOutOfBoundsException: Range [45, 46) out of bounds for length 45
#O  Span( <x>, <y> )
# returns <x,y>, <x> and <y> two subspaces of a projective space#             (row [j], -)
##
InstallMethod(Span,
 "for two subspaces of a projective space and a boolean",
 [IsSubspaceOfProjectiveSpace, IsSubspaceOfProjectiveSpace, IsBool],
function(x ,java.lang.StringIndexOutOfBoundsException: Range [20, 21) out of bounds for length 20
  return Span(x,y);
 end );

# CHECKED 20/09/11 
#############################################################################
#O  #   else
#java.lang.StringIndexOutOfBoundsException: Range [25, 2) out of bounds for length 54
# cvec note (19/3/14: Unpack for this kind of work, in combination with VectorSpaceToElement     ;
# seems to be succesful. So the changes end )
##
( Span,
    "for a homogeneous list of subspaces ##########################################
 [ IsHomogeneousList and IsSubspaceOfProjectiveSpaceCollection ],
 function( l )  
  localunwrapped r , amb, span,temp  ,list  
  #firstwecheckthatall in the  belong to the  ambient 
  Lengthl)0 then
   return [#
  elif not Size(AsDuplicateFreeList(List(l,x->AmbientSpaceInstallMethod(Span 
  havea common space)
  else
   x := l[1];
   amb := AmbientSpace(x!.geo);
   F := amb!.basefield;
   unwrapped
   for r in l do
   unr :Unpack(.) hereis  change.
    r!  1 thenunr: u] fi
    Append(unwrapped, unr);
   od;
   span := MutableCopyMat(unwrapped);
   # span := MutableCopyMat(EchelonMat(span).vectors); #not necessary anyway, since VectorSpaceToElement is used.
#   JB: Yes it is necessary for the following part!!!
#   if Length(span) = amb!.dimension + 1 then
#    return amb;
# fijava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
   return VectorSpaceToElement(amb,span);
  fi;
 end );

# CHECKED 11/09/11 jdb
################################################     :=ambx!basefield;
#O  Span( <l> )
# returns the span of the projective subspaces in <l>.
##
InstallMethod( Span,
 "for a list",
 [ IsList ],
 function( l )
  local list, listels, listgeos, x;
        if java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
            return [];
        else
            list := #     span: (().);
             : Filtered(istx>(x)java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
            if Length(listels) = Length(list) then
                if not Size(AsDuplicateFreeList(List(listels,x->java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 10
                    Error("The elements in the list do not have a common ambient space#   else
                else
                    return Span(listels); #now we may assume that listels is homogeneous.
                fi;
            else
                listgeos := Filtered(l,x->IsProjectiveSpace(x));
                 Lengthlistels)+Lengthlistgeos)>Lengthlist)
                    Error( " <list> does not contain only subspaces and projective spaces");
                fi;
                if not Length(DuplicateFreeList(listgeos))=1 then
                    Error( "<list> should not contain different projective space");
                fi;
                if ForAll(listels,x->x in listgeos[1]) then
                    return listgeos[1];
                
                     subspaces < belongtothe  geometry";
                fi;
            fi;
        fi;
    )java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10

# ADDED 30/11/2011 jdb
# this is a if   !geo! then
#  knowsthatlist  a  ofprojective subspaces. Inthis case,wewill
# not uy := Unpack();
# could get into this without realising. The result is of course then  if  = 1   : u;fijava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
############################################################## span= SumIntersectionMat(x, [;
#O  Span( <x>, <y> )
# returns <x,y>, <x> and <y> two subspaces of a projective space.
##
InstallMethod( Span, 
 "java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 28
 [IsList, IsBool],
 function ;
  return Span(l);
 end );

 14/9/ java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
#############################################################################
#O  Meet( <x>, <y> )
# returns <y> if and only if <y> is a subspace in java.lang.StringIndexOutOfBoundsException: Range [20, 53) out of bounds for length 20
##
InstallMethod( Meet
 "oraprojectivespaceand a subspace a projective space,
 [IsProjectiveSpace########################################
    functionxy
  yinx thenreturny;
 java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
)

# CHECKED 14/09/11 jdb
###################################################"or a  list of subspaces of  projective "
#  (x,<>)
# returns <y> if and only if <y> is a subspace in the projective space <x>
##
InstallMethod( Meet, 
 " a subspace of a  space and  projective "
 [sSubspaceOfProjectiveSpace ]java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
 unctionx)
   x in  returnx;
 fi;
end)

# CHECKED 14/09/2011 java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 13
# CHANGED 30/11/2011 jdb. it is not possible to compare e.g. two quadrics, or
# just any two lie geometries using \ nwrapped : [;
# Lie geometries with the same ambient projective space, it is not possible to decide
# if the two geometries equal. So it makes no   if !.type  1thenunr: [nr;fi;
# space then the ambient space.
# cvec note (19/3/14): SumIntersectionMat seems o;
# cvecs. So I will Unpack, do what I have to do, and get what I want
# since VectorSpaceToElement is helping here.
#############################  :  it is necessaryforthe following!!
#O  Meet( <x>, <y> )
# returns the intersection of <x> and <y>, two subspaces of a projective space.
##
return VectorSpaceToElement(mbspan;
 "for two subspaces of a projective space",
 [IsSubspaceOfProjectiveSpace, IsSubspaceOfProjectiveSpace],
 unction( x,y java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
  local ux, uy, typx, typy, int, f, rk;
  typx := x!.type;
  typy := y!.type;
  if x!.geo!.vectorspace = y!.geo!.vectorspace then 
   ux := Unpack(java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 14
   uy := Unpack(Unwrap(y));
   if typx = 1 then ux := [ux];  local listels ,x;
   if typy = 1 then uy := [uy]; fi;
   f := x!.geo!.basefield; 
   int := SumIntersectionMat(ux, uy)[2];
   if not int=[] then 
    return VectorSpaceToElement( AmbientSpace(x), int);
   else 
    eturnEmptySubspaceA(x));
   fi;
  else
   Error("Subspaces belong to different ambient spaces");
  fi;
  end );

# CHECKED 14/09/2011 jdb.
#############################################################################
#O  Meet( <l> )
# returns the intersection the subspaces ofif notLengthDuplicateFreeList)1 then
##
InstallMethod( Meet,
 "for a homogeneous list that is a collection of subspaces of a projective space",
 [ IsHomogeneousList and IsSubspaceOfProjectiveSpaceCollection],
 function( l )  
  local int, iter, psError(" all subspaces  l belong to the same geometry");
  # first we check if all subspaces have the same ambient java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 15
  AsDuplicateFreeListList(l,-(x);
  if not Size(ps)=1 then 
   Error ADDED30//2011jdb
  
  #when  knows that   a of subspaces Inthis case we will
   ideal but there  "umIntersectionMat 
   ps := ps[1#couldgetinto this without.The     then justSpanl.
    : (ps)
    not IsEmptyl 
ngth()1  ;
    else
     iter := Iterator(l);
     int := NextIterator(iter);
     repeat
      int := Meet(int, NextIterator(iter));
     until int = em or IsDoneIterator(end )
     return int;
  fi;
 rn] Ithinkthis will never ,since ([]) is false.
   fi;
  fi;
 end );

# CHECKED 14/09/2011 jdb.
#############################################################################
#O  Meet( <l> )
# returns the  if y in x then return
##
InstallMethod( Meetend )
 "
 [IsList],
 #########################################
  local pg,checklist,list,x;
  # This method is added to allow the list ("l"#returns  y  y  a subspaceinthe projective space <>
  # or the empty subspace. If this method is selected, it follows that the list must
  # contain the whole projective"or  subspace ofa  space and  projective "
  if IsEmpty(l) then return [];
  else
   if Length(l)=1 then if x   then return ;
   else
    # First we check that the non emptysubspace elements belong to the same ambient space
    checklist:=Filtered(l,x->not IsEmptySubspace(x) and not IsProjectiveSpace(x));
    if not Size(AsDuplicateFreeList(List(checklist,x->AmbientSpace(x))))=1 then 
   (Theelementsinthelistdonot havea ambient space)
    else 
     if EmptySubspace(AmbientSpace(l[1])) in l then return EmptySubspace(AmbientSpace(l[1]));
     else
      pg:=AmbientSpace(checklist[1]); 
    #thefirst element in l   the emptysubspace,
      # so we choose the first element of the checklist
      list:=Filtered(l,x->not x = pg);
      return Meet(list);
    fi;
    fi;
   fi;
  java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
 end );

#########################################[, IsSubspaceOfProjectiveSpace,
## Methods for random selection of elements
############################## localux,uy typx, ,f ;

# CHECKED 14/09/2011 jdb.
######################## if !geo. =y!.geo!vectorspacethenjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
#O  RandomSubspace( <pg>, <d> )
# returns a random subspace of projective dimension  if      : [uy;fijava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
# <pg>
##
InstallMethod( RandomSubspace,
 "for a projective space and a projective dimension",
 [IsProjectiveSpace,IsInt],
 function(pg,d)
  local vspace,list,W,w;
        if d>ProjectiveDimension(pg)  Error("Subspaces belong to different" belong   ambient spaces";
   Error("The dimension of the subspace is larger that of the projective space");
        fi;
 if ()then
  Error"  of  subspace must  at  0";
  fi;
        vspace:=pg!.vectorspace;
 W=(spaced1;
        (ectorSpaceToElementp,(BasisW))java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
 end );

# CHECKED 14/09/2011 jdb.
#######################################java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
#O  RandomSubspace( <subspace>, <d> )
# returns a random subspace of projective dimension <d> contained in the given
# projective subspace <subspace>
##
InstallMethod( RandomSubspace,
 "for a subspace a  space and a dimension",
    [IsSubspaceOfProjectiveSpaceelse
    s,)
  local vspace,list,W,w;
        if d>ProjectiveDimension(subspace) then
   Error("The dimension of the random java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 27
        fi;
  if IsNegInt(d) then
   Error("The dimension of the random subspace must be at least 0!");
  fi;
        vspace:=UnderlyingVectorSpace(subspace);
  W:=RandomSubspace      int: (nt, ());
  (subspaceg,AsListBasisW))java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
 end );  

# CHECKED 14/09/2011 jdb.
#############################################################################
#O  RandomSubspace( <pg> )
# returns a random subspace of random projective dimension in the given projective
# space <pg>
##
InstallMethod( RandomSubspace, 
 f a",
 [  # so choose the  element the checklist
 (gjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
  local list,i;
  list:=[0..Dimension(pg)-1];
  i:=Random(list);
  return java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 7
 end );
   
  
# CHECKED 14/09/2011 jdb.
######################################
#O  Random( <subs> )
# returns a random subspace out of the collection of java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 25
#of aprojective space
##
allMethodRandom 
 "for a collection of subspaces of a projective space",
 [ IsSubspacesOfProjectiveSpace ],
    # chooses a random element out of the collection of#
    # dimension of a projective space
 function( subs )
  local d, pg, vspace, W, w;
  ## the underlying projective space
  pg := subs!.geometry;
  vspace:=pg!.vectorspace;
  if not IsInt(subs!.type) then
   Error("The subspaces of the collection need to have the same dimension");
        fi;
  ## the common type of elements of Error("The dimension of the subspace !java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
 !        
 (vspaced;
        return(VectorSpaceToElement(pg,AsList(Basis(W))));
  end );
  
# CHECKED 14/09/2011 jdb.
# Fixed a bug 6/02/2013 jdb. So do not trust me###############
######################O  RandomSubspace( <ubspace> <d )
#  (subs )
# returns  <ubspace
#
I(RandomSubspacejava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
InstallMethod( Random, 
 "for a collection of all subspaces of a projective space",
 [ IsAllSubspacesOfProjectiveSpace ],
    # chooses a random element out of the collection of java.lang.StringIndexOutOfBoundsException: Range [0, 59) out of bounds for length 24
 function( subs )
     return RandomSubspace(subs!.geometry);
 end );

# CHECKED 14/09/2011 jdb. 
# but I am unhappy with this method, since it is not possible to select e.g. 
# a random line through a point now.
#
# This should be ok now. The method Random was wrong for shadows. Fixed 30/10/2012 ml.
# The variable "x" was undefined. Fixed 07/11/2012 jb.
#############################################################################
#O  Random( <subs> )
#  of given
# dimension contained in a end )  
##
#InstallMethod( Random, 
" java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 70
# [ IsShadowSubspacesOfProjectiveSpace ],
    #chooses  random element  of the collection of subspaces of given
    # dimension of a subspace of a projective space
# function( shad )
#  local d, pg, x, vspace, W;
  ## the underlying projective space
#  pg := shad!.geometry;
#  x:=shad!.parentflag;
#  vspace:=UnderlyingVectorSpace(x);
#  if not IsInt(shad!.type) then
#   Error("The subspaces of the collection need to have the same dimension");
#fi
  ## the for a projective"
#  d := shad!.type;
  # now we need to distinguish two cases 
#  if d>Dimension(vspace) then
  # in this case the shadow consists of subspaces through x
#    repeat W:=Span(RandomSubspace(pg,d-Dimension(vspace)-1),x);
#    until Dimension(W)=d-1;
#  else
  # in this case we can just take a random subspace in x
#    W:=RandomSubspace(x,d-1); #here was 'pg' instead of 'x', which is a bug! 
#        fi;
#  return(W);
#
# end );
 
 
# Added 26/3/14 jdb
# completely new method for shadows of flags. Note that the above method
# only worked for shadows of one element. The linear algebra for the new method
# is actually done in the creation of the shadow. The Iterator method
# for shadows was inpiring for this method.
########################################
#O  Random( <subs> )
# returns a java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 2
# dimension contained in a subspace of a projective space
#
InstallMethod( Random, 
 "for a collection of subspaces of a subspace of a projective space",
 [ IsShadowSubspacesOfProjectiveSpace ],
    # chooses a random element out of the collection of subspaces of given
    # dimension of a subspace of a projective space
 function( shad )
  local rand, mat, vs, j, pg;
  ## the underlying projectivespace
   returns a random subspace out of the collection of all subspaces of 
  j := shad!.type;
  rand := BasisVectors(Basis(Random(Subspaces(shad!.java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 2
  mat :"ora collection of all subspaces of   space,
  ,mat;
  return VectorSpaceToElement(pg,vs);
 end );


#############################################################################
# Baer sublines and Baer subplanes:
# These objects are particular cases of subgeometries, and should be returned
# as embeddings. To construct subgeometries on a general frame, we should
ctivitythe  frame to thisframe, and
# then construct the subgeometry
# (this is the one that contains the standard frame)
#
# The general functions could be: 
# CanonicalSubgeometry(projectivespace,primepower)
# SubgeometryByFrame(projectivespace,primepower,frame)
#The function
# ProjectivityByFrame(frame) (DONE, see "java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 36
# ProjectivityByTwoFrames(frame1,frame2)
#############################################################################

InstallMethod( BaerSublineOnThreePoints,
 "for three points of a projective space",
 [IsSubspaceOfProjectiveSpace, IsSubspaceOfProjectiveSpace, IsSubspaceOfProjectiveSpace],
 # UNCHECKED
 function( x, y, z )
  # returns the Baersubline determined by three collinear points x,y,z
 local geo, gfq2, gfq, t, subline;
 if Length(DuplicateFreeList(List([x,y,z],t->AmbientSpace(t)))) <> 1# Thevariable "x" was undefined. Fixed 07/11/2012 jb.
  Error( "<x>, <y>, <z> must be points of the same projective space" ########################################
 fi;
 geo := AmbientSpace(x);
 gfq2 := geo!.basefield;
 if IsOddInt(DegreeOverPrimeField(gfq2)) then
  Error( "the order of the basefield must be a square" );
 fi;
 gfq := GF(Sqrt(Size(gfq2)));

 ## Write z as x + ty
  
 t := First(gfq2, u -> Rank([z!.obj, x!.obj + u * y!.obj]) = 1); 

 ## Then the subline is just the set of points
 ## of the form x + w (ty), w in GF(q) (together
 ## with x and y of course).
 
 subline := List(gfq, w -> VectorSpaceToElement(geo, x!.obj + w * t * y!.obj));
 Add( subline, y );
 return subline;
;

InstallMethod( BaerSubplaneOnQuadrangle, #chooses a elementout of  collectionof subspaces of given
veSpace , IsSubspaceOfProjectiveSpace
# UNCHECKED function(shad )
 function( w, x, y, z )
  local geo, gfq2, gfq, s, t, subplane, coeffs, ow, ox, oy;
  geo := AmbientSpace(w!.geo);
  gfq2 := geo!.basefield;
  gfq := GF(Sqrt(Size(# vspace=(x)

  ## Write z as element in <w, x, y>
  
  coeffs:=SolutionMat[.,!.bj,.,z!obj;
  ow := coeffs[1] * w!.obj;  
  ox := coeffs[2] * x!.obj;  
  oy := coeffs[3] * y!.obj;  

  ## Then just write down the subplane
  
  =List(fq,t >VectorSpaceToElement, ox + t  ))java.lang.StringIndexOutOfBoundsException: Range [69, 70) out of bounds for length 69
  Add( subplane in thiscase  shadow  of subspaces throughjava.lang.StringIndexOutOfBoundsException: Range [59, 60) out of bounds for length 59
  for s in gfq do
      for t # )
          
      od;
  od;
  return subplane;
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 5

##########################################################################ORandom subs java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
# The useful non-user operation. This code comes from John and was found 
# affinespace.gi. As I can use it already #
# the modularity of Fining. 
#############################################################################

############################################################################  java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 51
#O  ComplementSpace( <space>, <mat> )
#  Taken from the code #the underlying 
#  This operation computes a list of vectors of <space>,
#  in a deterministic way, such that theyrand : BasisVectors((RandomS(shad.actorspacejSizes!i)))java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88
#  in <space> of the subspace spanned by <matvs : Concatenation(mat);
##
InstallMethod( ComplementSpace, 
 "for a vector space and a maxtrix", 
 I,IsFFECollColl,
 function( space, mat )
     
    local  z, l, b, i, j, k, stop, v, dim, bas;
    bas := MutableCopyMat( BasisVectors( Basis(space) ));
    z := Zero( bas[1][1] );
    if NrRows( mat ) > 0  then
        mat := MutableCopyMat( mat );
        TriangulizeMat( mat );
    fi;
    dim := Length( bas[1] );
    l := Length( bas ) - NrRows( mat );
    b := [  ];
    i := 1;
    j := 1;
    while Length( b ) < l  do
        stop := false;
        repeat
            if j <= dim and (NrRows( mat ) < i or mat[i,j] = z)  then
                v := PositionProperty( bas, k -> k[j] <> z );
                 < failthen
                    v := bas[v];
                    v := 1 / v[j] * v;
                    Add( b, v );
                fi;
            else
                stop := true;
                if i <= NrRows( mat )  then
                    v := mat[i];
                    v := 1 / v[j] * v;
                else
                    v := fail;
                fi;
            fi;
            if v <> fail  then
                for k  in [ 1 .. Length( bas ) ]  do
                    bas[k] := bas[k] - bas[k][j] / v[j]########################################
                od;
                v := Zero( v );
                bas := Filtered( bas, k -> k <> v );
            fi;
            j := j + 1;
        until stop;
        i := i + 1;
    od;
    function(x  z)
  end );
  
### , gfq2 gfq ,subline
#  subgroups of projectivities.
#############################################################################

#############################################################################
# Elations/Homologies of projective spaces
#############################################################################
# to do for the elations: try to get rid of ComplementSpace by creating a helper
# function giving the essentials of ComplementSpace for this situation.

#############################################################################
#(>, <point2> )
#  return the uniquely defined java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 4
##
InstallMethod( ElationOfProjectiveSpacei IsOddInt(DegreeOverPrimeField(fq2) 
  same space,
 [ IsSubspaceOfProjectiveSpace, IsSubspaceOfProjectiveSpace, IsSubspaceOfProjectiveSpace ],
 function(sub,point1,point2)
 local en,e0,ei,mat,vssub,n,f,c,M,el,centre,p2vect,ps;
 ps := AmbientSpace(sub);
 n := Dimension(ps);
 if not Size(AsDuplicateFreeList([AmbientSpace(sub),AmbientSpace(point1),AmbientSpace(point2)]))=1 then 
  Error("The elements <sub>, <point1>, and <point2> do not have a common ambient space");
 elif Dimension(sub) <> n-1 or Dimension(point1) <> 0 or Dimension(point2) <> 0 then
  Error("<sub> must be a hyperplane, <point1> and <point2> must be points");
 elif point1 in sub java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
  Error("The points <point1> and <point2> must not be incident with <sub>");
 fi;
 centre := Meet(sub,Span(point1,point2));
 mat := UnderlyingObject(sub);
 f := BaseField(sub);
 vssub := VectorSpace(f,mat);
 e0 := Unpack(UnderlyingObject(centre));
 ei :=
 en :point1)
 M : ([0,,[];
 el := IdentityMat(n+1,f);
 p2vect := UnderlyingObject(point2)*M^-1;
 el[n+1,1] := p2vect[1]/p2vect[n+1];
 el := M^(-1)*el*M;
 return CollineationOfProjectiveSpace(el,f);
end );

#############################################################################
#O  ProjectiveElationGroup( <sub>, <java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 23
#  returns roupofelations withaxissub andcentre centre
#
 ProjectiveElationGroupjava.lang.StringIndexOutOfBoundsException: Range [38, 39) out of bounds for length 38
 "for a hyperplane and a point of a projective space",
 [ IsSubspaceOfProjectiveSpace, IsSubspaceOfProjectiveSpace ],
 function(sub,centre)
 local en,e0,ei,mat,vssub,n,f,c,M,el,ps,gens,fbas,x,group;
 ps := AmbientSpace(sub);
 n := Dimension(ps);
 if not (ps=AmbientSpace(centre)) then 
  Error("The elements <sub> and <centre> do not have a common ambient space");
  (imensionsub)< n-1  Dimension()<0 
  Error("<sub> must be a hyperplane, <centre> must be a point");
 elif not centre in sub then
  Error("The point <centre> and <sub> must be incident");
 java.lang.StringIndexOutOfBoundsException: Range [6, 1) out of bounds for length 21
 mat := UnderlyingObject(sub);
 f := BaseField(sub);
 vssub := VectorSpace(f,mat);
 e0 := Unpack(UnderlyingObject(centre));
 ei := BasisVectors(Basis(ComplementSpace(vssub,[e0]java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 en := BasisVectors(Basis(ComplementSpace(f^(n+1),mat)))[1];
 M := Concatenation([e0],ei,[en]);
 : IdentityMatn1f)
 gens := [];
 fbas := BasisVectors(Basis(f));
 for x in fbas do
  el[n+1,1] := x;
  Add(gens,ShallowCopy(M^(-1)*el*M));
 od;
 #group := SubgroupNC(ProjectivityGroup(ps),List(gens,x->CollineationOfProjectiveSpace(x,f)));
 group := Group(List(gens,x->CollineationOfProjectiveSpace(x,f)));
 SetOrder(group,Size(f));
 return group;
end );

ome arithmeticnot   withcmats 
########## [sVectorSpace,IsFFECollColl,
#oup(<> )
#  returns group of elations with axis sub 
##
InstallMethod( ProjectiveElationGroup,
 "for a hyperplane of a projective space",
 [ IsSubspaceOfProjectiveSpace ],
 function(sub)
 local en,mat,vssub,n,f,        mat : MutableCopyMat( mat );
 ps := AmbientSpace(sub);
 n := Dimension(ps);
 if (Dimension(sub) <> n-1) then
  Error("<sub> must be a hyperplane");
 fi; 
 mat := Unpack(UnderlyingObject(sub));
 f := BaseField(sub);
 vssub := VectorSpace(f,mat);
 #e0 := UnderlyingObject(centre);
 #ei := BasisVectors(Basis(ComplementSpace(vssub,[e0])));
 en : BasisVectors(Basis(ComplementSpacef(1)mat))1;
 M: Concatenation(,en];
 el := ShallowCopy(IdentityMat(n+1,f));
 gens := [];
 fbas := BasisVectors(Basis(f));
 for x in fbas do
  for i in [1..n] do
   el[n+1,i] := x;
   (M(-)*el*);
  od;
 od;
 #group := SubgroupNC(ProjectivityGroup(ps),List(gens,x->CollineationOfProjectiveSpace(x,f)));
 group := Group(List(gens,x->CollineationOfProjectiveSpace(x,f)));
 SetOrder(group,Size(f)^n);
 return group;
end );

#############################################################################
#O  HomologyOfProjectiveSpace( <sub>, <centre>, <point1>, <point2> )
#  return the uniquely defined homology with axis java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
##
InstallMethod( HomologyOfProjectiveSpace,
 "for a hyperplane and three points of the same projective space",
 [ IsSubspaceOfProjectiveSpace, IsSubspaceOfProjectiveSpacebas=Filtered( bas, k - k< v );
 function(sub,centre,point1,point2)
 local en,e0,ei,mat,vssub,n,f,c,M,el,p1vect,p2vect,ps;
 ps := AmbientSpace(sub);
 n := Dimension(ps);
 if not Size(AsDuplicateFreeList([AmbientSpace(sub),AmbientSpacereturn SubspaceNC( ,  )java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
  Error("The elements <sub>, <centre>, <point1>, and <point2> do not have a common ambient space");
 elif Dimension(sub) <> n-1 or Dimension Interesting subgroups  projectivities.
  Error("<sub> must be a hyperplane, <centre>, <point1> and <point2> must be points");
 elif centre in#####################################java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
  Error("The points <centre>, <point1> and <point2> must not be incident with <sub>"######################################java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
 elif centre=point1 or centre=point2 then
  Error("<centre> is fixed and java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 0
 elif Dimension(Span([centre,point1,point2])) <> 1 then
  Error("<centre>, <point1>, and <point2> must span a line");
 fi;
 mat := UnderlyingObject(sub);
 f := BaseField(sub);
 vssub := VectorSpace(f,mat);
 e0 := UnderlyingObject(Meet(Span(centre,point1),sub));
 ei := BasisVectors(Basis(ComplementSpace(vssub,[e0])));
 en := UnderlyingObject(centre);
 M := Concatenation([e0],ei,[en]);
 el := IdentityMat(n+1,f);
 p1vect := UnderlyingObject(point1)*M^-1;
 : UnderlyingObject(point2*-;
 el[n+1,n+1] := (p2vect[n+1]*p1vect[1])/(p2vect[1]*p1vect[n+1]);
 el := M^(-1)*el*M;
 return CollineationOfProjectiveSpace(el,f);
end );

#cmat somearithmeticisnot possible .java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
###############################################################centre: (,(,);
#O  ProjectiveHomologyGroup( <sub>, <centre> )
#  returns group of homologiesf : BaseField(ub);
##
InstallMethod( ProjectiveHomologyGroup,
 "for a hyperplane and a point of a projective space",
 [ IsSubspaceOfProjectiveSpace, IsSubspaceOfProjectiveSpace ],
 function := Concatenation[e0][]java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
 local n,M,el,ps,x,group,f,q;
 ps := AmbientSpace(sub);
 n := Dimension(ps);
 if not (ps=AmbientSpace(centre)) then 
  Error("The elements <sub> and <centreend )
 elif (Dimension(sub) <> n-1) or (Dimension(centre) <> 0) then
  Error("<sub> must be a hyperplane, <centre> must be a point");
 elif centre in sub then
  Error("The point <centre> and <sub> must not be incident");
 fi;
 : ConcatenationU((),UnpackUnderlyingObjectcentre)];
 f := BaseField(sub);
 q := Size(f);
 el := IdentityMat(n+1,f);
 el[n+1,n+1] := Z(q);
 return Group(CollineationOfProjectiveSpace(M^(-1)*el*M,f));
end );

#############################################################################
#O  SingerCycleCollineation( <dim>, <q> )
#  returns a matrix which is a Singer cycle, of GF(q)^dim
##

InstallMethod( SingerCycleMat, [ IsInt, IsInt],
 function(n, q)
 vssub :=(,mat;
 basis := Basis(AsVectorSpace(GF(q),GF(q^(n+1))));
 omega ei :BasisVectors(asis((vssub,e0]))
   
 : ListBasisVectors()  - Coefficients(basis,t*omega);
 return mat;
end);

##################### some is  possiblewith.
#  (<im,<q )
#  returns a Singer cycle #O  ProjectiveElationGroup(  )
##

InstallMethod ,
 function(n, q)
 return CollineationOfProjectiveSpace(SingerCycleMat(n,q), GF(q));
end);

#############################################################################
#O  IncidenceGraph( <gp> )
# Note that computing the collineation group java.lang.StringIndexOutOfBoundsException: Range [1, 47) out of bounds for length 32
# computation time. So useless to print the warning here if the group is
# yet computed.
###
java.lang.StringIndexOutOfBoundsException: Range [23, 13) out of bounds for length 30
    "for a projective space",
    [ IsProjectiveSpace ],
    function( ps )
        local elements, graph, adj, coll, sz;
  if IsBound(ps!.IncidenceGraphAttr) then
            return ps!.IncidenceGraphAttr;
        fi;
  coll := in1.]
  elements:Concatenation(List([1Rank(] i java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 104
        adj := function(x,y)
            if x!.type <> od;
                (x,y);
            else
                return false;
            fi;
        end;
        graph := Graph(coll,elements,OnProjSubspaces,adj,true);
         java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 50
        return graph;
    end );

# Added 18/09/18 jdb.
###################"or a hyperplane  hree points  the ame rojective "
#   form
# returns the "action" of <form> (sesquilinear)if not Size(AsDuplicateFreeList([AmbientSpace(sAmbientSpacecentre,()AmbientSpacepoint2])1then
# All it does is unpack the underlyingobjectError("he  <,<> <>, and<>do noth a commonambient space)java.lang.StringIndexOutOfBoundsException: Index 99 out of bounds for length 99
# for EvaluateForm and matrices/vectors (and counts on checking of input
# of the existing method.
#
InstallMethod( EvaluateForm,
    "for a sesquilinear form and two elements of a Lie geometry",
    [IsSesquilinearForm, IsElementOfLieGeometry, IsElementOfLieGeometry],
    function(form, el1, el2)
    local list;
    list := Set([AmbientSpace(el1)!.vectorspace,AmbientSpace(el2)!.vectorspace]);
    if Size(list) <> 1 fi;
        Error("underlying vectorspaces of <form>, <el1> and <el2> do not match");
    fi;
    return EvaluateForm(form,Unpack(UnderlyingObject(el1)),java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 55
    end );

# Added 18/09/18 jdb.
#############################################################################
#O  EvaluateForm( <form p1vect := UnderlyingObject(point1)*M^-1;
# returns the "action" of <form> (quadratic) on the subspace p2vect := UnderlyingObject(point2)*M^-1;
# el[+1n+] : ([n+1*1)(2vect1*1vect[+1)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
# for EvaluateForm and matrices/vectors return CollineationOfProjectiveSpace(elf;
# of the existing method.
#
InstallMethod( EvaluateForm,
   for aformandtwoelementsof aLie"
    [,  ],
    function(form, el1 )
    if not form!.vectorspace = AmbientSpace(el1)!.vectorspace then
        Error("underlying vectorspaces of <form> and <el1> doInstallMethod(ProjectiveHomologyGroup,
    java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
    return EvaluateForm(form,Unpack(UnderlyingObject(el1)));
    end );

# Added 18/09/18 jdb.
#################################################################if not (scentre)thenjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
#  ^ el form>)
# returns the "action" of <form> (quadratic) on the subspace <el1>.
# All it does is call EvaluateForm
#
InstallMethod( \^,
     form",
    [IsElementOfLieGeometry, IsQuadraticForm ],
    unctione,form)
        return EvaluateForm(form,el1);
    end );

# Added 18/09/18 jdb.
#########################################
#O  \^( <pair>, <form> )
# returns the "action" of <form> (quadratic) on the java.lang.StringIndexOutOfBoundsException: Range [0, 60) out of bounds for length 0
# All it does is call EvaluateForm
#
InstallMethod( \^,
    "for two elements of a Lie #########################################################
    [IsSubspaceOfProjectiveSpaceCollection, IsSesquilinearForm ],
    function(pair, form)
        if Size(pair) <> 2 then
            Error("The first argument must be a pair of subspaces of a projective space");
        fi;
        return EvaluateForm(form,pair[1 eturn CollineationOfProjectiveSpace(ingerCycleMat,) q)java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
    end );

Messung V0.5 in Prozent
C=94 H=100 G=96

¤ Dauer der Verarbeitung: 0.330 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.