Skip to content

Commit fa36da1

Browse files
Merge branch 'pr-258' into devel
* pr-258: Added primitive collections for fans to Convex
2 parents b283b40 + c11f0c6 commit fa36da1

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

Convex/examples/fans.g

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ RaysInMaximalCones( F );
3535
IsRegularFan( F );
3636
IsComplete( F );
3737
IsSmooth( F );
38+
PrimitiveCollections( F );
3839
F1 := MaximalCones( F )[ 1 ];
3940
DualCone( F1 );
4041
RayGenerators( F1 );
4142
F2 := StarSubdivisionOfIthMaximalCone( F, 1 );
42-
IsSmooth( F2 );
43+
IsSmooth( F2 );
44+
PrimitiveCollections( F2 );

Convex/gap/Fan.gd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,19 @@ DeclareAttribute( "MaximalCones",
8484
DeclareAttribute( "FVector",
8585
IsFan );
8686

87+
## <#GAPDoc Label="PrimitiveCollections">
88+
## <ManSection>
89+
## <Attr Arg="fan" Name="PrimitiveCollections"/>
90+
## <Returns>a list of lists</Returns>
91+
## <Description>
92+
## Returns the primitive collections of the fan <A>fan</A> as a list of lists.
93+
## </Description>
94+
## </ManSection>
95+
## <#/GAPDoc>
96+
##
97+
DeclareAttribute( "PrimitiveCollections",
98+
IsFan );
99+
87100
####################################
88101
##
89102
## Properties

Convex/gap/Fan.gi

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,60 @@ InstallMethod( FVector,
334334

335335
end );
336336

337+
##
338+
InstallMethod( PrimitiveCollections,
339+
"for fans",
340+
[ IsFan ],
341+
342+
function( fan )
343+
local rays, max_cones, facets, all_points, d_max, primitive_collections, d, checked, facet,
344+
I_minus_j, scanner, j, I;
345+
346+
# collect data of the fan
347+
rays := RayGenerators( fan );
348+
max_cones := MaximalCones( fan );
349+
facets := List( [ 1 .. Length( max_cones ) ],
350+
i -> List( RayGenerators( max_cones[ i ] ), k -> Position( rays, k ) ) );
351+
all_points := [ 1 .. Length( rays ) ];
352+
d_max := Maximum( List( facets, i -> Length( i ) ) ) + 1;
353+
354+
# identify and return the primitive collections
355+
primitive_collections := [];
356+
for d in [ 1 .. d_max ] do
357+
checked := [];
358+
for facet in facets do
359+
for I_minus_j in Combinations( facet, d ) do
360+
scanner := Difference( all_points, Flat( I_minus_j ) );
361+
for j in scanner do
362+
I := Concatenation( I_minus_j, [ j ] );
363+
364+
if not I in checked then
365+
366+
Add( checked, I );
367+
368+
# (1) I is contained in the primitive collections iff it is not contained in any facet
369+
if ForAll( [ 1 .. Length( facets ) ],
370+
i -> not IsSubsetSet( facets[ i ], I ) ) then
371+
372+
# (2) I is generator of the primitive collections iff
373+
# primitive_collections does not contain a "smaller" generator
374+
if ForAll( [ 1 .. Length( primitive_collections ) ],
375+
i -> not IsSubsetSet( I, primitive_collections[i] ) ) then
376+
377+
# then add this new generator
378+
Append( primitive_collections, [ I ] );
379+
380+
fi;
381+
fi;
382+
fi;
383+
od;
384+
od;
385+
od;
386+
od;
387+
return primitive_collections;
388+
389+
end );
390+
337391
####################################
338392
##
339393
## Properties

0 commit comments

Comments
 (0)