|
8 | 8 | ##
|
9 | 9 | #############################################################################
|
10 | 10 |
|
| 11 | +InstallValue( 4ti2Interface_BINARIES, |
| 12 | + rec( |
| 13 | + required_binaries := [ "groebner", "hilbert", "zsolve", "graver" ], |
| 14 | + ) ); |
| 15 | + |
| 16 | +for name in 4ti2Interface_BINARIES.required_binaries do |
| 17 | + path := Filename( DirectoriesSystemPrograms(), name ); |
| 18 | + if IsStringRep( path ) then |
| 19 | + 4ti2Interface_BINARIES.(name) := path; |
| 20 | + continue; |
| 21 | + fi; |
| 22 | + path := Filename( DirectoriesSystemPrograms(), Concatenation( "4ti2-", name ) ); |
| 23 | + if IsStringRep( path ) then |
| 24 | + 4ti2Interface_BINARIES.(name) := path; |
| 25 | + continue; |
| 26 | + fi; |
| 27 | + ## the AvailabilityTest in the PackageInfo will prevent this error from being raised |
| 28 | + Error( "4ti2 cannot be found on your system\n" ); |
| 29 | +od; |
| 30 | + |
11 | 31 | ##
|
12 | 32 | InstallGlobalFunction( 4ti2Interface_Cut_Vector,
|
13 | 33 |
|
@@ -171,14 +191,8 @@ InstallGlobalFunction( 4ti2Interface_groebner,
|
171 | 191 | 4ti2Interface_Write_Matrix_To_File( arg[ 2 ], Concatenation( filename, ".cost" ) );
|
172 | 192 |
|
173 | 193 | fi;
|
174 |
| - |
175 |
| - if IO_FindExecutable( "groebner" ) <> fail then |
176 |
| - exec := IO_FindExecutable( "groebner" ); |
177 |
| - elif IO_FindExecutable( "4ti2-groebner" ) <> fail then |
178 |
| - exec := IO_FindExecutable( "4ti2-groebner" ); |
179 |
| - else |
180 |
| - Error( "4ti2 can not be found" ); |
181 |
| - fi; |
| 194 | + |
| 195 | + exec := 4ti2Interface_BINARIES.groebner; |
182 | 196 |
|
183 | 197 | precision := ValueOption( "precision" );
|
184 | 198 |
|
@@ -247,14 +261,8 @@ InstallGlobalFunction( 4ti2Interface_hilbert_inequalities,
|
247 | 261 | sign_list := [ List( matrix[ 1 ], i -> 0 ) ];
|
248 | 262 |
|
249 | 263 | 4ti2Interface_Write_Matrix_To_File( sign_list, Concatenation( filename, ".sign" ) );
|
250 |
| - |
251 |
| - if IO_FindExecutable( "hilbert" ) <> fail then |
252 |
| - exec := IO_FindExecutable( "hilbert" ); |
253 |
| - elif IO_FindExecutable( "4ti2-hilbert" ) <> fail then |
254 |
| - exec := IO_FindExecutable( "4ti2-hilbert" ); |
255 |
| - else |
256 |
| - Error( "4ti2 can not be found" ); |
257 |
| - fi; |
| 264 | + |
| 265 | + exec := 4ti2Interface_BINARIES.hilbert; |
258 | 266 |
|
259 | 267 | precision := ValueOption( "precision" );
|
260 | 268 |
|
@@ -303,15 +311,9 @@ InstallGlobalFunction( 4ti2Interface_hilbert_inequalities_in_positive_orthant,
|
303 | 311 | rel_list := [ List( matrix, i -> ">" ) ];
|
304 | 312 |
|
305 | 313 | 4ti2Interface_Write_Matrix_To_File( rel_list, Concatenation( filename, ".rel" ) );
|
306 |
| - |
307 |
| - if IO_FindExecutable( "hilbert" ) <> fail then |
308 |
| - exec := IO_FindExecutable( "hilbert" ); |
309 |
| - elif IO_FindExecutable( "4ti2-hilbert" ) <> fail then |
310 |
| - exec := IO_FindExecutable( "4ti2-hilbert" ); |
311 |
| - else |
312 |
| - Error( "4ti2 can not be found" ); |
313 |
| - fi; |
314 | 314 |
|
| 315 | + exec := 4ti2Interface_BINARIES.hilbert; |
| 316 | + |
315 | 317 | precision := ValueOption( "precision" );
|
316 | 318 |
|
317 | 319 | if IsInt( precision ) then
|
@@ -360,13 +362,7 @@ InstallGlobalFunction( 4ti2Interface_hilbert_equalities_in_positive_orthant,
|
360 | 362 |
|
361 | 363 | 4ti2Interface_Write_Matrix_To_File( rel_list, Concatenation( filename, ".rel" ) );
|
362 | 364 |
|
363 |
| - if IO_FindExecutable( "hilbert" ) <> fail then |
364 |
| - exec := IO_FindExecutable( "hilbert" ); |
365 |
| - elif IO_FindExecutable( "4ti2-hilbert" ) <> fail then |
366 |
| - exec := IO_FindExecutable( "4ti2-hilbert" ); |
367 |
| - else |
368 |
| - Error( "4ti2 can not be found" ); |
369 |
| - fi; |
| 365 | + exec := 4ti2Interface_BINARIES.hilbert; |
370 | 366 |
|
371 | 367 | precision := ValueOption( "precision" );
|
372 | 368 |
|
@@ -422,14 +418,8 @@ InstallGlobalFunction( 4ti2Interface_hilbert_equalities_and_inequalities,
|
422 | 418 | sign_list := [ List( concat_list[ 1 ] , i -> 0 ) ];
|
423 | 419 |
|
424 | 420 | 4ti2Interface_Write_Matrix_To_File( sign_list, Concatenation( filename, ".sign" ) );
|
425 |
| - |
426 |
| - if IO_FindExecutable( "hilbert" ) <> fail then |
427 |
| - exec := IO_FindExecutable( "hilbert" ); |
428 |
| - elif IO_FindExecutable( "4ti2-hilbert" ) <> fail then |
429 |
| - exec := IO_FindExecutable( "4ti2-hilbert" ); |
430 |
| - else |
431 |
| - Error( "4ti2 can not be found" ); |
432 |
| - fi; |
| 421 | + |
| 422 | + exec := 4ti2Interface_BINARIES.hilbert; |
433 | 423 |
|
434 | 424 | precision := ValueOption( "precision" );
|
435 | 425 |
|
@@ -486,13 +476,7 @@ InstallGlobalFunction( 4ti2Interface_hilbert_equalities_and_inequalities_in_posi
|
486 | 476 |
|
487 | 477 | 4ti2Interface_Write_Matrix_To_File( sign_list, Concatenation( filename, ".sign" ) );
|
488 | 478 |
|
489 |
| - if IO_FindExecutable( "hilbert" ) <> fail then |
490 |
| - exec := IO_FindExecutable( "hilbert" ); |
491 |
| - elif IO_FindExecutable( "4ti2-hilbert" ) <> fail then |
492 |
| - exec := IO_FindExecutable( "4ti2-hilbert" ); |
493 |
| - else |
494 |
| - Error( "4ti2 can not be found" ); |
495 |
| - fi; |
| 479 | + exec := 4ti2Interface_BINARIES.hilbert; |
496 | 480 |
|
497 | 481 | precision := ValueOption( "precision" );
|
498 | 482 |
|
@@ -585,14 +569,8 @@ InstallGlobalFunction( 4ti2Interface_zsolve_equalities_and_inequalities,
|
585 | 569 | concat_rhs := [ Concatenation( eqs_rhs, ineqs_rhs ) ];
|
586 | 570 |
|
587 | 571 | 4ti2Interface_Write_Matrix_To_File( concat_rhs, Concatenation( filename, ".rhs" ) );
|
588 |
| - |
589 |
| - if IO_FindExecutable( "zsolve" ) <> fail then |
590 |
| - exec := IO_FindExecutable( "zsolve" ); |
591 |
| - elif IO_FindExecutable( "4ti2-zsolve" ) <> fail then |
592 |
| - exec := IO_FindExecutable( "4ti2-zsolve" ); |
593 |
| - else |
594 |
| - Error( "4ti2 can not be found" ); |
595 |
| - fi; |
| 572 | + |
| 573 | + exec := 4ti2Interface_BINARIES.zsolve; |
596 | 574 |
|
597 | 575 | precision := ValueOption( "precision" );
|
598 | 576 |
|
@@ -708,13 +686,7 @@ InstallGlobalFunction( 4ti2Interface_graver_equalities,
|
708 | 686 |
|
709 | 687 | 4ti2Interface_Write_Matrix_To_File( signs, Concatenation( filename, ".sign" ) );
|
710 | 688 |
|
711 |
| - if IO_FindExecutable( "graver" ) <> fail then |
712 |
| - exec := IO_FindExecutable( "graver" ); |
713 |
| - elif IO_FindExecutable( "4ti2-graver" ) <> fail then |
714 |
| - exec := IO_FindExecutable( "4ti2-graver" ); |
715 |
| - else |
716 |
| - Error( "4ti2 can not be found" ); |
717 |
| - fi; |
| 689 | + exec := 4ti2Interface_BINARIES.graver; |
718 | 690 |
|
719 | 691 | precision := ValueOption( "precision" );
|
720 | 692 |
|
@@ -755,13 +727,7 @@ InstallGlobalFunction( 4ti2Interface_graver_equalities_in_positive_orthant,
|
755 | 727 |
|
756 | 728 | 4ti2Interface_Write_Matrix_To_File( eqs, Concatenation( filename, ".mat" ) );
|
757 | 729 |
|
758 |
| - if IO_FindExecutable( "graver" ) <> fail then |
759 |
| - exec := IO_FindExecutable( "graver" ); |
760 |
| - elif IO_FindExecutable( "4ti2-graver" ) <> fail then |
761 |
| - exec := IO_FindExecutable( "4ti2-graver" ); |
762 |
| - else |
763 |
| - Error( "4ti2 can not be found" ); |
764 |
| - fi; |
| 730 | + exec := 4ti2Interface_BINARIES.graver; |
765 | 731 |
|
766 | 732 | precision := ValueOption( "precision" );
|
767 | 733 |
|
|
0 commit comments