View source: R/matching_memory.R
| estimate_dense_matrix_mb | R Documentation |
What the matrix itself costs a process, which is more than the 8 bytes a cell
occupies: matrix(0, n, m) at the R level is copied into a
lap::CostMatrix (8B data + 4B mask), and the two coexist while garbage
collection lags. Building the matrix and stopping there peaked at 1.8, 1.7
and 1.5 times the raw cell bytes at 5,000, 10,000 and 20,000 units on the
memory benchmark, so the default multiplier is above what has been measured
rather than fitted to it. n/m
are coerced to double before multiplying so the estimate itself can't
overflow the way lap::CostMatrix's old int flat-index arithmetic did.
estimate_dense_matrix_mb(n, m, overhead_factor = 4)
n, m |
Problem dimensions. |
overhead_factor |
Multiplier on the raw cell bytes. |
This is the matrix, not the solve. estimate_dense_solve_mb() is what the
memory guard reads; see there for why the two differ by more than a copy.
Numeric scalar, the estimated footprint of the matrix in megabytes.
estimate_dense_matrix_mb(5000, 5000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.