Skip to content

Wired input and output of function "c.amplitude" #147

@FelixXu35

Description

@FelixXu35

Issue Description

For a quantum circuit with n qubits, function "c.amplitude" returns the amplitude of a given quantum state. It will work when an n-bit binary string is passed into. An error will raise if the length of the string is not n, except n+1. If an (n+1)-bit string is passed into, "c.amplitude" will return the amplitude of a state corresponding to the first n bits, while the last bit controls the "phase". For example, if a circuit has 3 qubits, and one amplitude is
"000" -> 0.5
then
"0000" -> 0.5
"0001" -> 0.5*j
and j is the imaginary unit

How to Reproduce

Screenshot 2023-05-12 at 23 14 19

Error Output

Screenshot 2023-05-12 at 23 14 39

Environment Context

macOS 13.3.1(a)
tensorcircuit 0.8.0
BTW, why tc.about() gives me "module 'tensorcircuit' has no attribute 'about'"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions