Comments (3)
Thanks for your reply.
I agree. Nothing is really wrong.
But I believe it is worthy to add a length check, because the error message of a (<n) binary string is:
"list index out of range"
and of a (>n+1) binary string is:
"The final node after contraction has more than one remaining edge. In this case output_edge_order
has to be provided."
Neither of them is clear for a beginner.
I will give a try.
from tensorcircuit.
BTW, why tc.about() gives me "module 'tensorcircuit' has no attribute 'about'"?
you can upgrade you tensorcircuit version: pip install -U tensorcircuit
.
Thanks for report the n+1 qubit input case for c.amplitude
, can be reproduced, will have a look
from tensorcircuit.
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.
See code below:
for n in [2, 3, 4]:
ns = []
for _ in range(n):
ns.append(tc.gates.Gate(np.array([1.0, 0.0])))
ns[0][0]^ns[1][0]
try:
print(n, tc.contractor(ns).tensor)
except ValueError:
print(n, "ValueError")
The output will be:
2 1.0
3 [1. 0.]
4 ValueError
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
from tensorcircuit.
Related Issues (20)
- PyTorch2.0's jit is still not good enough to support jit in tc HOT 2
- Failed to transfer Tensor to Numpy when using jit HOT 2
- increase the abundance of the QAOA tutorial HOT 1
- docker file need updating HOT 2
- Enhance <QAOA portfolio tutorial> HOT 4
- Fermion Gaussian State Simulator HOT 3
- Stabilizer simulator
- Backend agnostic implementation of quantum Hamiltonian generation HOT 2
- Applying gates with jnp index HOT 7
- Support trainable adptive circuit HOT 2
- Implementation of SHVQE with QAS HOT 1
- tensor network representation of a tensor circuit HOT 2
- Allow sparse matrix as circuit input HOT 3
- AttributeError: module 'tensorflow' has no attribute 'sparse' HOT 2
- Bug in qiskit circuit parsing HOT 2
- jit compile circuit with any gate HOT 2
- `copy` operation of DM circuit forgets previous `apply_general_kraus` operations HOT 1
- MPS circuit with JIT compilation HOT 8
- Sampling from circuit does not give proper bitstring HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorcircuit.