pgrid-object: Class of Pixel Grids

Description Details Author(s) See Also


The class "pgrid" (for pixel grid) represents regular quantizations of measures on (bounded subsets of) R^d. Currently only square quantizations of measures on a rectangles are supported, which in 2-d can be thought of as grey scale images.


Objects of class "pgrid" can be created by the function pgrid, and are most commonly used as input to the function transport. There are methods plot, print and summary for this class.

An object of class "pgrid" contains the following elements:

structure the structure of the grid. Currently only "square" and "rectangular" are supported.
dimension the dimension d of the space in which the grid is embedded. Must be >=2.
n the number of pixels along the various coordinates, a vector of length dimension.
N the total number of pixels.
boundary the outer boundary of the "picture" (i.e. of the support of the measure). A vector of
length 2*dimension, where the odd entries contain the left and the even entries
contain the right endpoints of the various coordinates.
gridtriple the rule for generating the pixel centres along the various coordinates.
A dim by 3 matrix where each row is of the form c(start, end, step).
generators the pixel centres along the various coordinates. A list of length dim where the
i-th element is a vector of length n[i].
mass the array of masses in each pixel / at each pixel centre. In 2-d orientation corresponds
to the standard orientation of images, see e.g. image. This means that
pixels are arranged on coordinate axes in the order of their indices.


Dominic Schuhmacher

See Also

Constructor function pgrid.

Search within the transport package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.