Last chance! 50% off unlimited learning
Sale ends in
reduc
computes
these areas, using the height map algorithm described in Maathuis (2005).
In addition to the maximal intersections, the function can also output
the height map and the clique matrix.reduc(R,B=c(0,1),hm=FALSE,cm=FALSE)
rects
. It is
given in the same format as B
.reduc
can be used for the reduction step.
It is carried out automatically as part of the function
computeMLE
.
The time and space complexity of the function reduc
depend
on the parameters
'hm' and 'cm'. If hm=FALSE and cm=FALSE, then the algorithm is $O(n^2)$
in time and $O(n)$ in memory space. If hm=TRUE, then the algorithm
is $O(n^2)$ in both time and space. If cm=TRUE, then the algorithm is
$O(n^3)$ in time and space.
The function reduc
uses the height map algorithm
of Maathuis (2005). It first converts the observation rectangles to
canonical rectangles. Next, it computes the local maxima of the height map,
and then it convert these back to the original coordinates.
This process can be mimicked by hand as
follows: (1) use real2canon
to convert the
rectangles to canonical rectangles; (2) use reduc
to find the canonical maximal intersections
(local maxima of the height map of the canonical rectangles); (3)
use canon2real
to convert the canonical maximal intersections back to the original
coordinates.real2canon
, canon2real
,
computeMLE
,
plotCM
, plotHM
# Load example data:
data(ex)
par(mfrow=c(1,1))
# Plot the observation rectangles
plotRects(ex,main="Example")
# Perform the reduction step
res<-reduc(ex, hm=TRUE, cm=TRUE)
# Shade the maximal intersections
plotRects(res$rects, density=15, add=TRUE, border=NA)
# Plot the height map, together with the observation
# rectangles (in black) and the maximal intersections (shaded)
plotHM(res$hm, ex)
plotRects(ex, add=TRUE, border="black")
plotRects(res$rects, add=TRUE, border=NA, density=15)
# Print the clique matrix
res$cm
# Make a plot of the clique matrix (useful for large data sets)
plotCM(res$cm)
Run the code above in your browser using DataLab