ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
mincirc.m
Go to the documentation of this file.
1%> \brief
2%> Return the integers ``ncol`` and ``nrow`` such that their sum
3%> (half the circumference of the resulting rectangle) is minimum while
4%> their product is larger than or equal the input integer-valued ``area``.
5%>
6%> \details
7%> This function is particularly useful for computing
8%> the number of axes columns and rows in a single figure
9%> that yield the most square-like rectangle.
10%>
11%> \note
12%> The function name stands for *minimum circumference*.<br>
13%>
14%> \param[in] area : The input scalar MATLAB whole number
15%> representing the number of axes (subplots)
16%> to arrange in a single figure.<br>
17%>
18%> \return
19%> ``nrow`` : The output scalar MATLAB whole-number
20%> representing the number of rows of the rectangle.<br>
21%> <br>
22%> ``ncol`` : The output scalar MATLAB whole-number
23%> representing the number of columns of the rectangle.
24%>
25%> \interface{mincirc}
26%> \code{.m}
27%>
28%> [nrow, ncol] = pm.math.mincirc(area);
29%>
30%> \endcode
31%>
32%> \example{mincirc}
33%> \include{lineno} example/math/mincirc/main.m
34%> \output{mincirc}
35%> \include{lineno} example/math/mincirc/main.out.m
36%>
37%> \final{mincirc}
38%>
39%> \author
40%> \JoshuaOsborne, May 21 2024, 9:43 PM, University of Texas at Arlington<br>
41%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
42%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
43function [nrow, ncol] = mincirc(area)
44 ncol = 1 : ceil(sqrt(area));
45 nrow = ceil(area ./ ncol);
46 [~, minloc] = min(nrow + ncol);
47 nrow = nrow(minloc);
48 ncol = ncol(minloc);
49end
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared library directories.
function mincirc(in area)
Return the integers ncol and nrow such that their sum (half the circumference of the resulting rectan...