Skip to content

Commit

Permalink
Use np.empty instead of np.zeros.
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Weichwald <git@sweichwald.de>
  • Loading branch information
sweichwald committed Oct 25, 2018
1 parent b652f93 commit 6b633ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions groupica/groupica.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def fit(self, X, y=None, group_index=None, partition_index=None):
for group in np.unique(group_index):
no_pairs += len(
np.unique(partition_index[group_index == group]))
covmats = np.zeros((no_pairs * no_timelags, dim, dim))
covmats = np.empty((no_pairs * no_timelags, dim, dim))
idx = 0
for group in np.unique(group_index):
unique_partitions = np.unique(
Expand Down Expand Up @@ -238,7 +238,7 @@ def fit(self, X, y=None, group_index=None, partition_index=None):
replace=False
)]
no_pairs += pairs_per_group[i].shape[0]
covmats = np.zeros((no_pairs * no_timelags, dim, dim))
covmats = np.empty((no_pairs * no_timelags, dim, dim))
idx = 0
for pairs, group in zip(pairs_per_group, np.unique(group_index)):
if pairs is not None:
Expand Down
2 changes: 1 addition & 1 deletion groupica/uwedgeica.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def fit(self, X, y=None, partition_index=None):
if self.timelags is not None:
timelags.extend(self.timelags)
no_timelags = len(timelags)
covmats = np.zeros((no_partitions * no_timelags, dim, dim))
covmats = np.empty((no_partitions * no_timelags, dim, dim))
idx = 0
for partition in np.unique(partition_index):
ind = (partition_index == partition)
Expand Down

0 comments on commit 6b633ec

Please sign in to comment.