File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change 66
77import numpy as np
88
9- from ..cons import _ALPHABET
9+ from ..quantum import _decode_basis_label
1010
1111Tensor = Any
1212ct = Dict [str , int ]
@@ -117,9 +117,6 @@ def count2vec(
117117 array([0.2, 0. , 0.3, 0.5])
118118 """
119119
120- def parse_key (_k : str ) -> List [int ]:
121- return [_ALPHABET .index (_ch ) for _ch in _k .upper ()]
122-
123120 if not count :
124121 return np .array ([], dtype = float )
125122
@@ -133,7 +130,7 @@ def parse_key(_k: str) -> List[int]:
133130
134131 powers = [dim ** p for p in range (n )][::- 1 ]
135132 for k , v in count .items ():
136- digits = parse_key ( k )
133+ digits = _decode_basis_label ( k , n , dim )
137134 idx = sum (dig * p for dig , p in zip (digits , powers ))
138135 prob [idx ] = (v / shots ) if normalization else v
139136
You can’t perform that action at this time.
0 commit comments