Skip to content

Commit

Permalink
ENH: only update market-level agents when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffgortmaker committed Jun 18, 2022
1 parent 8561e94 commit 11c2ff9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyblp/markets/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(
# fill missing columns of integration nodes (associated with zeros in sigma) with zeros and drop extra
# product-specific demographic values for product indices not in this market
agents_update_mapping: Dict[str, Tuple[Optional[Array], Any]] = {}
if not parameters.nonzero_sigma_index.all():
if self.agents.nodes.shape[1] != economy.K2 and not parameters.nonzero_sigma_index.all():
nodes = np.zeros((self.agents.shape[0], economy.K2), self.agents.nodes.dtype)
nodes[:, parameters.nonzero_sigma_index] = self.agents.nodes[:, :parameters.nonzero_sigma_index.sum()]
agents_update_mapping['nodes'] = (nodes, nodes.dtype)
Expand Down

0 comments on commit 11c2ff9

Please sign in to comment.