QNLP
v1.0
|
#include "hamming.hpp"
#include "Simulator.hpp"
#include "IntelSimulator.cpp"
#include "catch2/catch.hpp"
#include <bitset>
Go to the source code of this file.
Macros | |
#define | IS_SET(byte, bit) |
Typedefs | |
typedef ComplexDP | Type |
Functions | |
std::size_t | calc_hammingDist (std::size_t pattern1, std::size_t pattern2, std::size_t len_bin_pattern) |
Calulates the Hamming distance between two binary strings stored as integers. More... | |
std::map< std::size_t, double > | expected_amplitude (std::vector< std::size_t > &target_vec, std::size_t test, std::size_t len_bin_pattern) |
Classically calculates the Hamming distance between each binary string in a vector and a test binary string. More... | |
TEST_CASE ("Test Hamming distance with Roatation about y axis routine","[hammingroty]") | |
Test the Hamming distance routine which uses Y rotations to encode the Hamming distance into each states' ampitudes. Each state's amplitude is calculated classically and compared to the quantum simulator computed counterpart. More... | |
#define IS_SET | ( | byte, | |
bit | |||
) |
Definition at line 10 of file test_hamming.cpp.
typedef ComplexDP Type |
Definition at line 15 of file test_hamming.cpp.
std::size_t calc_hammingDist | ( | std::size_t | pattern1, |
std::size_t | pattern2, | ||
std::size_t | len_bin_pattern | ||
) |
Calulates the Hamming distance between two binary strings stored as integers.
pattern1 | First binary pattern |
pattern2 | Second binary pattern |
len_bin_pattern | Length if binary strings |
Definition at line 27 of file test_hamming.cpp.
References IS_SET.
Referenced by expected_amplitude().
std::map<std::size_t, double> expected_amplitude | ( | std::vector< std::size_t > & | target_vec, |
std::size_t | test, | ||
std::size_t | len_bin_pattern | ||
) |
Classically calculates the Hamming distance between each binary string in a vector and a test binary string.
target_vec | Vector consisting of binary strings represented in std::size_t format |
test | Test vector for calculating Hamming distance between it and all binary strings in target_vec |
len_bin_pattern | Length if binary strings |
Definition at line 44 of file test_hamming.cpp.
References calc_hammingDist(), and QNLP_Python_MPI::num_bin_pattern.
Referenced by TEST_CASE().
TEST_CASE | ( | "Test Hamming distance with Roatation about y axis routine" | , |
"" | [hammingroty] | ||
) |
Test the Hamming distance routine which uses Y rotations to encode the Hamming distance into each states' ampitudes. Each state's amplitude is calculated classically and compared to the quantum simulator computed counterpart.
Definition at line 72 of file test_hamming.cpp.
References expected_amplitude(), QNLP_Python_MPI::len_reg_auxiliary, QNLP_EndToEnd_MPI::len_reg_memory, QNLP_Python_MPI::num_bin_pattern, ncu_opt_tester::num_qubits, QNLP_Python_MPI::reg_auxiliary, QNLP_EndToEnd_MPI::reg_memory, ncu_opt_tester::sim, QNLP_EndToEnd_MPI::test_pattern, QNLP.tagging.tag_file::val, and QNLP_EndToEnd_MPI::vec_to_encode.