Given a binary-valued (only ones and zeroes) MxN matrix C, and K (where K<M and K<N) find a binary-valued MxK matrix A and a binary-valued KxN matrix B such that A*B equals C. e.g. for K = 2, and
C =
1 1 1 0
0 0 0 0
0 1 0 1then one possible solution is
A =
0 1
0 0
1 0B =
0 1 0 1
1 1 1 0For this problem, assume that at least one solution exists.
Note that you cannot do matrix multiplication with two logical matrices in MATLAB.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers14
Suggested Problems
-
Is my wife right? Now with even more wrong husband
1341 Solvers
-
Project Euler: Problem 6, Natural numbers, squares and sums.
2539 Solvers
-
Back to basics 24 - Symbolic variables
145 Solvers
-
Map all the indices of an Array Indices into a Vector giving Index vs Row and Column
48 Solvers
-
Magic is simple (for beginners)
11174 Solvers
More from this Author5
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
you should probably add an assert statement that checks the size of the output matrices
I second @bmtran. lu wins!
thanks, I added the extra asserts as you suggest. the other solutions submitted so far look interesting, thanks for them!