Skip to content

power of complex numbers #43

@TheFausap

Description

@TheFausap

I was trying to get an integer power of a complex number and I created a function:

pN:{t:y#x;$[y=0;1a;*/t]}

using it in this function (it generates a matrix representing a quantum Fourier transform of log2(x) qubits):

QFT:{(1%%x)*(pN[om x]''((!x)*\:!x))}

where om function is:

om:{angle[1;360%x]}

Can some rounding be applied for the angle part?
For example, the matrix for 3 qubits (QFT 8) is:

0.353553a 0.353553a 0.353553a 0.353553a 0.353553a 0.353553a 0.353553..
0.353553a 0.353553a44.999999 0.353553a89.999999 0.353553a134.999999 ..
0.353553a 0.353553a89.999999 0.353553a179.999999 0.353553a270 0.3535..
0.353553a 0.353553a134.999999 0.353553a270 0.353553a44.999999 0.3535..
0.353553a 0.353553a179.999999 0.353553a359.999999 0.353553a179.99999..
0.353553a 0.353553a224.999999 0.353553a89.999999 0.353553a314.999999..
0.353553a 0.353553a270 0.353553a179.999999 0.353553a89.999999 0.3535..
0.353553a 0.353553a315 0.353553a269.999999 0.353553a224.999999 0.353..

thanks
Fausto

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions