---
title: AILinearFunctionSynthesis (latest version)
description: API reference for qiskit_ibm_transpiler.ai.AILinearFunctionSynthesis in the latest version of qiskit-ibm-transpiler
source: https://eu-de.quantum.cloud.ibm.com/docs/en/api/qiskit-ibm-transpiler/ai-ai-linear-function-synthesis
---

# AILinearFunctionSynthesis

*class* `qiskit_ibm_transpiler.ai.AILinearFunctionSynthesis(coupling_map: list[list[int]] | None = None, backend: Backend | None = None, replace_only_if_better: bool = True, max_threads: int | None = None)`

[GitHub](https://github.com/Qiskit/qiskit-ibm-transpiler/tree/stable/0.18/qiskit_ibm_transpiler/ai/synthesis.py#L231-L281)

Bases: `AISynthesis`

Synthesis for Linear Function circuits (blocks of CX and SWAP gates). Currently up to 9 qubit blocks.

**Parameters**

- **coupling\_map** ([*list*](https://docs.python.org/3/library/stdtypes.html#list)*\[*[*list*](https://docs.python.org/3/library/stdtypes.html#list)*\[*[*int*](https://docs.python.org/3/library/functions.html#int)*]], optional*) – A list of pairs that represents physical links between qubits.
- **backend** (*Backend, optional*) – Backend used for doing the AI Linear Function synthesis
- **replace\_only\_if\_better** ([*bool*](https://docs.python.org/3/library/functions.html#bool)*, optional*) – Determine if replace the original circuit with the synthesized one if it’s better, defaults to True.
- **max\_threads** ([*int*](https://docs.python.org/3/library/functions.html#int)*, optional*) – Set the number of requests to send in parallel.

## Attributes

### is\_analysis\_pass

Check if the pass is an analysis pass.

If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.

### is\_transformation\_pass

Check if the pass is a transformation pass.

If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).

## Methods

### execute

`execute(passmanager_ir, state, callback=None)`

Execute optimization task for input Qiskit IR.

**Parameters**

- **passmanager\_ir** ([*Any*](https://docs.python.org/3/library/typing.html#typing.Any)) – Qiskit IR to optimize.
- **state** ([*PassManagerState*](/docs/api/qiskit/qiskit.passmanager.PassManagerState)) – State associated with workflow execution by the pass manager itself.
- **callback** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable)) – A callback function which is caller per execution of optimization task.

**Returns**

Optimized Qiskit IR and state of the workflow.

**Return type**

[tuple](https://docs.python.org/3/library/stdtypes.html#tuple)\[[*Any*](https://docs.python.org/3/library/typing.html#typing.Any), [*PassManagerState*](/docs/api/qiskit/qiskit.passmanager.PassManagerState)]

### name

`name()`

Name of the pass.

**Return type**

[str](https://docs.python.org/3/library/stdtypes.html#str)

### run

`run(dag)`

[GitHub](https://github.com/Qiskit/qiskit-ibm-transpiler/tree/stable/0.18/qiskit_ibm_transpiler/ai/synthesis.py#L155-L172)

Run a pass on the DAGCircuit. This is implemented by the pass developer.

**Parameters**

**dag** ([*DAGCircuit*](/docs/api/qiskit/qiskit.dagcircuit.DAGCircuit)) – the dag on which the pass is run.

**Raises**

[**NotImplementedError**](https://docs.python.org/3/library/exceptions.html#NotImplementedError) – when this is left unimplemented for a pass.

### synth\_nodes

`synth_nodes(nodes)`

[GitHub](https://github.com/Qiskit/qiskit-ibm-transpiler/tree/stable/0.18/qiskit_ibm_transpiler/ai/synthesis.py#L108-L153)

### update\_status

`update_status(state, run_state)`

Update workflow status.

**Parameters**

- **state** ([*PassManagerState*](/docs/api/qiskit/qiskit.passmanager.PassManagerState)) – Pass manager state to update.
- **run\_state** (*RunState*) – Completion status of current task.

**Returns**

Updated pass manager state.

**Return type**

[*PassManagerState*](/docs/api/qiskit/qiskit.passmanager.PassManagerState)
