Skip to content

Commit c390709

Browse files
authored
Various small tdb matrix cleanups (#510)
1 parent eff5988 commit c390709

File tree

3 files changed

+9
-20
lines changed

3 files changed

+9
-20
lines changed

src/include/detail/linalg/tdb_matrix.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,12 @@ class tdbBlockedMatrix : public MatrixBase {
9292
index_type last_row_;
9393
index_type first_col_;
9494
index_type last_col_;
95+
96+
// The columns loaded into memory. Except for the last (remainder) block,
97+
// this range will be equal to `load_blocksize_`.
9598
index_type first_resident_col_;
9699
index_type last_resident_col_;
97100

98-
// The number of columns loaded into memory. Except for the last (remainder)
99-
// block, this will be equal to `blocksize_`.
100-
index_type num_resident_cols_{0};
101-
102101
// How many columns to load at a time
103102
index_type load_blocksize_{0};
104103

@@ -234,21 +233,14 @@ class tdbBlockedMatrix : public MatrixBase {
234233

235234
auto cell_order = schema_.cell_order();
236235
auto tile_order = schema_.tile_order();
237-
238236
if ((matrix_order_ == TILEDB_ROW_MAJOR && cell_order == TILEDB_COL_MAJOR) ||
239237
(matrix_order_ == TILEDB_COL_MAJOR && cell_order == TILEDB_ROW_MAJOR)) {
240238
throw std::runtime_error("Cell order and matrix order must match");
241239
}
242-
243240
if (cell_order != tile_order) {
244241
throw std::runtime_error("Cell order and tile order must match");
245242
}
246243

247-
auto domain_{schema_.domain()};
248-
249-
auto row_domain{domain_.dimension(0)};
250-
auto col_domain{domain_.dimension(1)};
251-
252244
// If non_empty_domain() is an empty vector it means that
253245
// the array is empty. Else If the user specifies a value then we use it,
254246
// otherwise we use the non-empty domain.

src/include/detail/linalg/tdb_matrix_with_ids.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ class tdbBlockedMatrixWithIds
8585

8686
/**
8787
* @brief Construct a new tdbBlockedMatrixWithIds object, limited to
88-
* `upper_bound` vectors. In this case, the `Matrix` is row-major, so the
89-
* number of vectors is the number of rows.
88+
* `upper_bound` vectors. In this case, the `Matrix` is column-major, so the
89+
* number of vectors is the number of columns.
9090
*
9191
* @param ctx The TileDB context to use.
9292
* @param uri URI of the TileDB array to read.
@@ -142,7 +142,7 @@ class tdbBlockedMatrixWithIds
142142
size_t first_col,
143143
std::optional<size_t> last_col,
144144
size_t upper_bound,
145-
TemporalPolicy temporal_policy) // noexcept
145+
TemporalPolicy temporal_policy)
146146
requires(std::is_same_v<LayoutPolicy, stdx::layout_left>)
147147
: Base(
148148
ctx,

src/include/detail/linalg/tdb_partitioned_matrix.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,13 @@ class tdbPartitionedMatrix
318318

319319
auto cell_order = partitioned_vectors_schema_.cell_order();
320320
auto tile_order = partitioned_vectors_schema_.tile_order();
321-
322321
if (cell_order != tile_order) {
323322
throw std::runtime_error("Cell order and tile order must match");
324323
}
325324

326325
auto domain_{partitioned_vectors_schema_.domain()};
327-
328326
auto array_rows{domain_.dimension(0)};
329327
auto array_cols{domain_.dimension(1)};
330-
331328
dimensions_ =
332329
(array_rows.template domain<row_domain_type>().second -
333330
array_rows.template domain<row_domain_type>().first + 1);
@@ -622,10 +619,10 @@ class tdbPartitionedMatrix
622619
}
623620

624621
void debug_tdb_partitioned_matrix(
625-
const std::string& msg, size_t max_size = 10) {
622+
const std::string& msg, size_t max_size = 10) const {
626623
debug_partitioned_matrix(*this, msg, max_size);
627-
debug_vector(master_indices_, "# master_indices_", max_size);
628-
debug_vector(relevant_parts_, "# relevant_parts_", max_size);
624+
debug_vector(master_indices_, "# master_indices_ ", max_size);
625+
debug_vector(relevant_parts_, "# relevant_parts_ ", max_size);
629626
debug_vector(squashed_indices_, "# squashed_indices_", max_size);
630627
std::cout << "# total_num_parts_: " << total_num_parts_ << std::endl;
631628
std::cout << "# last_resident_part_: " << last_resident_part_ << std::endl;

0 commit comments

Comments
 (0)