mercredi 4 février 2015

How to check if entries in columns in matrix can (only) have opposite signs in Matlab


What I am interested in seeing is if there is an easy way to show that a large set of matrices (cannot) have columns where there is 1 positive number and 1 negative number. Therefore, I would want to take the following matrix and return false:



[ 0, p1_2, 0, p1_4, 0, p1_4, 0, p1_4, 0]
[ p2_1, 0, 0, 0, -p2_1, -p2_1, 0, 0, -p2_1]
[ p3_1, p3_2, p3_3, 0, 0, 0, p3_2, p3_3, p3_3]
[ 0, 0, p4_3, p4_4, p4_4, 0, p4_4, 0, 0]


As one can see, from column 6 (6), we have p1_4 and p2_1 being the same sign. From (9) we have p2_1 and p3_3 the same sign. However from (8) we would have p1_4 and p3_3 being opposite signs and so this fails.


Any ideas on doing? Thanks! (Btw, I am working in matlab)





Aucun commentaire:

Enregistrer un commentaire