mindquantum.utils.random_state
- mindquantum.utils.random_state(shapes, norm_axis=0, comp=True, seed=None)[source]
Generate some random quantum state.
- Parameters
shapes (tuple) – shapes = (m, n) means m quantum states with each state formed by \(\log_2(n)\) qubits.
norm_axis (int) – which axis you want to apply normalization. Default:
0
.comp (bool) – if
True
, each amplitude of the quantum state will be a complex number. Default:True
.seed (int) – the random seed. Default:
None
.
- Returns
numpy.ndarray, A normalized random quantum state.
Examples
>>> from mindquantum.utils import random_state >>> random_state((2, 2), seed=42) array([[0.44644744+0.18597239j, 0.66614846+0.10930256j], [0.87252821+0.06923499j, 0.41946926+0.60691409j]])