next up previous contents index
suivant: Jordan bloc : JordanBlock monter: Usual matrix précédent: Random matrix : ranm   Table des matières   Index


Diagonal of a matrix or matrix of a diagonal : BlockDiagonal diag

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 :
diag([[1,2],[3,4]])
Output :
[1,4]
Input :
diag([1,4])
Output :
[[1,0],[0,4]]



giac documentation written by Renée De Graeve and Bernard Parisse