architectures

Architectures and Architecture class definition

QQuantLib.qml4var.architectures.compute_gradient(batch, parameters)

Compile method of the plugin.

Parameters:
  • batch (QLM Batch) – QLM batch with the Jobs to execute

  • parameters (list) – list with the name of the parameters for gradient computations

Returns:

batch_ – QLM Batch with the jobs for computing graidents

Return type:

QLM Batch

QQuantLib.qml4var.architectures.compute_pdf_from_pqc(batch, parameters)

Given a QLM Batch with a PQC representing a Multivariate Cumulative Distribution Function (cdf) creates all the mandatory PQCs for computing the corresponding Probability Distribution Function, pdf. The returned is a QLM Batch with the jobs mandatory for computing the pdf

Parameters:
  • batch (QLM Batch) – QLM batch with the Jobs to execute

  • parameters (list) – list with the name of the features for pdf computation

Returns:

batch_ – QLM Batch with the jobs for pdf copmputation

Return type:

QLM Batch

QQuantLib.qml4var.architectures.hardware_efficient_ansatz(**kwargs)

Create a hardware efficient ansatz.

Parameters:
  • kwargs (kwargs) – Input dictionary for configuring the ansatz. Mandatory keys:

  • features_number (kwargs, int) – Number of features

  • n_qubits_by_feature (kwargs, int) – Number of qubits used for each feature

  • n_layers (kwargs, int) – Number of layers of the PQC

  • base_frecuency (kwargs, float) – Slope for feature normalization

  • shift_feature (kwargs, float) – Shift for feature normalization

Returns:

  • pqc (QLM Program) – QLM Program with the ansatz

  • weights_names (list) – list with the parameters corrresponding to the weights

  • features_names (list) – list with the parameters corrresponding to the features

QQuantLib.qml4var.architectures.init_weights(weigths_names)

init weights of the PQC

QQuantLib.qml4var.architectures.normalize_data(min_value, max_value, min_x=None, max_x=None)

Feature Normalization. :param min_value: list with the minimum value for all the features :type min_value: list :param max_value: list with the maximum value for all the features :type max_value: list :param min_x: minimum value for encoding the feature in a rotation :type min_x: list :param max_x: maximum value for encoding the feature in a rotation :type max_x: list

Returns:

  • slope (np array) – with the slope for normalization of the features

  • b0 (np array) – with shift for normalization of the features

QQuantLib.qml4var.architectures.z_observable(**kwargs)

Create an Observable.

Parameters:
  • kwargs (kwargs) – Input dictionary for configuring the ansatz

  • features_number (kwargs, int) – Number of input features

  • n_qubits_by_feature (kwargs, int) – Number of qubits for encoding each feature

Returns:

observable – QLM Observable

Return type:

QLM Observable