Hopping to be clear, I ask this question after some hour of unsucceeded work I have this list
a={{{0., 0.5, 0.4}, {-0.5, 0., -0.1}, {-0.4, 0.1,
0.}}, {{0., -0.5, -0.1}, {0.5, 0., 0.4}, {0.1, -0.4, 0.}}, {{0.,
0., -0.6}, {0., 0., -0.6}, {0.6, 0.6, 0.}}}
associated with its sign matrix
b={{{0, 1, 1}, {-1, 0, -1}, {-1, 1, 0}}, {{0, -1, -1}, {1, 0,
1}, {1, -1, 0}}, {{0, 0, -1}, {0, 0, -1}, {1, 1, 0}}}
The first task is to replace all the sublists in b
by the sum of their element to arrive to
{{2,-2,0},{-2,2,0},{-1,-1,2}}
Then in a
I want to keep only the elements corresponding to 2 in fact the length of the row minus 1 that is as a final result
c={{{0., 0.5, 0.4}}, {{0.5, 0., 0.4}}, {{0.6, 0.6, 0.}}}
and to finish I want to delete the 0 in c.
I have tried with Select
, but obviously all the pure function I have tried fails. Incidentely I wonder if there is a simple way, without transposing to find the sum of all the sublists of a list.