Next: instrument_valuation, Previous: harrell_davis_weight, Up: Octave Functions and Scripts [Contents][Index]
Convert a linear index to subscripts of a trinagular matrix.
An example of trinagular matrix linearly indexed follows
N = 4;
A = -repmat (1:N,N,1);
A += repmat (diagind, N,1) - A.';
A = tril(A)
=> A =
1 0 0 0
2 5 0 0
3 6 8 0
4 7 9 10
The following example shows how to convert the linear index ‘6’ in the 4-by-4 matrix of the example into a subscript.
[r, c] = ind2sub_tril (4, 6)
=> r = 2
c = 3
when idx is a row or column matrix of linear indeces then r and c have the same shape as idx.
See also: vech, ind2sub, sub2ind_tril.