1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/mirrors-quantum

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
Teleportation.qs 3.7 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Chris Granade Отправлено 28.01.2021 09:00 7196bf3
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
namespace Microsoft.Quantum.Samples.UnitTesting {
open Microsoft.Quantum.Diagnostics;
open Microsoft.Quantum.Measurement;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Canon;
///////////////////////////////////////////////////////////////////////////////////////////////
// Circuit for teleportation with detailed annotation of measurement probabilities
///////////////////////////////////////////////////////////////////////////////////////////////
/// # Summary
/// Teleportation transfers 1 qubit by encoding it into a 2-bit message,
/// using an entangled pair of qubits.
///
/// # Remarks
/// Always returns source qubit to |0⟩.
///
/// The circuit first creates an EPR pair between the target qubit and
/// an ancilla qubit that gets allocated inside the function. Then a
/// Bell measurement between the source qubit and one half of the EPR
/// pair is performed. Finally, depending on the 4 possible outcomes of
/// the Bell measurement, a correction is performed to restore the state
/// in the target qubit.
///
/// # Input
/// ## source
/// A single qubit representing the state to be teleported.
/// ## target
/// A single qubit initially in the |0⟩ state onto which
/// given state is to be teleported.
///
/// # See Also
/// - For details see Section 1.3.6 of Nielsen & Chuang
///
/// # References
/// - [ *Michael A. Nielsen , Isaac L. Chuang*,
/// Quantum Computation and Quantum Information ](http://doi.org/10.1017/CBO9780511976667)
operation RunTeleportation(source : Qubit, target : Qubit) : Unit {
// Get a temporary qubit for the Bell pair.
use auxillaryQubit = Qubit();
// Create a Bell pair between the temporary qubit and the target.
AssertMeasurement([PauliZ], [target], Zero, "Error: target qubit must be initialized in zero state");
H(auxillaryQubit);
CNOT(auxillaryQubit, target);
AssertMeasurement([PauliZ, PauliZ], [auxillaryQubit, target], Zero, "Error: EPR state must be eigenstate of ZZ");
AssertMeasurement([PauliX, PauliX], [auxillaryQubit, target], Zero, "Error: EPR state must be eigenstate of XX");
// Perform the Bell measurement and the correction necessary to
// reconstruct the input state as the target state.
CNOT(source, auxillaryQubit);
H(source);
AssertMeasurementProbability([PauliZ], [source], Zero, 0.5, "Error: All outcomes of the Bell measurement must be equally likely", 1E-05);
// Note that MResetZ makes sure that source is returned to zero state
// so that we can deallocate it.
if (MResetZ(source) == One) {
Z(target);
}
// The probability of measuring 0 or 1 is independent on the previous
// measurement outcome
AssertMeasurementProbability([PauliZ], [auxillaryQubit], Zero, 0.5, "Error: All outcomes of the Bell measurement must be equally likely", 1E-05);
if (MResetZ(auxillaryQubit) == One) {
X(target);
}
}
}
// /////////////////////////////////////////////////////////////////////////////////////////////
// Other teleportation circuits not illustrated here
// /////////////////////////////////////////////////////////////////////////////////////////////
// ● Constant depth remote teleportation in linear nearest neighbor architecture.
// For a circuit diagram see Figure 3 on
// [Page 7 of arXiv:1207.6655v2](https://arxiv.org/pdf/1207.6655v2.pdf#page=7)
// /////////////////////////////////////////////////////////////////////////////////////////////

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/mirrors-quantum.git
git@api.gitlife.ru:oschina-mirror/mirrors-quantum.git
oschina-mirror
mirrors-quantum
mirrors-quantum
main