Find cartesians that fills zero-one matrix
Hi All! I am new here.
I am wondering what is the name for the following algorithm I need to code. If I know the name I could find the algorithm.
1st example
Suppose I have a matrix
Code:
123
Aoo
Boo
C oo
D o
E oo
Having it as an input I need to create an output like this:
ABx12, CEx23, Dx3 (x means cartesian product)
2nd example
Code:
12345
A oo o
B o o
Coo
Doo oo
Eo oo
F ooo
should give me an output like
ABx25, CDx12, DEFx45, AFx3, Ex1
May you help me, please?
Thanks in advance,
Jacek
Re: Find cartesians for matrix elements
It is absolutely not clear what you want to get and what your initial matrices are. What are the dimensions of your matrices?
You may also try to find out something useful and similar to your need here:
https://www.google.com/search?q=cart...2VwigSGUNw7sRM
Re: Find cartesians for matrix elements
Quote:
Originally Posted by
VictorN
It is absolutely not clear what you want to get and what your initial matrices are. What are the dimensions of your matrices?
Hmm... The former matrix's dimension is 3x5, the latter is 5x6.
I thought I wrote it rather clear :ehh:
Re: Find cartesians for matrix elements
So maybe another example will be more clear.
Matrix is (dimension 3x3)
Output should be
Code:
000 001 100
110 + 001 + 000
110 000 000
or
Code:
101 000 000
101 + 010 + 000
000 010 100
Re: Find cartesians for matrix elements
Quote:
Originally Posted by
JackK
Hmm... The former matrix's dimension is 3x5, the latter is 5x6.
I thought I wrote it rather clear :ehh:
No, you didn't. :rolleyes:
Re: Find cartesians for matrix elements
Re: Find cartesians for matrix elements
Quote:
Originally Posted by
JackK
So maybe another example will be more clear.
Matrix is (dimension 3x3)
DO you mean
or something else?
Quote:
Originally Posted by
JackK
Output should be
Code:
000 001 100
110 + 001 + 000
110 000 000
or
Code:
101 000 000
101 + 010 + 000
000 010 100
What is the dimension of "Output"?
What are these "+" (plus) symbols mean?
BTW, did you find something useful and similar to your needs in the pictures I have posted?
Re: Find cartesians for matrix elements
Quote:
Originally Posted by
VictorN
Do you mean
or something else?
I do mean exactly this.
Quote:
Originally Posted by
VictorN
What is the dimension of "Output"?
The same as "Input".
Quote:
Originally Posted by
VictorN
What are these "+" (plus) symbols mean?
"+" means that my "Input" is a sum of "Output" matrixes.
Quote:
Originally Posted by
VictorN
BTW, did you find something useful and similar to your needs in the pictures I have posted?
No, rather not.
Re: Find cartesians for matrix elements
Re: Find cartesians for matrix elements
Maybe I put my requirement in a wrong way.
My requirement is to find submatrixes (minimum amount of them) which sum to my input matrix. Each submatrix must be possible to represent as a one and only one cartesian product. Input matrix is matrix of only 0 and 1 elements.
For example:
input
Code:
a b c d
A 0 1 1 1
B 0 1 1 1
C 0 1 1 0
D 1 1 0 0
output (x means cartesian product)
1. (A,B)x(b,c,d) + (C)x(b,c) + (D)x(a,b)
what is equal to
Code:
a b c d a b c d a b c d
A 0 1 1 1 0 0 0 0 0 0 0 0
B 0 1 1 1 0 0 0 0 0 0 0 0
C 0 0 0 0 + 0 1 1 0 + 0 0 0 0
D 0 0 0 0 0 0 0 0 1 1 0 0
or
2. (A,B,C)x(b,c) + (A,B)x(d) + (D)x(a,b)
what is equal to
Code:
a b c d a b c d a b c d
A 0 1 1 0 0 0 0 1 0 0 0 0
B 0 1 1 0 0 0 0 1 0 0 0 0
C 0 1 1 0 + 0 0 0 0 + 0 0 0 0
D 0 0 0 0 0 0 0 0 1 1 0 0
(so my input matrix can be split into 3 submatrices)
Re: Find cartesians for matrix elements
Is there still not all clear in my requirement?
Should I explain it more (if possible)?
Re: Find cartesians for matrix elements
Re: Find cartesians for matrix elements
As this is not a C++ question, but an algorithm question - the only help I can provide is to suggest that first you solve this using pen/paper to develop the algorithm. Once you produce what you require that way, then you can produce a program design and code from the design.
Sorry, but I can't help you with the required algorithm. But once you have the design, I'll probably be able to provide guidance with the C++ coding. :)
Re: Find cartesians for matrix elements
But the problem is that the algorithm is unknown to me yet.
I thought that it's maybe known to some of you.
Re: Find cartesians for matrix elements