cqlib-core 0.1.0-beta.4

The high-performance core foundation for the CQLib quantum computing ecosystem.
Documentation
// This code is part of Cqlib.
//
// (C) Copyright China Telecom Quantum Group 2026
//
// This code is licensed under the Apache License, Version 2.0. You may
// obtain a copy of this license in the LICENSE.txt file in the root directory
// of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
//
// Any modifications or derivative works of this code must retain this
// copyright notice, and modified files need to carry a notice indicating
// that they have been altered from the originals.

// Fermionic simulation gate decomposition rules.
//
// These rules own FSIM lowering to Ising interaction primitives.

rule decompose_fsim_to_rzz_phase {
    match { FSIM(theta, phi) 0 1 }
    rewrite { RXX(theta) 0 1, RYY(theta) 0 1, GPhase(-phi/4), RZ(-phi/2) 0, RZ(-phi/2) 1, RZZ(phi/2) 0 1 }
}

rule decompose_fsim_to_rxx_ryy_crz {
    match { FSIM(theta, phi) 0 1 }
    rewrite { RXX(theta) 0 1, RYY(theta) 0 1, Phase(-phi/2) 0, CRZ(-phi) 0 1 }
}

rule decompose_fsim_to_rx_ry_rzz {
    match { FSIM(theta, phi) 0 1 }
    rewrite {
        RY(-π/2) 0, RY(-π/2) 1, RZZ(theta) 0 1, RY(π/2) 1, RY(π/2) 0, RX(π/2) 0, RX(π/2) 1, RZZ(theta) 0 1, RX(-π/2) 1, RX(-π/2) 0, GPhase(-phi/4), RX(-π/2) 0, RY(-phi/2) 0, RX(π/2) 0, RX(-π/2) 1, RY(-phi/2) 1, RX(π/2) 1, RZZ(phi/2) 0 1 }
}