---
title: FastCNOTUnitObjective (latest version)
description: API reference for qiskit.synthesis.unitary.aqc.FastCNOTUnitObjective in the latest version of qiskit
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit/qiskit.synthesis.unitary.aqc.FastCNOTUnitObjective
---

# FastCNOTUnitObjective

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

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/synthesis/unitary/aqc/fast_gradient/fast_gradient.py#L34-L226)

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

Implementation of objective function and gradient calculator, which is similar to `DefaultCNOTUnitObjective` but several times faster.

**Parameters**

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

## Methods

### gradient

`gradient(param_values)`

[GitHub](https://github.com/Qiskit/qiskit/tree/stable/2.5/qiskit/synthesis/unitary/aqc/fast_gradient/fast_gradient.py#L105-L124)

Computes the gradient of objective function. See description of the base class method.

**Parameters**

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

**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.5/qiskit/synthesis/unitary/aqc/fast_gradient/fast_gradient.py#L79-L103)

Computes the objective function and some intermediate data for the subsequent gradient computation. See description of the base class method.

**Parameters**

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

**Return type**

[float](https://docs.python.org/3/library/functions.html#float)
