Слияние кода завершено, страница обновится автоматически
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
namespace Microsoft.Quantum.Samples.UnitTesting {
open Microsoft.Quantum.Diagnostics;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Arrays;
///////////////////////////////////////////////////////////////////////////////////////////////
// Multi target Controlled Not gates
///////////////////////////////////////////////////////////////////////////////////////////////
// Multi target Controlled Not gate takes a control qubit
// with controls and target register |t₁,…,tₙ⟩. On computational basis states it acts as:
// |c₁⟩⊗|t₁,…,tₙ⟩ ↦ |c₁⟩⊗|t₁⊕c₁,…,tₙ⊕c₁⟩, i.e. the target qubits are flipped
// if and only if all control qubit is in state |1⟩.
///////////////////////////////////////////////////////////////////////////////////////////////
/// # Summary
/// A simple implementation of target Controlled Not gate using CNOT gates
operation ApplyMultiTargetNot(controls : Qubit[], target : Qubit[]) : Unit is Adj {
EqualityFactI(Length(controls), 1, "control register must have length 1");
ApplyToEachA(CNOT(Head(controls), _), target);
}
/// # Summary
/// Multi target multi controlled Not implementation using
/// ApplyMultiControlledCA
///
/// # See Also
/// - Microsoft.Quantum.Canon.ApplyMultiControlledCA
operation ApplyMultiTargetMultiNot(controls : Qubit[], targets : Qubit[]) : Unit is Adj {
body (...) {
let singlyControlledOp = ApplyToPartitionA(ApplyMultiTargetNot, 1, _);
ApplyMultiControlledCA(singlyControlledOp, CCNOTop(CCNOT), controls, targets);
}
controlled (extraControls, ...) {
ApplyMultiTargetMultiNot(extraControls + controls, targets);
}
}
}
// /////////////////////////////////////////////////////////////////////////////////////////////
// Implementations of Multi target Controlled Not gates not considered here
// /////////////////////////////////////////////////////////////////////////////////////////////
// ● Constant depth remote multi-target CNOT can be implemented
// in 2D nearest neighbor architecture using constant depth
// fanout/un-fanout circuit and ancillary qubits as described in
// [arXiv:1207.6655v2](https://arxiv.org/pdf/1207.6655v2.pdf)
// /////////////////////////////////////////////////////////////////////////////////////////////
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )