diff --git a/script/configure_dev b/script/configure_dev index b9cc5505..03c93a3b 100755 --- a/script/configure_dev +++ b/script/configure_dev @@ -4,7 +4,8 @@ set -eux CMAKE_C_COMPILER=${CMAKE_C_COMPILER:-"gcc"} CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER:-"g++"} -CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-"Release"} +CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-"Debug"} + CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX:-/usr/local} SCALUQ_USE_OMP=${SCALUQ_USE_OMP:-"ON"} diff --git a/src/gate/merge_gate.cpp b/src/gate/merge_gate.cpp index d273b6d2..b0bce934 100644 --- a/src/gate/merge_gate.cpp +++ b/src/gate/merge_gate.cpp @@ -20,10 +20,7 @@ std::pair, Fp> merge_gate_dense_matrix(const Gate& gate1, const Gat gate2->target_qubit_list(), gate2->control_qubit_mask() & ~common_control_mask, merged_operand_vector); - std::cerr << matrix1 << std::endl; - std::cerr << matrix2 << std::endl; auto matrix = matrix2 * matrix1; - std::cerr << matrix << std::endl; return {gate::DenseMatrix( merged_operand_vector, matrix, internal::mask_to_vector(common_control_mask)), 0.}; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b91dd1a6..a0eaf17a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,7 +7,6 @@ add_executable(scaluq_test EXCLUDE_FROM_ALL circuit/param_circuit_test.cpp gate/gate_test.cpp gate/batched_gate_test.cpp - # gate/merge_test.cpp gate/merge_test.cpp gate/param_gate_test.cpp operator/test_pauli_operator.cpp diff --git a/tests/state/state_vector_test.cpp b/tests/state/state_vector_test.cpp index ef3c0dc2..6f35e125 100644 --- a/tests/state/state_vector_test.cpp +++ b/tests/state/state_vector_test.cpp @@ -11,14 +11,14 @@ using namespace scaluq; TEST(StateVectorTest, HaarRandomStateNorm) { { - const int n_tries = 20; + const int n_tries = 6; for (int n = 1; n <= n_tries; n++) { const auto state = StateVector::Haar_random_state(n); ASSERT_NEAR(state.get_squared_norm(), 1., eps); } } { - const int n_tries = 20; + const int n_tries = 6; for (int n = 1; n <= n_tries; n++) { const auto state = StateVector::Haar_random_state(n); ASSERT_NEAR(state.get_squared_norm(), 1., eps); @@ -27,7 +27,7 @@ TEST(StateVectorTest, HaarRandomStateNorm) { } TEST(StateVectorTest, OperationAtIndex) { - auto state = StateVector::Haar_random_state(10); + auto state = StateVector::Haar_random_state(6); for (std::uint64_t i = 0; i < state.dim(); ++i) { state.set_amplitude_at(i, 1); ASSERT_NEAR(state.get_amplitude_at(i).real(), 1., eps); @@ -73,7 +73,7 @@ TEST(StateVectorTest, ComputationalBasisState) { } TEST(StateVectorTest, HaarRandomStateSameSeed) { - const std::uint64_t n = 10, m = 5; + const std::uint64_t n = 6, m = 5; for (std::uint64_t i = 0; i < m; ++i) { StateVector state1(StateVector::Haar_random_state(n, i)), state2(StateVector::Haar_random_state(n, i)); @@ -82,7 +82,7 @@ TEST(StateVectorTest, HaarRandomStateSameSeed) { } TEST(StateVectorTest, HaarRandomStateWithoutSeed) { - const std::uint64_t n = 10, m = 5; + const std::uint64_t n = 6, m = 5; for (std::uint64_t i = 0; i < m; ++i) { StateVector state1(StateVector::Haar_random_state(n)), state2(StateVector::Haar_random_state(n)); @@ -91,7 +91,7 @@ TEST(StateVectorTest, HaarRandomStateWithoutSeed) { } TEST(StateVectorTest, AddState) { - const std::uint64_t n = 10; + const std::uint64_t n = 6; StateVector state1(StateVector::Haar_random_state(n)); StateVector state2(StateVector::Haar_random_state(n)); auto vec1 = state1.get_amplitudes(); @@ -108,7 +108,7 @@ TEST(StateVectorTest, AddState) { TEST(StateVectorTest, AddStateWithCoef) { const CComplex coef(2.5, 1.3); - const std::uint64_t n = 10; + const std::uint64_t n = 6; StateVector state1(StateVector::Haar_random_state(n)); StateVector state2(StateVector::Haar_random_state(n)); auto vec1 = state1.get_amplitudes(); @@ -125,7 +125,7 @@ TEST(StateVectorTest, AddStateWithCoef) { } TEST(StateVectorTest, MultiplyCoef) { - const std::uint64_t n = 10; + const std::uint64_t n = 6; const CComplex coef(0.5, 0.2); StateVector state(StateVector::Haar_random_state(n)); @@ -141,7 +141,7 @@ TEST(StateVectorTest, MultiplyCoef) { } TEST(StateVectorTest, GetZeroProbability) { - const std::uint64_t n = 10; + const std::uint64_t n = 6; StateVector state(n); state.set_computational_basis(1); for (std::uint64_t i = 2; i <= 10; ++i) { @@ -213,7 +213,7 @@ TEST(StateVectorTest, GetMarginalProbability) { } TEST(StateVectorTest, SamplingSuperpositionState) { - const std::uint64_t n = 10; + const std::uint64_t n = 6; const std::uint64_t nshot = 65536; const std::uint64_t test_count = 10; std::uint64_t pass_count = 0; @@ -248,7 +248,7 @@ TEST(StateVectorTest, SamplingSuperpositionState) { } TEST(StateVectorTest, SamplingComputationalBasis) { - const std::uint64_t n = 10; + const std::uint64_t n = 7; const std::uint64_t nshot = 1024; StateVector state(n); state.set_computational_basis(100); diff --git a/tests/util/util.hpp b/tests/util/util.hpp index 4c1c9b08..775abd67 100644 --- a/tests/util/util.hpp +++ b/tests/util/util.hpp @@ -19,7 +19,7 @@ constexpr Fp eps_() { else if constexpr (std::is_same_v) return 1e-4; else - static_assert(internal::lazy_false_v, "unknown GateImpl"); + static_assert(internal::lazy_false_v, "unknown GateImpl"); } template constexpr Fp eps = eps_();