Simple circuit description in python along with an algorithm to reduce the depth of a cicuit.
Clone or download
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 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 The file includes simple circuits. The file includes a sorting network sort in addition to direct sort and its SIMD-optimized counterpart. The file 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.