Re: Re: Column Product of a Matrix of zeros and 1's
- To: mathgroup at smc.vnet.net
- Subject: [mg88093] Re: [mg88042] Re: Column Product of a Matrix of zeros and 1's
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 24 Apr 2008 05:58:03 -0400 (EDT)
- Reply-to: hanlonr at cox.net
myM2 = {{1, 1, 0, 0, 0, 0, 1, 0, 0}, {1, 1, 0, 0, 0, 0, 1, 1, 0}, {1,
1, 1, 0, 0, 0, 1, 1, 0}, {1, 0, 1, 0, 0, 0, 1, 1, 1}, {1, 1, 0, 1,
0, 1, 0, 0, 0}, {1, 1, 1, 1, 0, 1, 0, 0, 0}, {1, 0, 1, 1, 1, 0,
0, 0, 0}, {1, 0, 1, 1, 0, 1, 0, 0, 0}};
thisSet = {1, 2};
Flatten[Position[Times @@ Transpose[myM2][[thisSet]], 1]]
{1,2,3,5,6}
Intersection @@ (Flatten[Position[#, 1]] & /@
Transpose[myM2][[thisSet]])
{1,2,3,5,6}
Bob Hanlon
---- P_ter <petervansummeren at gmail.com> wrote:
> Hello Bill,
> thanks for your answer and sorry I am not clear. This is an example of myGlobalMatrix:
> myM2 = {
> {1, 1, 0, 0, 0, 0, 1, 0, 0},
> {1, 1, 0, 0, 0, 0, 1, 1, 0},
> {1, 1, 1, 0, 0, 0, 1, 1, 0},
> {1, 0, 1, 0, 0, 0, 1, 1, 1},
> {1, 1, 0, 1, 0, 1, 0, 0, 0},
> {1, 1, 1, 1, 0, 1, 0, 0, 0},
> {1, 0, 1, 1, 1, 0, 0, 0, 0},
> {1, 0, 1, 1, 0, 1, 0, 0, 0}
> };
> I take the product of colomn 1 and 2 as an example:
> {1,1,1,0,1,1,0,0} (thisSet= {1,2})
> The positions of the 1's are: {1,2,3,5,6} (with Flatten)
> I solved how to do this for thisSet etc. But I did not use the property that myGlobalMatrix (myM2)is 1's and 0's.
>
> with friendly greetings,
> P_ter
>