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 1
then one possible solution is
A =
0 1 0 0 1 0
B =
0 1 0 1 1 1 1 0
For this problem, assume that at least one solution exists.
Note that you cannot do matrix multiplication with two logical matrices in MATLAB.
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!
it's lu, again...
very interesting observation that lu returns binary values factors for
these inputs. i must think about this further!
Find the alphabetic word product
2016 Solvers
Solve the set of simultaneous linear equations
183 Solvers
Find the largest value in the 3D matrix
902 Solvers
169 Solvers
104 Solvers