vec_make
概要
引数一覧
argument name |
type |
role |
|---|---|---|
ele |
str |
A list of elements representing the matrix used in |
coflst |
list(elements:int) |
A list containing the coefficients applied to the matrix elements used in |
戻り値
app_lst(list):
A list for storing the calculation results.
Each element is of type 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