-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for float and double precision data (#113)
* Initial reformat and templating of gate tests * Redefine gate mappings with templates * Record given state * Move all gate classes to become StateVector methods * Fix compile errors for SV * Refactor gates implementation * Enable vector param methods * Enable label to gatename map * Support dispatch directly from StateVector class * Add apply methods to SV class * Add log2 utility function * Remove old file arch * Ensure bindings build support for float and double sizes complex data * Remove outdated tests for deleted modules * Remove old definition headers * Tidy dispatch map * Replace header with correct type * Ensure cpp17 is now used * Remove unneeded files in compilation * Ensure apply args are given in correct order * Allow make test to be run from working dir without cleaning * Fix cpp formatting * Remove old code and fix codefactor complaints * Add cast to enable wheel build on MacOS * Enable MSVC intrinsics if using Windows * Ensure C++17 as a requirement * Fix compile-time ifdef * Replace intrinsic with BSR * Avoid intrinsics for portability * Rename log2 function * Add support for 64bit and 128 complex numbers from C++ backend * Update bindings to allow class instantiation and method use * Enable support for different precision parameters passed to backend * Fix log2 change * Fix binding names * Remove io from statevector * Refix the log2 -- replace with instrinsics later * Update format and remove ununsed warnings * Refactor the testing infrastructure for templated StateVector implementation (#115) * Add preliminary catch2 support * Move private methods to public for testing * Overload applyOperations for param and non param calls * Add testing support for X,Y,Z,H gates * Add S, T gate tests * Add support for RX,RY,RZ gate tests * Add PhaseShift gate tests * Add Rot tests * Add CNOT tests * Add support for CSWAP, Toffoli, CZ, CRot tests * Update testing CI * Fix CodeFactor complaints * Update CI image before running tests * Favour use of reverse iterator over counter in for loops * Fix contructor tests * Fix formatting * Fix narrowing complaints * Fix MSVC math errors * Run black * Remove unneeded ops for real*complex products * Fix test builder * Ensure cmake has a version to avoid warnings * Fix formatting of SV * Fix test reporting * Remove whitespace for CF complaints * Apply static analyser fixes * Add imaginary utils * Refactor gate implementation and utility definitions * Fix RY gate defn * Add compile-time complex multiplication functions * Use gate definition functions in tests and add constexpr where applicable * Remove outdated test utilities and tests * Update changelog * Port ControlledPhaseShift to new simulator structure * Add ControlledPhaseShift method to bindings * Ensure tests are run using cmake * Rename label CPhaseShift to ControlledPhasedShift
- Loading branch information
Showing
30 changed files
with
2,335 additions
and
2,206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,21 +13,36 @@ jobs: | |
matrix: | ||
os: [ubuntu-20.04] | ||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Install dependencies | ||
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc | ||
|
||
- name: Install Google Test | ||
run: | | ||
wget -qO - https://github.com/google/googletest/archive/release-1.10.0.tar.gz | tar -xz | ||
cmake -D CMAKE_INSTALL_PREFIX:PATH=$HOME/googletest -D CMAKE_BUILD_TYPE=Release googletest-release-1.10.0 | ||
make install | ||
- name: Build and run unit tests | ||
run: | | ||
cd pennylane_lightning/src/tests | ||
GOOGLETEST_DIR=$HOME/googletest make test | ||
cmake . -BBuild -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=1 | ||
cmake --build ./Build | ||
mkdir -p ./Build/tests/results | ||
./Build/tests/runner --order lex --reporter junit --out ./Build/tests/results/report.xml | ||
- name: Upload test results | ||
uses: actions/upload-artifact@v2 | ||
if: always() | ||
with: | ||
name: ubuntu-test-report | ||
path: Build/tests/results/report.xml | ||
|
||
- name: Publish test results | ||
uses: EnricoMi/publish-unit-test-result-action@v1 | ||
if: always() | ||
with: | ||
check_name: Test Report (C++) on Ubuntu | ||
files: Build/tests/results/report.xml | ||
|
||
pythontests: | ||
name: Python tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.