BUILT-IN MATHEMATICA SYMBOL

DiamondMatrix

gives a matrix whose elements are in a diamond-shaped region that extends r index positions to each side, and are otherwise.

DiamondMatrix[r, w]
gives a w×w matrix containing a diamond-shaped region of s.

DiamondMatrix[{r1, r2, ...}, ...]
yields an array whose elements are in a diamond-shaped region that extends index positions in the i direction.

DetailsDetails

• The diamond of s is always at the center of the region.
• In or DiamondMatrix[{r1, ...}] the matrix or array is sized so as to just include all nonzero elements.
• The region of s is taken to be the best discrete approximation to a diamond-shaped region possible given the size of the matrix.
• DiamondMatrix[All, w] gives a w×w matrix containing a diamond shape that is as large as possible.
• DiamondMatrix[..., {w1, w2, ...}] gives a array.
• DiamondMatrix[{r1, ..., rn}, w] gives a array.
• DiamondMatrix[All, {w1, ..., wn}] gives a array containing a diamond-shaped region that is as large as possible.
• The parameter r need not be an integer; in general elements are if their Manhattan distance from the center is not more than .
• For integer r, yields a × matrix.

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

This computes and plots a square diamond-shaped matrix of radius 10:

 Out[1]=