Skip to content

Commit

Permalink
gate test complete
Browse files Browse the repository at this point in the history
  • Loading branch information
gandalfr-KY committed Oct 22, 2024
1 parent 5e42fcc commit 56b8a22
Show file tree
Hide file tree
Showing 10 changed files with 454 additions and 404 deletions.
2 changes: 1 addition & 1 deletion scaluq/gate/gate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class GatePtr {

public:
using Fp = typename T::Fp;
GatePtr() : _gate_ptr(nullptr), _gate_type(get_gate_type<T>()) {}
GatePtr() : _gate_ptr(nullptr), _gate_type(get_gate_type<T, Fp>()) {}
template <GateImpl U>
GatePtr(const std::shared_ptr<const U>& gate_ptr) {
if constexpr (std::is_same_v<T, U>) {
Expand Down
11 changes: 0 additions & 11 deletions tests/circuit/circuit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,6 @@

using namespace scaluq;

const double eps = 1e-12;
const float eps_f = 1e-6;

template <std::floating_point Fp>
void check_near(const StdComplex<Fp>& a, const StdComplex<Fp>& b) {
if constexpr (std::is_same_v<Fp, double>)
ASSERT_NEAR(std::abs(a - b), 0, eps);
else
ASSERT_NEAR(std::abs(a - b), 0, eps_f);
}

template <std::floating_point Fp>
void circuit_test() {
const std::uint64_t n = 4;
Expand Down
12 changes: 1 addition & 11 deletions tests/circuit/param_circuit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,10 @@
#include <util/random.hpp>

#include "../test_environment.hpp"
#include "../util/util.hpp"

using namespace scaluq;

const double eps = 1e-12;
const float eps_f = 1e-6;

template <std::floating_point Fp>
void check_near(const StdComplex<Fp>& a, const StdComplex<Fp>& b) {
if constexpr (std::is_same_v<Fp, double>)
ASSERT_NEAR(std::abs(a - b), 0, eps);
else
ASSERT_NEAR(std::abs(a - b), 0, eps_f);
}

template <std::floating_point Fp>
void param_circuit_test() {
std::uint64_t n_qubits = 5;
Expand Down
Loading

0 comments on commit 56b8a22

Please sign in to comment.