Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Simple circuit description in python along with an algorithm to reduce the depth of a cicuit.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Type||Name||Latest commit message||Commit time|
|Failed to load latest commit information.|
Simple Circuit Description Framework This code provides support for writing circuits in python that use AND and XOR (or multiplication or additiion in some ring). This is suited to Fully Homomorphic Encryption (FHE). We intend to add bindings for HElib to allow evaluation with an FHE scheme. We include an algorithm to reduce the depth of a circuit. An implementation of the direct sort algorithm from https://eprint.iacr.org/2015/274.pdf is included along with an optimized version that avails of SIMD operations. Currently, the hamming weight algorithm that direct sort relies on only supports vector lengths of 4 and 8 so we can only sort arrays of length 8 in this version. We'll extend the algorithm in due course to support greater vector lengths. The core algorithms are in scdf.py. The file base.py includes simple circuits. The file sort.py includes a sorting network sort in addition to direct sort and its SIMD-optimized counterpart. The file test_sort.py sets up the framework to sort an array of 8 elements using the SIMD-optimized version of direct sort and computes its reduced depth. This should illustrate how to use the framework.