# How can I convert arithmetic operations in a code to quantum format?

def SSGSM(im):
log_image=np.log(1+np.float32(im))
gx=cv2.Sobel(log_image,cv2.CV_64F,1,0,ksize=3)
gy=cv2.Sobel(log_image,cv2.CV_64F,1,0,ksize=3)
ex=np.exp(-1*abs(gx))
ey=np.exp(-1*abs(gy))
vx=np.multiply(gx,ex)
vy=np.multiply(gy,ey)
vx=np.multiply(vx,vx)
vy=np.multiply(vy,vy)
v_=vx+vy
v=np.sqrt(v_)
return v


I need to convert this code into a quantum format..could anyone help me please?

The code I'll be referencing here is Qiskit, IBM's Quantum SDK (Software Development Kit).

First, you would have to make a circuit, so a good place to start is with the following code:

import qiskit
from qiskit import *
qc = Quantum Circuit (n, m)


where n is the number of qubits, or inputs (each the size of 1 bit) you need to do arithmetic operations on. m is the number of classical bits, or the number of 1-bit outputs you need. Unfortunately, it is more cumbersome to do arithmetic operations in quantum computing than other operations, but you can find an adder gate (an operation in qiskit) in qiskit-aqua, which you can use with the following code:

from qiskit.circuit.library import WeightedAdder