npn
v1.1
แพ็คเกจนี้เป็นตัวจับคู่บูลีน มันเพียงแค่คำนวณตัวแทนที่เป็นที่ยอมรับซึ่งเป็นเอกลักษณ์สำหรับแต่ละคลาสเทียบเท่า NPN สำหรับฟังก์ชั่นบูลีนที่กำหนดโดยตารางความจริง
แบ็กเอนด์ของแพ็คเกจนี้ถูกนำมาใช้โดย C ++ เพื่อประสิทธิภาพ
ปัจจุบันแพ็คเกจนี้รองรับฟังก์ชั่นบูลีนที่มีจำนวนอินพุต <= 8
pip install npn import npn
# the truth table of f(x_2, x_1, x_0) as [f(0, 0, 0), f(0, 0, 1), f(0, 1, 0), f(0, 1, 1), ...]
tt = [ True , True , True , False , True , True , True , True ]
c = npn . npn_canonical_representative ( tt ) # [True, True, True, True, True, True, True, False]
c_int = npn . tt_to_int ( c ) # 254 (11111110)
c , phase , perm , output_inv = npn . npn_canonical_representative ( tt , return_details = True , refinement = True )return_details เป็น True เพื่อส่งคืนข้อมูลการแปลง NPN ( phase, perm, output_inv ) ตัวอย่างเช่นที่นี่ phase = [False, False, True] , perm = [0, 1, 2] และ output_inv = False (x_0, x_1, x_2) ควรแมปไปที่ (x_0, x_1, x_2) จากนั้นตัวแปรที่สาม ( x_2 ) ควรกลับด้านrefinement ให้เป็น True เพื่อเร่งการคำนวณในขณะที่ทำลายลำดับพจนานุกรมของตารางความจริง ดู "การสร้างเครื่องจับคู่บูลีนที่ดีกว่าและเครื่องตรวจจับสมมาตร" สำหรับรายละเอียด รวบรวมไลบรารีที่ใช้ร่วมกัน libnpn.dll และ libnpn.so ผ่าน cmake บนสภาพแวดล้อม windows และ linux วางไว้ในโฟลเดอร์ npn จากนั้น
python setup.py sdistหากต้องการอัปโหลดไปยัง PYPI ให้เรียกใช้
twine upload . d ist n pn-X.X.tar.gzpip install pytest # if you haven't install it
python -m pytest