Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/wpe/dev/timings/centraliser/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 21.9.2024 mit Größe 1 kB image not shown  

Quelle  initRandomElements.py   Sprache: Python

 
#!/usr/bin/env python3
from parameters import nrRandomElements, groups, TIMEOUT, MEMORY
import sys
import os
import shutil
from subprocess import Popen, PIPE, STDOUT, TimeoutExpired

https://stackoverflow.com/questions/287871/how-to-print-colored-text-to-the-terminal
class bcolors:
    FAIL = '\033[91m'
    ENDC = '\033[0m'

# optional argument GAP path
GAP = '/bin/gap.sh'
if sys.argv[1:]:
    GAP = sys.argv[1]

#########################
# Clear Directories
#########################
path = 'out_randomElements'
if os.path.exists(path):
    shutil.rmtree(path)
os.mkdir(path)

#########################
# Generate Random Elements
#########################
for i in range(0, len(groups)):
    ID = str(i + 1)
    print ('Generating Random Elements for Group '+ID)
    # Start new GAP session
    proc = Popen([GAP, '-q'], stdin=PIPE, stdout=PIPE, stderr=STDOUT, encoding='utf8')
    # Declare Global Variables
    proc.stdin.write('ID := "'+ID+'";')
    proc.stdin.write('nrRandomElements := '+str(nrRandomElements)+';')
    proc.stdin.write('groups := '+groups[i]+';')
    # Generatate Random Elements
    proc.stdin.write('ReadPackage("WPE","dev/centraliser/genRandomElements.g");')
    # Wait until GAP session finishes or we exceed maximal duration of this session
    try:
        outs, errs = proc.communicate(timeout=TIMEOUT)
    except TimeoutExpired:
        proc.kill()
        print (bcolors.FAIL + 'TimeoutExpired: killed process' + bcolors.ENDC)

Messung V0.5
C=92 H=90 G=90

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.