diff --git a/.github/workflows/all_push.yml b/.github/workflows/all_push.yml index efada98..b594183 100644 --- a/.github/workflows/all_push.yml +++ b/.github/workflows/all_push.yml @@ -36,7 +36,7 @@ jobs: - name: Build # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --parallel + run: cmake --build ${{github.workspace}}/build --verbose --parallel - name: Test C++ run: ctest --test-dir build --verbose diff --git a/tests/test_pauli_op.cpp b/tests/test_pauli_op.cpp index 20ed410..9903011 100644 --- a/tests/test_pauli_op.cpp +++ b/tests/test_pauli_op.cpp @@ -19,12 +19,14 @@ void __check_apply(PauliOp &pauli_op, size_t n_states) { std::vector> states_raw; std::mdspan states = fast_pauli::rand, 2>(states_raw, {dims, n_states}); + // fmt::println("states: \n{}\n", fmt::join(states_raw, ",\n ")); // Apply the PauliOp to a batch of states std::vector> new_states_raw(dims * n_states, 0); std::mdspan, std::dextents> new_states( new_states_raw.data(), dims, n_states); pauli_op.apply(new_states, states); + // fmt::println("new_states: \n{}\n", fmt::join(new_states_raw, ",\n ")); // // Calculate the expected new states @@ -110,6 +112,22 @@ TEST_CASE("test apply simple") { } } +TEST_CASE("test apply single state") { + // Set up PauliOp + std::vector pauli_strings = {"IXYZ"}; + std::vector> coeffs = {1i}; + PauliOp pauli_op(coeffs, pauli_strings); + __check_apply(pauli_op, 1); +} + +TEST_CASE("test apply two states") { + // Set up PauliOp + std::vector pauli_strings = {"IXYZ"}; + std::vector> coeffs = {1i}; + PauliOp pauli_op(coeffs, pauli_strings); + __check_apply(pauli_op, 2); +} + TEST_CASE("test apply multistate") { // Set up PauliOp std::vector pauli_strings = {"IXYZ"}; @@ -127,16 +145,16 @@ TEST_CASE("test apply multistate multistring") { __check_apply(pauli_op, 10); } -TEST_CASE("test apply multistate multistring big strings") { - // Set up PauliOp - std::vector pauli_strings = {"IXYYXYZYZ", "XZXXXZXXX", - "YZIIZZXZZ", "ZXYYZYIII", - "IZIIXZXXI", "ZZIIZXZYY"}; - std::vector> coeffs = { - 1i, -2., 42i, 0.5, std::complex(1e-1, -9e1), 0.1}; - PauliOp pauli_op(coeffs, pauli_strings); - __check_apply(pauli_op, 10); -} +// TEST_CASE("test apply multistate multistring big strings") { +// // Set up PauliOp +// std::vector pauli_strings = {"IXYYXYZYZ", "XZXXXZXXX", +// "YZIIZZXZZ", "ZXYYZYIII", +// "IZIIXZXXI", "ZZIIZXZYY"}; +// std::vector> coeffs = { +// 1i, -2., 42i, 0.5, std::complex(1e-1, -9e1), 0.1}; +// PauliOp pauli_op(coeffs, pauli_strings); +// __check_apply(pauli_op, 10); +// } TEST_CASE("test apply multistate multistring identity") { // Set up PauliOp