next | previous | forward | backward | up | top | index | toc | home

diagonalMatrix(Ring,List) -- make a diagonal matrix from a list

Synopsis

Description

If the elements of L all have the same ring, the ring may be omitted.
i1 : R = QQ[a..d];
i2 : diagonalMatrix{a,b,c,3/4}

o2 = | a 0 0 0   |
     | 0 b 0 0   |
     | 0 0 c 0   |
     | 0 0 0 3/4 |

             4       4
o2 : Matrix R  <--- R
i3 : diagonalMatrix(R,{1,2,3})

o3 = | 1 0 0 |
     | 0 2 0 |
     | 0 0 3 |

             3       3
o3 : Matrix R  <--- R

See also