vec_make

概要

この関数は関数”mat_make”を実行する際に必要不可欠な値を計算する
この関数は”mat_make”内での実行を想定しており、それ以外で用いることは想定していない
“mat_make”と分離させたのは一つの関数が複雑化するのを回避するためである

引数一覧

argument name

type

role

ele

str

「mat_make」で扱う行列の要素が格納されたlist

coflst

list(elements:int)

「mat_make」の行列要素に作用させる係数を格納したlist

戻り値

app_lst(list):計算結果を格納するlist
格納されている要素はfloat型

Python code

def vec_make(ele, coflst):
    """
    This function computes essential values required for executing function, "mat_make".
    This function is intended to be used only within the function,  "mat_make", and is not designed for standalone use.

    Parameters:
        gate_inf: the results of the Jordan–Wigner and Bravyi–Kitaev transformations performed using OpenFermion
        zero_one

    Returns:
        (list, list): The coefficients information and Pauli matrix product information.
    """
    app_lst = []
    cor_list_one = []
    cor_list_two = []
    for i in range(len(coflst)):
        corlen = len(ele)//len(coflst)
        cor_list_one = ele[corlen*i: corlen*i+corlen//2]
        cor_list_two = ele[corlen*i+corlen//2: corlen*i+corlen]
        for j in range(len(cor_list_one)):
            app_lst.append(-cor_list_one[j]/coflst[i])
        for j in range(len(cor_list_two)):
            app_lst.append(cor_list_two[j]*coflst[i])
    return app_lst