---
title: DefaultCNOTUnitObjective (v2.0)
description: API reference for qiskit.synthesis.unitary.aqc.DefaultCNOTUnitObjective in qiskit v2.0
source: https://quantum.cloud.ibm.com/docs/en/api/qiskit/2.0/qiskit.synthesis.unitary.aqc.DefaultCNOTUnitObjective
---

# DefaultCNOTUnitObjective

*class* `qiskit.synthesis.unitary.aqc.DefaultCNOTUnitObjective(num_qubits, cnots)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.0/qiskit/synthesis/unitary/aqc/cnot_unit_objective.py#L61-L299)

Bases: [`CNOTUnitObjective`](/docs/api/qiskit/2.0/qiskit.synthesis.unitary.aqc.CNOTUnitObjective "qiskit.synthesis.unitary.aqc.cnot_unit_objective.CNOTUnitObjective")

A naive implementation of the objective function based on CNOT units.

**Parameters**

- **num\_qubits** ([*int*](https://docs.python.org/3/library/functions.html#int)) – number of qubits.
- **cnots** (*np.ndarray*) – a CNOT structure to be used in the optimization procedure.

## Attributes

### num\_cnots

Returns: A number of CNOT units to be used by the approximate circuit.

### num\_thetas

Returns: Number of parameters (angles) of rotation gates in this circuit.

### target\_matrix

Returns: a matrix being approximated

## Methods

### gradient

`gradient(param_values)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.0/qiskit/synthesis/unitary/aqc/cnot_unit_objective.py#L172-L299)

Computes a gradient with respect to parameters given a vector of parameter values.

**Parameters**

**param\_values** ([*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray)) – a vector of parameter values for the optimization problem.

**Returns**

an array of gradient values.

**Return type**

[*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray)

### objective

`objective(param_values)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.0/qiskit/synthesis/unitary/aqc/cnot_unit_objective.py#L79-L170)

Computes a value of the objective function given a vector of parameter values.

**Parameters**

**param\_values** ([*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray)) – a vector of parameter values for the optimization problem.

**Returns**

a float value of the objective function.

**Return type**

[*SupportsFloat*](https://docs.python.org/3/library/typing.html#typing.SupportsFloat)
