Sourcery refactored main branch#1
Conversation
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
|
|
||
| count=0 | ||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
||
| if repeat!=0: | ||
| qc.barrier(qr) | ||
|
|
||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit1 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
|
|
||
| count=0 | ||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.cx(qr[3],qr[2]) | ||
| qc.cx(qr[2],qr[1]) | ||
| qc.cx(qr[1],qr[0]) | ||
| if repeat!=0: | ||
|
|
||
|
|
||
| if repeat!=0: | ||
| qc.barrier(qr) | ||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| qc.cx(qr[1],qr[0]) | ||
| qc.cx(qr[2],qr[1]) | ||
| qc.cx(qr[3],qr[2]) | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit2 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
| count=0 | ||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crz(theta[count],qr[3],qr[2]) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crz(theta[count],qr[2],qr[1]) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crz(theta[count],qr[1],qr[0]) | ||
| count=count+1 | ||
|
|
||
| if repeat!=0: | ||
| if repeat!=0: | ||
| qc.barrier(qr) | ||
|
|
||
|
|
||
| for l in range(L): | ||
|
|
||
|
|
||
|
|
||
| for _ in range(L): | ||
| qc.crz(theta[count],qr[1],qr[0]) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crz(theta[count],qr[2],qr[1]) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crz(theta[count],qr[3],qr[2]) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit3 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
|
|
||
| count=0 | ||
| for l in range(L): | ||
|
|
||
| count=0 | ||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crx(theta[count],qr[3],qr[2]) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crx(theta[count],qr[2],qr[1]) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crx(theta[count],qr[1],qr[0]) | ||
| count=count+1 | ||
|
|
||
| if repeat!=0: | ||
| if repeat!=0: | ||
| qc.barrier(qr) | ||
|
|
||
|
|
||
| for l in range(L): | ||
|
|
||
|
|
||
|
|
||
| for _ in range(L): | ||
| qc.crx(theta[count],qr[1],qr[0]) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crx(theta[count],qr[2],qr[1]) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crx(theta[count],qr[3],qr[2]) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit4 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
|
|
||
| count=0 | ||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
||
|
|
||
| for j in range(4): | ||
| for i in range(4): | ||
| if i!=j: | ||
| qc.crz(theta[count],qr[3-j],qr[3-i]) | ||
| count=count+1 | ||
|
|
||
|
|
||
|
|
||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
| if repeat!=0: | ||
|
|
||
| if repeat!=0: | ||
| qc.barrier(qr) | ||
|
|
||
|
|
||
| for l in range(L): | ||
|
|
||
|
|
||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
||
|
|
||
| for j in range(4): | ||
| for i in range(4): | ||
| if i!=j: | ||
| qc.crz(theta[count],qr[j],qr[i]) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit5 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
| count=0 | ||
|
|
||
| for l in range(L): | ||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit16 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
| count=0 | ||
|
|
||
| for l in range(L): | ||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit17 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
| count=0 | ||
|
|
||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit18 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
| count=0 | ||
|
|
||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],qr[i]) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit19 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
|
|
||
| count=0 | ||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
|
|
||
| if repeat!=0: | ||
|
|
||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit1 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
|
|
||
| count=0 | ||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.cx(3,2) | ||
| qc.cx(2,1) | ||
| qc.cx(1,0) | ||
|
|
||
|
|
||
| if repeat!=0: | ||
|
|
||
| for l in range(L): | ||
|
|
||
|
|
||
| if repeat!=0: | ||
|
|
||
| for _ in range(L): | ||
| qc.cx(1,0) | ||
| qc.cx(2,1) | ||
| qc.cx(3,2) | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit2 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
| count=0 | ||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crz(theta[count],3,2) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crz(theta[count],2,1) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crz(theta[count],1,0) | ||
| count=count+1 | ||
|
|
||
| if repeat!=0: | ||
|
|
||
|
|
||
| if repeat!=0: | ||
|
|
||
| for l in range(L): | ||
|
|
||
|
|
||
| for _ in range(L): | ||
| qc.crz(theta[count],1,0) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crz(theta[count],2,1) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crz(theta[count],3,2) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit3 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
|
|
||
| count=0 | ||
| for l in range(L): | ||
|
|
||
| count=0 | ||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crx(theta[count],3,2) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crx(theta[count],2,1) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crx(theta[count],1,0) | ||
| count=count+1 | ||
|
|
||
| if repeat!=0: | ||
|
|
||
|
|
||
| if repeat!=0: | ||
|
|
||
| for l in range(L): | ||
|
|
||
|
|
||
| for _ in range(L): | ||
| qc.crx(theta[count],1,0) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crx(theta[count],2,1) | ||
| count=count+1 | ||
| count=count+1 | ||
| qc.crx(theta[count],3,2) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit4 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
|
|
||
| count=0 | ||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
|
|
||
|
|
||
| for j in range(4): | ||
| for i in range(4): | ||
| if i!=j: | ||
| qc.crz(theta[count],3-j,3-i) | ||
| count=count+1 | ||
|
|
||
|
|
||
|
|
||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
|
|
||
| if repeat!=0: | ||
|
|
||
|
|
||
|
|
||
| for l in range(L): | ||
|
|
||
| if repeat!=0: | ||
|
|
||
|
|
||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
||
|
|
||
| for j in range(4): | ||
| for i in range(4): | ||
| if i!=j: | ||
| qc.crz(theta[count],j,i) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit5 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
|
|
||
| count=0 | ||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
|
|
||
|
|
||
| for j in range(4): | ||
| for i in range(4): | ||
| if i!=j: | ||
| qc.crx(theta[count],3-j,3-i) | ||
| count=count+1 | ||
|
|
||
|
|
||
|
|
||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
|
|
||
| if repeat!=0: | ||
|
|
||
|
|
||
|
|
||
| for l in range(L): | ||
|
|
||
| if repeat!=0: | ||
|
|
||
|
|
||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
||
|
|
||
| for j in range(4): | ||
| for i in range(4): | ||
| if i!=j: | ||
| qc.crx(theta[count],j,i) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
| count=count+1 | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit6 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
| count=0 | ||
|
|
||
| for l in range(L): | ||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit17 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
| count=0 | ||
|
|
||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit18 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
|
|
||
| # repeat will conjugate the first part and add next the the circuit for expressibility | ||
| # 0:No, 1: Repeat | ||
|
|
||
| count=0 | ||
|
|
||
| for l in range(L): | ||
|
|
||
| for _ in range(L): | ||
| for i in range(4): | ||
| qc.rx(theta[count],i) | ||
| count=count+1 | ||
|
|
||
| for i in range(4): | ||
| qc.rz(theta[count],i) | ||
| count=count+1 | ||
|
|
There was a problem hiding this comment.
Function circuit19 refactored with the following changes:
- Replace unused for index with underscore [×2] (
for-index-underscore)
| r'''A helper function which makes the classfier circuits. | ||
| Given an ID, it returns the PQC.''' | ||
| param_y=[(Parameter('θ'+str(i))) for i in range(40)] | ||
| param_y = [Parameter(f'θ{str(i)}') for i in range(40)] |
There was a problem hiding this comment.
Function make_classifer_circuit refactored with the following changes:
- Use f-string instead of string concatenation (
use-fstring-for-concatenation)
| data = list(zip(dataCoords, 2*dataLabels-1)) | ||
|
|
||
| return data | ||
| return list(zip(dataCoords, 2*dataLabels-1)) |
There was a problem hiding this comment.
Function load_data refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
This removes the following comments ( why? ):
# for shuffling.
# Also, notice we change the data labels from {0, 1} to {-1, +1}
# Make a data structure which is easier to work with
| np.random.seed(0) | ||
| np.random.seed(0) |
There was a problem hiding this comment.
Function train_model refactored with the following changes:
- Replace unused for index with underscore (
for-index-underscore)
| gradient = (loss(currentParams + gradientCoefficient*randomPerturbation) - loss(currentParams - gradientCoefficient*randomPerturbation))\ | ||
| /(gradientCoefficient*randomPerturbation) | ||
|
|
||
| return gradient | ||
|
|
||
| return ( | ||
| loss(currentParams + gradientCoefficient * randomPerturbation) | ||
| - loss(currentParams - gradientCoefficient * randomPerturbation) | ||
| ) / (gradientCoefficient * randomPerturbation) |
There was a problem hiding this comment.
Function SPSA_gradient refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| val=k.most_common(1)[0][0] | ||
| val=k.most_common(1)[0][0] | ||
| list1=['00','11']; | ||
| if val in list1: | ||
| ypredit=-1 | ||
| else: | ||
| ypredit=1 | ||
| return ypredit | ||
| return -1 if val in list1 else 1 |
There was a problem hiding this comment.
Function convertv refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| predict=convertv(count) | ||
| return predict | ||
| return convertv(count) |
There was a problem hiding this comment.
Function Qrun refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| def loss2qubit(datainput,datalabel,currentParams): | ||
| def loss2qubit(datainput,datalabel,currentParams): |
There was a problem hiding this comment.
Function loss2qubit refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
This removes the following comments ( why? ):
# how many qubit?
#number of shots on simulation
| def quick_predict(datainput,currentParams): | ||
| def quick_predict(datainput,currentParams): |
There was a problem hiding this comment.
Function quick_predict refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
This removes the following comments ( why? ):
# how many qubit?
#number of shots on simulation
| val=k.most_common(1)[0][0] | ||
| val=k.most_common(1)[0][0] | ||
| list1=['0000','0001','0010','0011','1100','1101','1110','1111']; | ||
| if val in list1: | ||
| ypredit=-1 | ||
| else: | ||
| ypredit=1 | ||
| return ypredit | ||
| return -1 if val in list1 else 1 |
There was a problem hiding this comment.
Function convert_qubitF refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp) - Inline variable that is immediately returned (
inline-immediately-returned-variable)
| predict=convert_qubitF(count) | ||
| return predict | ||
| return convert_qubitF(count) |
There was a problem hiding this comment.
Function Qrun_qubitF refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
| def loss_qubitF(datainput,datalabel,currentParams,circuit): | ||
| def loss_qubitF(datainput,datalabel,currentParams,circuit): |
There was a problem hiding this comment.
Function loss_qubitF refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
This removes the following comments ( why? ):
# how many qubit?
#number of shots on simulation
| def predict_qubitF(datainput,currentParams,circuit): | ||
| def predict_qubitF(datainput,currentParams,circuit): |
There was a problem hiding this comment.
Function predict_qubitF refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable)
This removes the following comments ( why? ):
# how many qubit?
#number of shots on simulation
Branch
mainrefactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
mainbranch, then run:Help us improve this pull request!