qml.math.reduce_matrices

reduce_matrices(mats_and_wires_gen, reduce_func)[source]

Apply the given reduce_func cumulatively to the items of the mats_and_wires_gen generator, from left to right, so as to reduce the sequence to a tuple containing a single matrix and the wires it acts on.

Parameters
  • mats_and_wires_gen (Generator) – generator of tuples containing the matrix and the wires of each operator

  • reduce_func (callable) – function used to reduce the sequence of operators

Returns

a tuple containing the reduced matrix and the wires it acts on

Return type

Tuple[tensor, Wires]

Contents

Using PennyLane

Release news

Development

API

Internals