width
Returns the width of a matrix or a pixmap.
Syntax
-
width(X)
-
X
is any object
-
Description
For a two-dimensional container, such as a matrix or a pixmap, width(X)
returns the width of X
.
A vector is treated like a two-dimensional container in the form of a column matrix; hence, its width is 1
.
For all other objects, width(X)
returns 1
.
Examples
A ≔ ❨❨6, 3, 2, 0, 4, 5❩, ❨7, 0, 2, 1, 4, 2❩, ❨6, 2, 3, 1, 4, 2❩, ❨8, 0, 2, 3, 3, 5❩, ❨4, 2, 6, 3, 2, 0❩❩
⎛6 3 2 0 4 5⎞ ⎜7 0 2 1 4 2⎟ ⎜6 2 3 1 4 2⎟ ⎜8 0 2 3 3 5⎟ ⎝4 2 6 3 2 0⎠
width(A)
6
bm ≔ ComputePixmap(200, 200, x, y, rgb(x/199, y/199, 0.5))
A pixmap of size 200×200.
width(bm)
200
width(π)
1