How to construct an electron#
An electron is a single subtask in the workflow. In order to construct an electron, we define a function to perform some task and attach the electron
decorator as shown in the two examples below.
[1]:
import covalent as ct
Here’s how one can construct an electron for the identity operation.
[2]:
@ct.electron
def identity(x):
return x
As another example, consider how an electron corresponding to the quadrature operation is created.
[3]:
from math import sqrt
@ct.electron
def quadrature(x, y):
return sqrt(x**2 + y**2)