I was given a $5\times30$ matrix with each element of the matrix can only take 0 or 1.

It is given that the sum of each row is 8 and the sum of the first 20 columns equals to 1 while the sum of each rest 10 columns equals to 2.

Can anyone know how to find all possible matrices that fulfils these conditions? For example, any R algorithm can be ran for this goal?

  • $\begingroup$ What is the size of your matrix again? $5\times 28$ ? $\endgroup$ – Kushal Bhuyan May 10 '16 at 16:35
  • 2
    $\begingroup$ The total number of 1s is 40 if you look at the rows, but 20+16 if you look at the columns! $\endgroup$ – almagest May 10 '16 at 16:38
  • $\begingroup$ @almagest Sorry, I have changed the size of the matrix, now the sum of all columns and the sum of all rows are equal. $\endgroup$ – user99015 May 10 '16 at 16:54
  • $\begingroup$ @KushalBhuyan It is $5\times30$ $\endgroup$ – user99015 May 10 '16 at 17:14
  • $\begingroup$ I have built on a very similar theme a probabilistic program using a MCMC (Markov Chain Monte Carlo) exploration, that in fact was exhaustive, with a moderate number of lines in Matlab (that is not fundamentally different from R). I will try to retrieve this code and possibly adapt it. I believe that in fact you are less interested by the solutions themselves than by their number, isn't it ? $\endgroup$ – Jean Marie May 10 '16 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.