Skip to content

Commit 288c238

Browse files
authored
Avoid duplicate array creation in dense layout detection
1 parent 3ca23de commit 288c238

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

activitysim/core/skim_parquet.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,9 @@ def _detect_dense_layout(self, orig_idx, dest_idx):
106106
):
107107
return ROW_MAJOR
108108

109-
col_major_orig = np.tile(np.arange(n), n)
110-
col_major_dest = np.repeat(np.arange(n), n)
111-
if np.array_equal(orig_idx, col_major_orig) and np.array_equal(
112-
dest_idx, col_major_dest
109+
# col-major orig/dest patterns are the same as row-major dest/orig
110+
if np.array_equal(orig_idx, row_major_dest) and np.array_equal(
111+
dest_idx, row_major_orig
113112
):
114113
return COL_MAJOR
115114

0 commit comments

Comments
 (0)