diag or BlockDiagonal takes as argument a matrix A or a list l. diag returns the diagonal of A or the diagonal matrix with the list l on the diagonal (and 0 elsewhere). Input:
Output:
Input: