-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor the testing infrastructure for templated StateVector implementation #115
Conversation
Hello. You may have forgotten to update the changelog!
|
Test Report (C++) on Ubuntu 1 files 1 suites 0s ⏱️ Results for commit 8e8b8fe. ♻️ This comment has been updated with latest results. |
Codecov Report
@@ Coverage Diff @@
## master #115 +/- ##
=======================================
Coverage 98.14% 98.14%
=======================================
Files 3 3
Lines 54 54
=======================================
Hits 53 53
Misses 1 1
Continue to review full report at Codecov.
|
[ch7076] |
* 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
…ector from Python (#121) * Initial reformat and templated 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 * Begin support additions fotr arbitrary unitary application * Enable subproject test builds * Enable standalone CPP library header * Update sizing checks for arbitrary unitary application * Add additional utility functions * Add tests for arbitrary unitary application * Add tests for utils and helper functions * Add testing and safety checks for utilities * Remove LAPACK from build system * Add placeholder functions for gate multiplication * Format TestHelpers * Format utility tests * Add unitary apply to bindings * Remove unneeded functions * Relabel matrix applicator methods * Appease the codefactor * Split tests into param and nonparam * Add support for numpy 2D array gate data without copies * Appease codefactor * Offload dim check to util function * Add docstring for utility functions * Codefactor fixes
Context: With the refactor of the
StateVector
implementation in PR #113 the existing test-suite and tooling required an overhaul. This PR replaces the previous C++ test suite using googletest, with a more maintainable version written using Catch2. These new tests leverage CMake, and will auto-install the Catch2 library and make it available at build-time.Description of the Change: The files located at
pennylane_lightning/src/tests
have been largely replaced by a Catch2 implementation, which tests the newly refactoredStateVector
class and all contained operations. Explicit tests are added for each supported gate-type, and test with bothcomplex<float>
andcomplex<double>
statevector backend data.Benefits: This allows for a more streamlined testing process, and more easily extensible with additional modules that may be added to the package later. Reporting via CI is also provided. The testing will also be more thorough than the previous googletest version.
Possible Drawbacks: The testing file is large, and may incur more overhead than previous testing.
Related GitHub Issues: #113