qiskit-documentation/docs/api/qiskit/1.2/qiskit.circuit.ParameterVec...

57 lines
2.2 KiB
Plaintext

---
title: ParameterVector (v1.2)
description: API reference for qiskit.circuit.ParameterVector in qiskit v1.2
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.circuit.ParameterVector
---
# ParameterVector
<Class id="qiskit.circuit.ParameterVector" isDedicatedPage={true} github="https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/circuit/parametervector.py#L50-L120" signature="qiskit.circuit.ParameterVector(name, length=0)" modifiers="class">
Bases: [`object`](https://docs.python.org/3/library/functions.html#object "(in Python v3.13)")
ParameterVector class to quickly generate lists of parameters.
## Attributes
### name
<Attribute id="qiskit.circuit.ParameterVector.name">
Returns the name of the ParameterVector.
</Attribute>
### params
<Attribute id="qiskit.circuit.ParameterVector.params">
Returns the list of parameters in the ParameterVector.
</Attribute>
## Methods
### index
<Function id="qiskit.circuit.ParameterVector.index" github="https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/circuit/parametervector.py#L73-L75" signature="index(value)">
Returns first index of value.
</Function>
### resize
<Function id="qiskit.circuit.ParameterVector.resize" github="https://github.com/Qiskit/qiskit/tree/stable/1.2/qiskit/circuit/parametervector.py#L92-L120" signature="resize(length)">
Resize the parameter vector. If necessary, new elements are generated.
Note that the UUID of each [`Parameter`](qiskit.circuit.Parameter "qiskit.circuit.Parameter") element will be generated deterministically given the root UUID of the `ParameterVector` and the index of the element. In particular, if a `ParameterVector` is resized to be smaller and then later resized to be larger, the UUID of the later generated element at a given index will be the same as the UUID of the previous element at that index. This is to ensure that the parameter instances do not change.
```python
>>> from qiskit.circuit import ParameterVector
>>> pv = ParameterVector("theta", 20)
>>> elt_19 = pv[19]
>>> rv.resize(10)
>>> rv.resize(20)
>>> pv[19] == elt_19
True
```
</Function>
</Class>