5.7. cpforager.utils.nearsq_grid_layout

cpforager.utils.nearsq_grid_layout(n, tol=1.6676666666666666)

Compute the near-square grid layout dimensions with a width to height ratio being smaller than a given tolerance.

Parameters:
  • n (int) – integer we want the near-square dimensions.

  • tol (float) – tolerance.

Returns:

the dimensions (a,b) such that n = a x b and a/b<tol.

Return type:

tuple(int, int)

Note

n>0 and tol>1.