mlx.core.array.diag# array.diag(self, k: int = 0, *, stream: Optional[Union[Stream, Device]] = None) → array# Extract a diagonal or construct a diagonal matrix.