MATLAB: Lower triangular semidefinite matrix

MATLABsemidefinitesparse

how can i build a sparse matrix in this form for a given semidefinite matrix? i only need the sparse lower triangular of semidefinite matrix
for example a semidefinite matrix as Q0:
2 0 -1
Q0 = 0 0.2 0
-1 0 2
is written as:
i = [1 2 3 3 ];
j = [1 2 3 1 ];
c = [2 0.2 2 –1 ];
where i shows number of row
j shows number of column
and c is the elemnt that belong to (i,j) that is not zero and belong to lower triangular of semidefinite matrix

Best Answer

  • [i, j, c] = find(tril(yourmatrix))
    seems to be what you're after.