Comments (2)
I think there's probably two parts to the solution here:
PauliEvolutionGate
absolutely should not be producing by default labels that use that many characters. It's not helpful to anybody, and I imagine it's slow to make as well - I agree we should definitely change that to something more sensible, arguably avoiding eagerly serialising the innerSparsePauliOp
into a less efficient representation when the gate is created, even if we do partially truncate it - it seems very wasteful and prone to this sort of explosion. I don't use the gate, though, so I don't know what might be more useful.- QPY should have an escape mechanism to avoid hard crashing - maybe we just emit a warning on too-long labels and truncate them at the maximum length. We could consider introducing a new QPY format version to support arbitrary-length labels in some form or another too, if it's necessary.
from qiskit.
hi, @garrison as by your suggestion we can implement the truncate function like this
def serialize(self):
label = self._get_full_label()
truncated_label = self._truncate_label(label)
return truncated_label
def _truncate_label(self, label, max_length=65536):
if len(label) <= max_length:
return label
else:
index = max_length - 1
while index >= 0 and label[index] != '+':
index -= 1
if index < 0:
raise ValueError("Cannot truncate label without breaking terms")
return label[:index] + ' {...}'
we can do some modification in the code according to the types of input.
from qiskit.
Related Issues (20)
- Bound `ParameterExpression`s do not match the hash of an equal object of a numeric type
- final_measurement_mapping function in qiskit.primitive.utils.py does not work properly with mid-circuit measurements HOT 1
- Writing testers for noisy simulators HOT 3
- Deprecate v1 primitives HOT 1
- Depreciation error for '+=' in ripple_adder HOT 2
- Depreciation error for gate u3 in random_circuit_hex HOT 1
- Depreciation error for CX functions and dag attribute and key error in mapping_passes HOT 1
- Scheduling pass on circuit not being recognized in time_dynamical_decoupling_pass HOT 1
- Isometry benchmark not producing results HOT 1
- Gate parameter validation in Rust HOT 9
- More lightweight gate append method HOT 5
- AttributeError when running pylint in python 3.12
- Current implementation of StatevectorSampler does not return exact values
- A new StatevectorSampler times slower that the V1 implementation on a small number of qubits HOT 1
- Bug when using pulse draw with backend set up
- Incorrect expectation estimation when Reset is used in circuit
- `Target.has_calibration` errors for instructions without properties
- TranspileLayout page in the IBM QISKIT Documentation (section Transpilation, subsection `qiskit.transpiler`) HOT 3
- Transpiler optimization_method="zxpass" gives wrong result
- How to run Fake Providers locally with QiskitRuntime 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 qiskit.