Preparando MOJI

Hessenberg matrix

2000ms 1048576K

Description:

Implement a unitary operation on $$$N$$$ qubits which is represented by an upper Hessenberg matrix (a square matrix of size $$$2^N$$$ which has all zero elements below the first subdiagonal and all non-zero elements on the first subdiagonal and above it).

For example, for $$$N = 2$$$ the matrix of the operation should have the following shape:

XXXX
XXXX
.XXX
..XX

Here X denotes a "non-zero" element of the matrix (a complex number which has the square of the absolute value greater than or equal to $$$10^{-5}$$$), and . denotes a "zero" element of the matrix (a complex number which has the square of the absolute value less than $$$10^{-5}$$$).

The row and column indices of the matrix follow little endian format: the least significant bit of the index is stored first in the qubit array. Thus, the first column of the matrix gives you the coefficients of the basis states you'll get if you apply the unitary to the $$$|00..0\rangle$$$ basis state, the second column - to the $$$|10..0\rangle$$$ basis state etc. You can use the DumpUnitary tool to get the coefficients of the matrix your unitary implements (up to relative phases between columns) and the corresponding pattern of Xs and .s.

You have to implement an operation which takes an array of $$$N$$$ ($$$2 \le N \le 4$$$) qubits as an input and applies the unitary transformation with the matrix of the described shape to it. If there are multiple unitaries which satisfy the requirements, you can implement any of them. The "output" of your operation is the pattern of the matrix coefficients implemented by it; you can see the testing harness in the UnitaryPatterns kata.

Your code should have the following signature:

namespace Solution {
open Microsoft.Quantum.Primitive;
open Microsoft.Quantum.Canon;

operation Solve (qs : Qubit[]) : Unit {
// your code here
}
}

You are not allowed to use measurements in your operation.

Informação

Codeforces

Provedor Codeforces

Código CF1116D6

Tags

Submetido 0

BOUA! 0

Taxa de BOUA's 0%

Datas 09/05/2023 09:44:53

Relacionados

Nada ainda