Operators

class mentpy.ControlMent(mentpy.Measurement)

Controlled measurement operator.

class mentpy.MentOutcome

Measurement outcome class.

class mentpy.PauliOp

Class for representing Pauli operators as matrices and strings.

MBQCircuits

class mentpy.MBQCircuit

The MBQCircuit class that deals with operations and manipulations of graph states

mentpy.hstack(states) MBQCircuit

Horizontally stack a list of graph states into a larger graph state. This is, the input of the new MBQC circuit is the input of the first state, and the output is the output of the last state.

mentpy.merge(state1: MBQCircuit, state2, ...) MBQCircuit

Merge two MBQC circuits into a larger MBQC circuit. This is, the input and output of the new MBQC circuit will depend on the concat_indices.

mentpy.vstack(states) MBQCircuit

Vertically stack a list of graph states into a larger graph state. This is, the input of the new MBQC circuit is the input of the first state, and the output is the output of the last state.

Templates

mentpy.mbqc.templates.from_pauli(pauli_op: PauliOp) MBQCircuit

Returns a graph state that can implement \(U=e^{-i \theta P}\)

mentpy.mbqc.templates.grid_cluster(n, m, ...) MBQCircuit

Returns a grid cluster state of n x m qubits.

mentpy.mbqc.templates.linear_cluster(n, **kwargs) MBQCircuit

Returns a linear cluster state of n qubits.

mentpy.mbqc.templates.many_wires(n_wires: List, **) MBQCircuit

Returns a graph state with many wires.

mentpy.mbqc.templates.muta(n_wires, n_layers, **) MBQCircuit

This is the Multiple Triangle Ansatz (MuTA) template.

Simulators

class mentpy.BaseSimulator(abc.ABC)

Base class for simulators.

class mentpy.NumpySimulatorDM(mentpy.BaseSimulator)

A density matrix simulator that uses numpy to simulate the quantum circuit.

class mentpy.NumpySimulatorSV(mentpy.BaseSimulator)

A vector state simulator that uses numpy to simulate the quantum circuit.

class mentpy.PatternSimulator

Simulator for measuring patterns of MBQC circuits.

class mentpy.PennylaneSimulator(mentpy.BaseSimulator)

Simulator for measuring patterns of MBQC circuits.

Optimizers

class mentpy.optimizers.AdamOpt(mentpy.optimizers.base.BaseOpt)

Class for the Adam optimizer.

class mentpy.optimizers.RCDOpt(mentpy.optimizers.base.BaseOpt)

Class for the random coordinate descent optimizer.

class mentpy.optimizers.SGDOpt(mentpy.optimizers.base.BaseOpt)

Class for the SGD optimizer.

Utils

class mentpy.utils.FlowSpace

The flow space graph of a MBQCircuit.

mentpy.utils.calculate_complete_gens_lie_algebra(state: MBQCircuit)

Calculates the Pauli operators for the Lie algebra of a given state

mentpy.utils.calculate_gens_lie_algebra(state: MBQCircuit)

Calculates the generators of the Lie algebra of a given state

mentpy.utils.calculate_lie_algebra(circuit: MBQCircuit, ...)

Calculates the Lie algebra of a given MBQCircuit

mentpy.utils.calculate_possible_rotations(state: MBQCircuit)

Calculates the possible rotations of a given state

mentpy.utils.dim_so(n)

Calculates the dimension of \(\mathfrak{so}(n)\)

mentpy.utils.dim_sp(n)

Calculates the dimension of \(\mathfrak{sp}(n)\)

mentpy.utils.dim_su(n)

Calculates the dimension of \(\mathfrak{su}(n)\)

mentpy.utils.generate_haar_random_states(n_qubits, ...) ndarray

Makes one Haar random state over n_qubits

mentpy.utils.generate_random_dataset(unitary: ndarray, ...) tuple

Return random training and test data (input, target) for a given unitary gate unitary.

mentpy.utils.generate_random_dataset_noisy(unitary, ...) tuple

Return random training data (input, target) for a given unitary gate unitary with brownian noise parametrized by noise_level.

mentpy.utils.lie_algebra_completion(generators: PauliOp, ...)

Completes a given set of Pauli operators to a basis of the Lie algebra

mentpy.utils.train_test_split(inputs, targets, ...) tuple

Split the data into training and test sets.