@@ -90,17 +90,8 @@ InstallMethod( IsCompatiblePolyhedronList,
9090 function ( list )
9191 local i;
9292
93- if not ( list[ 1 ] >= 0 and list[ 2 ] >= 0
94- and list[ 3 ] >= 0 and list[ 4 ] >= 0 and list[ 5 ] >= 0 ) then
95- return Error( " The first five entries should be all positive" );
96-
97- fi ;
98-
99- if not ( IsInt( list[ 1 ] ) and IsInt( list[ 2 ] )
100- and IsInt( list[ 3 ] ) and IsInt( list[ 4 ] ) and IsInt( list[ 5 ] ) ) then
101-
102- return Error( " The first five arguments should be integrs" );
103-
93+ if not ForAll( [ 1 ,4 ,5 ] , i -> list[ i] in NonnegativeIntegers) then
94+ return Error( " The first five entries must be non-negative integers" );
10495 fi ;
10596
10697 if not ( IsList( list[ 6 ] ) and IsList( list[ 7 ] ) ) then
@@ -153,24 +144,17 @@ InstallMethod( ListToPoly,
153144
154145 fi ;
155146
156- if Length( list[ 7 ] ) <> 0 then
157-
158- matrix:= list[ 7 ] ;
159-
147+ matrix:= list[ 7 ] ;
148+ if NrRows( matrix ) > 0 then
160149 matrix:= CanonicalizeList( matrix, list[ 1 ] );
161-
162- else
163-
164- matrix := [ ] ;
165-
166150 fi ;
167151
168152 if list[ 1 ] = 2 then
169153
170154 temp2:= GiveGeneratingVerticesAndGeneratingRays( matrix, [ ] )[ 1 ] ;
171155
172156 if temp2= [ List( [ 2 .. list[ 5 ] ] , i -> 0 ) ] and
173- not Length ( matrix ) = 1 then
157+ not NrRows ( matrix ) = 1 then
174158
175159 temp3:= StructuralCopy( matrix );
176160
@@ -184,21 +168,11 @@ InstallMethod( ListToPoly,
184168
185169 Remove( temp3, p );
186170
187- for i in [ 1 .. Length( temp4 ) ] do
188-
189- if i< p then
190-
191- temp4[ i ] := temp4[ i ] ;
192-
193- else
194-
195- temp4[ i ] := temp4[ i ] - 1 ;
196-
197- fi ;
198-
171+ for i in [ p.. Length( temp4 ) ] do
172+ temp4[ i ] := temp4[ i ] - 1 ;
199173 od ;
200174
201- if list[ 3 ] = 0 then
175+ if Length( list[ 6 ] ) = 0 then
202176
203177 return Cdd_PolyhedronByGenerators( temp3 );
204178
@@ -210,7 +184,7 @@ InstallMethod( ListToPoly,
210184
211185 fi ;
212186
213- if list[ 3 ] = 0 then
187+ if Length( list[ 6 ] ) = 0 then
214188
215189 return Cdd_PolyhedronByGenerators( matrix );
216190
@@ -224,15 +198,13 @@ InstallMethod( ListToPoly,
224198
225199 if list[ 4 ] = 0 then
226200
227- L:= [ 1 ] ;
228-
229- Append( L, List( [ 2 .. list[ 5 ] ] , i -> 0 ) );
230-
201+ L := ListWithIdenticalEntries( list[ 5 ] , 0 );
202+ L[ 1 ] := 1 ;
231203 return Cdd_PolyhedronByInequalities( [ L ] );
232204
233205 fi ;
234206
235- if list[ 3 ] = 0 then
207+ if Length( list[ 6 ] ) = 0 then
236208
237209 return Cdd_PolyhedronByInequalities( matrix );
238210
@@ -255,53 +227,24 @@ InstallMethod( PolyToList,
255227 L := [ ] ;
256228
257229 if (poly!. rep_type= " H-rep" ) then
258-
259- Add( L, 1 );
260-
261- else
262-
263- Add( L, 2 ) ;
264-
265- fi ;
266-
267- # the functions in c should be changned so that this can be deleted
268- Add( L, 2 );
269-
270- if Length( poly!. linearity ) = 0 then
271-
272- Add( L, 0 );
273-
230+ L[ 1 ] := 1 ;
274231 else
275-
276- Add( L, 1 );
277-
232+ L[ 1 ] := 2 ;
278233 fi ;
279234
280235 matrix := poly!. matrix;
281236
282237 if poly!. rep_type= " V-rep" and IsZero( matrix ) then
283-
284238 matrix := DuplicateFreeList( matrix );
285-
286- matrix[ 1 ][ 1 ] := 1 ;
287-
239+ matrix[ 1 , 1 ] := 1 ;
288240 fi ;
289241
290- Add( L, Length( matrix ) );
291-
292- Add( L, Length( matrix[ 1 ] ) );
293-
294- lin := poly!. linearity;
295-
296- temp:= [ Length( lin ) ] ;
297-
298- Append( temp, lin );
299-
300- Add( L, ListToString( [ temp ] ) );
301-
302- Add( L, ReplacedString( String( matrix ), " ," , " " ) );
303-
304- Append( L, [ 0 , [ ] ] );
242+ L[ 4 ] := NrRows( matrix );
243+ L[ 5 ] := NrCols( matrix );
244+ L[ 6 ] := poly!. linearity;
245+ L[ 7 ] := matrix;
246+ L[ 8 ] := 0 ;
247+ L[ 9 ] := [ ] ;
305248
306249 return L;
307250
@@ -377,7 +320,7 @@ InstallMethod( LinearProgramToList,
377320
378321 fi ;
379322
380- result[ 9 ] := ListToString( [ lp!. rowvector ] ) ;
323+ result[ 9 ] := lp!. rowvector;
381324
382325 return result;
383326
@@ -505,28 +448,6 @@ function( poly )
505448
506449end );
507450
508- # #
509- InstallGlobalFunction( ListToString,
510- [ IsList ] ,
511- function ( l )
512- local i, j, s;
513-
514- s := " " ;
515-
516- for i in [ 1 .. Length( l ) ] do
517-
518- for j in [ 1 .. Length( l[ 1 ] ) ] do
519-
520- s := Concatenation( [ s, String( l[ i][ j] ), " " ] );
521-
522- od ;
523-
524- od ;
525-
526- return s;
527-
528- end );
529-
530451# #
531452InstallGlobalFunction( CanonicalizeListOfFacesAndInteriorPoints,
532453 function ( L )
0 commit comments