Skip to main content

View on GitHub

Open this notebook in GitHub to run it yourself
The quantum Sine and Cosine transforms functions are the quantum analog for the discrete Sine and Cosine transforms. The unitary versions of the type I and type II transforms are defined as follows: DCTjk(1)(N)=αjk2N−1cos⁡(πjkN−1),αjk={12j=0,N−1,12k=0,N−1,1else,j,k=0…,N−1{\rm DCT}^{(1)}_{jk}(N) = \alpha_{jk}\sqrt{\frac{2}{N-1}} \cos\left(\frac{\pi j k}{N-1}\right), \qquad \alpha_{jk} = \left\{ \begin{array}{l l} \frac{1}{\sqrt{2}} & j = 0,N-1 ,\\ \frac{1}{\sqrt{2}} & k = 0,N-1 ,\\ 1 & \text{else} \end{array} \right., \qquad j,k = 0\dots,N-1 DSTjk(1)(N)=2N+1sin⁡(πjkN+1),j,k=0…,N−1{\rm DST}^{(1)}_{jk}(N) = \sqrt{\frac{2}{N+1}} \sin\left(\frac{\pi j k}{N+1}\right), \qquad j,k = 0\dots,N-1 DCTjk(2)(N)=αjk2Ncos⁡(π(j+1/2)kN),αjk={12k=0,1else,j,k=0…,N−1{\rm DCT}^{(2)}_{jk}(N) = \alpha_{jk}\sqrt{\frac{2}{N}} \cos\left(\frac{\pi (j+1/2) k }{N}\right), \qquad \alpha_{jk} = \left\{ \begin{array}{l l} \frac{1}{\sqrt{2}} & k = 0 ,\\ 1 & \text{else} \end{array} \right., \qquad j,k = 0\dots,N-1 DSTjk(2)(N)=αjk2Nsin⁡(π(j+1/2)(k+1)N),αjk={12k=N−1,1else,j,k=0…,N−1{\rm DST}^{(2)}_{jk}(N) = \alpha_{jk} \sqrt{\frac{2}{N}} \sin\left(\frac{\pi (j+1/2) (k+1)}{N}\right), \qquad \alpha_{jk} = \left\{ \begin{array}{l l} \frac{1}{\sqrt{2}} & k = N-1 ,\\ 1 & \text{else} \end{array} \right., \qquad j,k = 0\dots,N-1 The open library includes four functions, following the implementation in Ref. [1]:

QCT and QST of Type I

Function: qct_qst_type1 Arguments:
  • x: QArray[QBit]
The x quantum argument is the quantum state on which we apply the transforms, according to the following unitary on n≡n\equivx.len qubits: (DCT(1)(2n−1+1)00iDST(1)(2n−1−1))\left( \begin{array}{ccc|c} {} &{} &{} \\ {}&{\rm DCT}^{(1)}(2^{n-1}+1) & {}& 0\\ {} &{} &{} \\ \hline {} & 0 & {} & i{\rm DST}^{(1)}(2^{n-1}-1) \end{array} \right)

Example

Output:
Output:
Output:

QCT and QST of Type II

Function: qct_qst_type2 Arguments:
  • x: QArray[QBit],
  • q: QBit
The x quantum argument is the quantum state on which we apply the transforms, whereas the single q qubit indicates the block, according to the following unitary on n+1≡n+1\equiv x.len +1+1 qubits: (DCT(2)(2n−1)00−DST(2)(2n−1))\left( \begin{array}{c|c} {\rm DCT}^{(2)}(2^{n-1}) & 0\\ \hline 0 & -{\rm DST}^{(2)}(2^{n-1}) \end{array} \right) Function: qct_type2 Arguments:
  • x: QArray[QBit]: the quantum state on which we apply DCT(2){\rm DCT}^{(2)}.
Function: qst_type2 Arguments:
  • x: QArray[QBit]: the quantum state on which we apply DST(2){\rm DST}^{(2)}.

Example

Output:
Output:
Output:
Output:
Output:
Output:
Output:

References

[1]: Klappenecker, A., & Rotteler M., “Discrete Cosine Transforms on Quantum Computers”.