I have the matrix:
A=[ 4 0 0 0 0
0 3 0 0 0
0 0 2 0 0
0 0 0 1 0
0 0 0 0 1 ];
I want to get the top k elements' values in the diag, such that the sum of these elements are larger than a predefined threshold T, whilst k is as large as possible.
For example: T= 0.9
(4+3+2)/(trace(A)) = 0.818...
(4+3+2+1)/(trace(A)) = 0.909...
i.e. we can get the vector of top values in A as: V= [4,3,2] and thus, k = 3.
Could anyone tell me how can I do that ?