diff --git a/Cargo.lock b/Cargo.lock index 8fb8d505d6..493fc42ba7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1627,7 +1627,7 @@ dependencies = [ [[package]] name = "quantum-sparse-sim" version = "0.7.5" -source = "git+https://github.com/qir-alliance/qir-runner?rev=fa912185954c1866eb8592f0a2f49424360d0aad#fa912185954c1866eb8592f0a2f49424360d0aad" +source = "git+https://github.com/qir-alliance/qir-runner?rev=562e2c11ad685dd01bfc1ae975e00d4133615995#562e2c11ad685dd01bfc1ae975e00d4133615995" dependencies = [ "ndarray", "num-bigint", diff --git a/library/std/src/Std/Intrinsic.qs b/library/std/src/Std/Intrinsic.qs index a4dc011e03..27479ddbc5 100644 --- a/library/std/src/Std/Intrinsic.qs +++ b/library/std/src/Std/Intrinsic.qs @@ -1152,6 +1152,24 @@ operation Z(qubit : Qubit) : Unit is Adj + Ctl { /// /// # Remarks /// The matrix is checked at runtime to ensure it's shape is square and that the matrix dimensions are `2 ^ Length(qubits)`. +/// +/// # Example +/// This performs a two qubit CNOT using the unitary matrix representation: +/// ```qsharp +/// import Std.Math.Complex; +/// use qs = Qubit[2]; +/// let one = new Complex { Real = 1.0, Imag = 0.0 }; +/// let zero = new Complex { Real = 0.0, Imag = 0.0 }; +/// ApplyUnitary( +/// [ +/// [one, zero, zero, zero], +/// [zero, one, zero, zero], +/// [zero, zero, zero, one], +/// [zero, zero, one, zero] +/// ], +/// qs +/// ); +/// ``` @Config(Unrestricted) operation ApplyUnitary(matrix : Complex[][], qubits : Qubit[]) : Unit { let num_rows = Length(matrix);