MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

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
> 



  • Prev by Date: Re: Hamiltonian System
  • Next by Date: Re: Re: installing Playe rPro killed using Mathematica itself: BEWARE!
  • Previous by thread: Re: Column Product of a Matrix of zeros and 1's
  • Next by thread: function not evaluating question tia sal2