genetic/genetic_algo.py
def make_circuit(theta_val, save_image = False):
    """
    Input theta values to create quantum circuit
    [layer 1], [layer 2]. so on
    the length of each layer should equal length of
    input state

    The theta list will act as our genome

    theta_val: 2D numpy array

    return 2D numpy array of matrices
    """
    qc = QubitCircuit(N = len(theta_val[0]))

    for i in range(len(theta_val)):
        # ADD H gates
        qc.add_1q_gate("SNOT", start = 0, end = qc.N)

        # add RZ theta gates
        for k in range(len(theta_val[0])):
            qc.add_1q_gate("RZ", start = k, end = k + 1,
                           arg_value = theta_val[i][k],
                           arg_label = theta_val[i][k])

        for k in range(len(theta_val[0]) - 1):
            qc.add_gate("CSIGN",
                        targets = [k],
                        controls = [k+1])

    # add a hadamard at the end
    qc.add_1q_gate("SNOT", start = 0, end = qc.N)

    # produce image
    if save_image:
        qc.png

    return reduce(lambda x, y: x * y, qc.propagators())

    Input theta values to create quantum circuit
    [layer 1], [layer 2]. so on
    the length of each layer should equal length of
    input state

    The theta list will act as our genome

    theta_val: 2D numpy array

    return 2D numpy array of matrices
    
Input theta values to create quantum circuit
[layer 1], [layer 2]. so on
the length of each layer should equal length of
input state

The theta list will act as our genome

2D numpy array

return 2D numpy array of matrices
Input theta values to create quantum circuit [ layer 1 ] [ layer 2 ] . so on the length of each layer should equal length of input state The theta list will act as our genome 2D numpy array return 2D numpy array of matrices
def make_circuit(theta_val, save_image = False):
    qc = QubitCircuit(N = len(theta_val[0]))
    for i in range(len(theta_val)):
        qc.add_1q_gate("SNOT", start = 0, end = qc.N)
        for k in range(len(theta_val[0])):
            qc.add_1q_gate("RZ", start = k, end = k + 1,
                           arg_value = theta_val[i][k],
                           arg_label = theta_val[i][k])
        for k in range(len(theta_val[0]) - 1):
            qc.add_gate("CSIGN",
                        targets = [k],
                        controls = [k+1])
    qc.add_1q_gate("SNOT", start = 0, end = qc.N)
    if save_image:
        qc.png
    return reduce(lambda x, y: x * y, qc.propagators())
def make_circuit ( theta_val , save_image = False ) : qc = QubitCircuit ( N = len ( theta_val [ 0 ] ) ) for i in range ( len ( theta_val ) ) : qc . add_1q_gate ( "SNOT" , start = 0 , end = qc . N ) for k in range ( len ( theta_val [ 0 ] ) ) : qc . add_1q_gate ( "RZ" , start = k , end = k + 1 , arg_value = theta_val [ i ] [ k ] , arg_label = theta_val [ i ] [ k ] ) for k in range ( len ( theta_val [ 0 ] ) - 1 ) : qc . add_gate ( "CSIGN" , targets = [ k ] , controls = [ k + 1 ] ) qc . add_1q_gate ( "SNOT" , start = 0 , end = qc . N ) if save_image : qc . png return reduce ( lambda x , y : x * y , qc . propagators ( ) )
Input theta values to create quantum circuit
[layer 1], [layer 2].
Input theta values to create quantum circuit [ layer 1 ] [ layer 2 ] .
"""
    Input theta values to create quantum circuit
    [layer 1], [layer 2]. so on
    the length of each layer should equal length of
    input state

    The theta list will act as our genome

    theta_val: 2D numpy array

    return 2D numpy array of matrices
    """ # ADD H gates # add RZ theta gates # add a hadamard at the end # produce image
theta_val
save_image