dpnp.diagflat

dpnp.diagflat(x1, k=0)[source]

Create a two-dimensional array with the flattened input as a diagonal.

For full documentation refer to numpy.diagflat.

Examples

>>> import dpnp as np
>>> np.diagflat([[1,2], [3,4]])
array([[1, 0, 0, 0],
       [0, 2, 0, 0],
       [0, 0, 3, 0],
       [0, 0, 0, 4]])
>>> np.diagflat([1,2], 1)
array([[0, 1, 0],
       [0, 0, 2],
       [0, 0, 0]])