Skip to content

dq.concatenate

concatenate(qarrays: Sequence[QArray], axis: int = 0) -> QArray

Join a sequence of qarrays along an existing batch axis.

Warning

All elements of the sequence qarrays must have identical dims attributes, identical final two dimensions, and identical shapes except along axis.

Parameters:

  • qarrays –

    Qarrays to concatenate.

  • axis –

    Batch axis in the result along which the input qarrays are concatenated.

Returns:

  • Concatenated qarray.

See also
  • dq.stack(): join a sequence of qarrays along a new axis.

Examples:

>>> dq.concatenate([dq.stack([dq.fock(3, 0)]), dq.stack([dq.fock(3, 1)])])
QArray: shape=(2, 3, 1), dims=(3,), dtype=complex64, layout=dense
[[[1.+0.j]
  [0.+0.j]
  [0.+0.j]]

 [[0.+0.j]
  [1.+0.j]
  [0.+0.j]]]