You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Error Output
Environment Context
macOS 13.3.1(a)
tensorcircuit 0.8.0
BTW, why tc.about() gives me "module 'tensorcircuit' has no attribute 'about'"?
The text was updated successfully, but these errors were encountered:
turns out it is a feature related to tensornetwork, when there is only one disentangling edge (one extra bit string), the contractor doesn't raise error since unspecified output edge is unique.
If you really want to fix it (nothing really wrong if the use specify the correct bitstring), adding a length check at the beginning of amplitude method is enough. Welcome to PR on this error check protection
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
Error Output
Environment Context
macOS 13.3.1(a)
tensorcircuit 0.8.0
BTW, why
tc.about()
gives me "module 'tensorcircuit' has no attribute 'about'"?The text was updated successfully, but these errors were encountered: