Program Listing for File circuit_optimizer.hpp

Return to documentation for file (/home/docs/checkouts/readthedocs.org/user_builds/qulacs-rtd/checkouts/latest/src/cppsim/circuit_optimizer.hpp)

#pragma once

#include "type.hpp"

class QuantumCircuit;
class QuantumGateBase;
class QuantumGateMatrix;

class DllExport QuantumCircuitOptimizer {
private:
    QuantumCircuit* circuit;
    UINT get_rightmost_commute_index(UINT gate_index);
    UINT get_leftmost_commute_index(UINT gate_index);
    UINT get_merged_gate_size(UINT gate_index1, UINT gate_index2);
    bool is_neighboring(UINT gate_index1, UINT gate_index2);

public:
    QuantumCircuitOptimizer(){};

    virtual ~QuantumCircuitOptimizer(){};

    void optimize(QuantumCircuit* circuit, UINT max_block_size = 2);

    void optimize_light(QuantumCircuit* circuit);

    QuantumGateMatrix* merge_all(const QuantumCircuit* circuit);
};