qat.core.gate_set.GateSignature

class qat.core.gate_set.GateSignature(name, arg_types, arity=None, matrix_generator=None, circuit_generator=None)

GateSignatures describe gate constructors. They are defined via a constructor name and a list of argument types.

Parameters
  • name (str) – the name of the gate

  • arg_types (list<type>) – a list of python types describing the types of the arguments. Supported types are: int, float, str, np.matrix, np.ndarray, list.

  • arity (int, optional) – the arity of the gate is known in advance

  • matrix_generator (func, optional) – a function that generates the gates matrix when provided with a set of parameters

  • circuit_generator (func, optional) – a function that generates a Circuit implementing the gate when provided with a set of parameters

get_circuit(*args)

Generates a circuit corresponding to a set of parameters.

Parameters

*args (list<Any>) – a list of parameters

get_matrix(*args)

Returns the matrix corresponding to a set of parameters.

Parameters

*args (list<Any>) – a list of parameters

set_circuit_generator(gen)

Sets the circuit generator.

Parameters

gen (fun) – a function that generates a Circuit given the appropriate parameters

set_matrix_generator(gen)

Sets the matrix generator.

Parameters

gen (fun) – a function that generates a numpy matrix given the appropriate parameters