define a diagonal matrix from a matrix : I need a help plz 
I want to construct a diagonal matrix D from a matrix A
the first element of the diagonal matrix D must be the product of all elements in the subdiagonal of the matrix A, the second element in the diagonal matrix D must be the product of all elements in the subdiagonal of the matrix A except the first one , the third element in the diagonal matrix D must be the product of all elements in the subdiagonal of the matrix A expect the first and the second one,.... , and the last element of the diagonal matrix D must be 1