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 매개 phase, perm, output_inv 를 True 로 설정하십시오. 예를 들어, 여기서 phase = [False, False, True] , perm = [0, 1, 2] 및 output_inv = False meve (x_0, x_1, x_2) 는 (x_0, x_1, x_2) 에 매핑되어야하며, 세 번째 변수 ( x_2 )는 반전되어야합니다.refinement 매개 변수를 True 로 설정하십시오. 자세한 내용은 "더 나은 부울 매칭 및 대칭 탐지기 구축"을 참조하십시오. 공유 라이브러리 libnpn.dll 및 libnpn.so Windows 및 Linux 환경에서 CMake를 통해 컴파일 한 다음 npn 폴더에 배치 한 다음 공유하십시오.
python setup.py sdistPYPI에 업로드하려면 실행하십시오
twine upload . d ist n pn-X.X.tar.gzpip install pytest # if you haven't install it
python -m pytest