qml.measurements.add_shots

add_shots(s1, s2)[source]

Add two Shots objects by concatenating their shot vectors.

Parameters
  • s1 (Shots) – a Shots object to add

  • s2 (Shots) – a Shots object to add

Returns

a Shots object built by concatenating the shot vectors of s1 and s2

Return type

Shots

Example

>>> s1 = Shots((5, (10, 2)))
>>> s2 = Shots((3, 2, (10, 3)))
>>> print(qml.measurements.add_shots(s1, s2))
Shots(total=60, vector=[5 shots, 10 shots x 2, 3 shots, 2 shots, 10 shots x 3])