diagflat#
- class brainunit.math.diagflat(v, k=0, **kwargs)#
Create a two-dimensional a quantity or array with the flattened input as a diagonal.
- Parameters:
v (
Array| saiunit.Quantity) – Input data, which is flattened and set as the k-th diagonal of the output.k (
int) – Diagonal in question. The default is 0.
- Returns:
res – The 2-D output array.
- Return type:
Array| saiunit.Quantity
Examples
>>> import saiunit as u >>> a = [1, 2, 3] * u.meter >>> u.math.diagflat(a)