Skip to content

Commit

Permalink
Merge pull request #305 from eendebakpt/lnd_from_vector
Browse files Browse the repository at this point in the history
Improve performance of GST
  • Loading branch information
sserita authored Aug 10, 2023
2 parents f4048c6 + 3f04b11 commit 8ed0c41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions pygsti/modelmembers/operations/lindbladcoefficients.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,10 +817,10 @@ def from_vector(self, v):
# cache_mx[i,i] = params[i,i]
# cache_mx[i,j] = params[i,j] + 1j*params[j,i] (i > j)
cache_mx = self._cache_mx
iparams = 1j * params
for i in range(num_bels):
cache_mx[i, i] = params[i, i]
for j in range(i):
cache_mx[i, j] = params[i, j] + 1j * params[j, i]
cache_mx[i, :i] = params[i, :i] + iparams[:i, i]

#The matrix of (complex) "other"-coefficients is build by assuming
# cache_mx is its Cholesky decomp; means otherCoeffs is pos-def.
Expand All @@ -839,11 +839,11 @@ def from_vector(self, v):

elif self._param_mode == "elements": # params mx stores block_data (hermitian) directly
#params holds block_data real and imaginary parts directly
iparams = 1j * params
for i in range(num_bels):
self.block_data[i, i] = params[i, i]
for j in range(i):
self.block_data[i, j] = params[i, j] + 1j * params[j, i]
self.block_data[j, i] = params[i, j] - 1j * params[j, i]
self.block_data[i, :i] = params[i, :i] + iparams[:i, i]
self.block_data[:i, i] = params[i, :i] - iparams[:i, i]
else:
raise ValueError("Internal error: invalid parameter mode (%s) for block type %s!"
% (self._param_mode, self._block_type))
Expand Down
2 changes: 1 addition & 1 deletion pygsti/objectivefns/objectivefns.py
Original file line number Diff line number Diff line change
Expand Up @@ -4561,7 +4561,7 @@ def _omitted_prob_first_terms(self, probs):
-------
numpy.ndarray
"""
omitted_probs = 1.0 - _np.array([_np.sum(probs[self.layout.indices_for_index(i)])
omitted_probs = 1.0 - _np.array([probs[self.layout.indices_for_index(i)].sum()
for i in self.indicesOfCircuitsWithOmittedData])
return self.raw_objfn.zero_freq_terms(self.total_counts[self.firsts], omitted_probs)

Expand Down

0 comments on commit 8ed0c41

Please sign in to comment.