Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #22122 > unrolled thread
| Started by | keijaf2011@gmail.com |
|---|---|
| First post | 2013-02-05 11:19 -0800 |
| Last post | 2013-02-06 11:24 -0800 |
| Articles | 20 on this page of 44 — 11 participants |
Back to article view | Back to comp.lang.java.programmer
compare several boolean matrix’s keijaf2011@gmail.com - 2013-02-05 11:19 -0800
Re: compare several boolean matrix’s Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-02-05 15:47 -0500
Re: compare several boolean matrixs Roedy Green <see_website@mindprod.com.invalid> - 2013-02-05 16:26 -0800
Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-05 19:43 -0500
Re: compare several boolean matrix’s Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-02-05 21:09 -0400
Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-05 19:40 -0500
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-05 23:21 -0800
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 03:23 -0800
Re: compare several boolean matrix’s Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-02-06 07:55 -0400
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 04:11 -0800
Re: compare several boolean matrix’s Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-02-06 08:24 -0400
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 06:00 -0800
Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-06 14:00 +0000
Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 16:18 -0500
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 06:35 -0800
Re: compare several boolean matrix’s Patricia Shanahan <pats@acm.org> - 2013-02-06 07:49 -0800
Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-06 16:13 +0000
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 08:01 -0800
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 08:20 -0800
Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-06 16:33 +0000
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 08:42 -0800
Re: compare several boolean matrix’s Lars Enderin <lars.enderin@telia.com> - 2013-02-06 18:09 +0100
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 09:14 -0800
Re: compare several boolean matrix’s Lars Enderin <lars.enderin@telia.com> - 2013-02-06 18:29 +0100
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 09:40 -0800
Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-06 17:19 +0000
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-06 09:29 -0800
Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-06 18:18 +0000
Re: compare several boolean matrix’s Lars Enderin <lars.enderin@telia.com> - 2013-02-06 19:57 +0100
Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-06 19:02 +0000
Re: compare several boolean matrixs T®oll <spooksRus@derbyshire-crania.org> - 2013-02-06 21:01 +0000
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-08 11:21 -0800
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-08 11:31 -0800
Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-08 19:49 +0000
Re: compare several boolean matrix’s Keivan Jafari <keijaf2011@gmail.com> - 2013-02-08 12:24 -0800
Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 23:30 -0500
Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 23:32 -0500
Re: compare several boolean matrix’s lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-02-09 08:39 +0000
Re: compare several boolean matrix’s Lew <lewbloch@gmail.com> - 2013-02-09 11:18 -0800
Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-09 19:25 -0500
Re: compare several boolean matrix’s Lew <lewbloch@gmail.com> - 2013-02-09 23:36 -0800
Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-10 13:54 -0500
Re: compare several boolean matrix’s Arne Vajhøj <arne@vajhoej.dk> - 2013-02-08 16:30 -0500
Re: compare several boolean matrix’s Patricia Shanahan <pats@acm.org> - 2013-02-06 11:24 -0800
Page 1 of 3 [1] 2 3 Next page →
| From | keijaf2011@gmail.com |
|---|---|
| Date | 2013-02-05 11:19 -0800 |
| Subject | compare several boolean matrix’s |
| Message-ID | <8f60207e-f848-490b-a402-7cc1aba657e9@googlegroups.com> |
Hi there, Is there any way to compare several boolean matrix’s(25 matrix’s) and pick up a final valid matrix of those 25. The elements in the valid matrix will be, an example: If matrix M(0) to M(5) element(21) have value false And if matrix M(6) to M(24) element(21) have value true, Then most probably the value of element 21 is true, since much more matrix’s shows that that element 21 value is true Java code will be mostly appreciated Best regards/ Keivan
[toc] | [next] | [standalone]
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2013-02-05 15:47 -0500 |
| Message-ID | <kerr3r$g2p$1@dont-email.me> |
| In reply to | #22122 |
On 2/5/2013 2:19 PM, keijaf2011@gmail.com wrote:
> Hi there,
>
> Is there any way to compare several boolean matrix’s(25 matrix’s) and pick up a final valid matrix of those 25.
>
> The elements in the valid matrix will be, an example:
>
> If matrix M(0) to M(5) element(21) have value false
>
> And if matrix M(6) to M(24) element(21) have value true, Then most probably the value of element 21 is true, since much more matrix’s shows that that element 21 value is true
>
> Java code will be mostly appreciated
It sounds like you just want to count the number of true and
false values at each position, and then decide which is more
prevalent. Something like this:
boolean[][] matrix = ...;
// What's the maximum length of each boolean vector?
int max = 0;
for (boolean[] vec : matrix)
max = Math.max(vec.length, max);
// Tally the votes:
int[] votes = new int[max];
int[] trues = new int[max];
for (boolean[] vec : matrix) {
for (int i = 0; i < vec.length; ++i) {
votes[i] += 1;
if (vec[i])
trues[i] += 1;
}
}
// Announce the winners:
for (int i = 0; i < max; ++i) {
if (trues[i] > win_fraction * votes[i])
System.out.println(i + " is probably true");
else if (trues[i] < lose_fraction * votes[i])
System.out.println(i + " is probably false");
else
System.out.println(i + " is too close to call");
}
This can probably be simplified: For example, if you know all
the vectors have the same length there's no need for the first loop
or for the `votes' array. On the other hand, finding good values
for `win_fraction' and `lose_fraction' may be difficult; you may
even want to adjust them depending on the `votes[i]' value (an
election that goes 7-to-3 is an overwhelming mandate, but one
that goes 10000007-to-10000003 is lawsuit fodder).
--
Eric Sosman
esosman@comcast-dot-net.invalid
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2013-02-05 16:26 -0800 |
| Subject | Re: compare several boolean matrixs |
| Message-ID | <vj83h81u85vu2c49tbvc4pph0p8onqrr0h@4ax.com> |
| In reply to | #22122 |
On Tue, 5 Feb 2013 11:19:58 -0800 (PST), keijaf2011@gmail.com wrote, quoted or indirectly quoted someone who said : > >Is there any way to compare several boolean matrix=92s(25 matrix=92s) and p= >ick up a final valid matrix of those 25. Java's matrix handling is quite pedestrian because of the way they are stored. For heavy duty work use a C library with JNI glue. -- Roedy Green Canadian Mind Products http://mindprod.com The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. ~ Tom Cargill Ninety-ninety Law
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2013-02-05 19:43 -0500 |
| Message-ID | <5111a718$0$283$14726298@news.sunsite.dk> |
| In reply to | #22138 |
On 2/5/2013 7:26 PM, Roedy Green wrote: > On Tue, 5 Feb 2013 11:19:58 -0800 (PST), keijaf2011@gmail.com wrote, > quoted or indirectly quoted someone who said : >> Is there any way to compare several boolean matrix=92s(25 matrix=92s) and p= >> ick up a final valid matrix of those 25. > > Java's matrix handling is quite pedestrian because of the way they are > stored. For heavy duty work use a C library with JNI glue. Java does not have builtin matrixes, so it is entirely up to the developer how they are stored. If the developer stored them as a 1D array, then Java will store them exactly like C. So JNI would not make any sense in that case. ArrayList<ArrayList<Boolean>> would have some overhead that may or may not be significant. Arne
[toc] | [prev] | [next] | [standalone]
| From | Arved Sandstrom <asandstrom2@eastlink.ca> |
|---|---|
| Date | 2013-02-05 21:09 -0400 |
| Message-ID | <w3iQs.69474$j95.41225@newsfe31.iad> |
| In reply to | #22140 |
On 02/05/2013 08:43 PM, Arne Vajhøj wrote: > On 2/5/2013 7:26 PM, Roedy Green wrote: >> On Tue, 5 Feb 2013 11:19:58 -0800 (PST), keijaf2011@gmail.com wrote, >> quoted or indirectly quoted someone who said : >>> Is there any way to compare several boolean matrix=92s(25 matrix=92s) >>> and p= >>> ick up a final valid matrix of those 25. >> >> Java's matrix handling is quite pedestrian because of the way they are >> stored. For heavy duty work use a C library with JNI glue. > > Java does not have builtin matrixes, so it is entirely up > to the developer how they are stored. > > If the developer stored them as a 1D array, then Java will > store them exactly like C. > > So JNI would not make any sense in that case. > > ArrayList<ArrayList<Boolean>> would have some overhead that > may or may not be significant. > > Arne > Odd suggestion (on Roedy's part) to go to C and JNI for "heavy duty" work. Fact is, if your work with arrays/matrices is so "heavy duty" that Java even with decent 3rd party numerical libraries is getting painful, one had best consider a recent Fortran or Matlab or J or something similar...*not* use C (Numerical Recipes notwithstanding...) AHS
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2013-02-05 19:40 -0500 |
| Message-ID | <5111a671$0$283$14726298@news.sunsite.dk> |
| In reply to | #22122 |
On 2/5/2013 2:19 PM, keijaf2011@gmail.com wrote: > Is there any way to compare several boolean matrix’s(25 matrix’s) and pick up a final valid matrix of those 25. > > The elements in the valid matrix will be, an example: > > If matrix M(0) to M(5) element(21) have value false > > And if matrix M(6) to M(24) element(21) have value true, Then most probably the value of element 21 is true, since much more matrix’s shows that that element 21 value is true > > Java code will be mostly appreciated I think you need to explain better what you really want. You have K matrixes of dimension NxM and you want to calculate the result like what? Arne
[toc] | [prev] | [next] | [standalone]
| From | Keivan Jafari <keijaf2011@gmail.com> |
|---|---|
| Date | 2013-02-05 23:21 -0800 |
| Message-ID | <0ac51066-acac-42c9-8afc-a398bc362ff1@googlegroups.com> |
| In reply to | #22122 |
Den tisdagen den 5:e februari 2013 kl. 20:19:58 UTC+1 skrev Keivan Jafari: > Hi there, > > > > Is there any way to compare several boolean matrix’s(25 matrix’s) and pick up a final valid matrix of those 25. > > > > The elements in the valid matrix will be, an example: > > > > If matrix M(0) to M(5) element(21) have value false > > > > And if matrix M(6) to M(24) element(21) have value true, Then most probably the value of element 21 is true, since much more matrix’s shows that that element 21 value is true > > > > Java code will be mostly appreciated > > > > Best regards/ > > > > Keivan Tankyou all, I will look on Eric's suggestion, Br/ Keivan
[toc] | [prev] | [next] | [standalone]
| From | Keivan Jafari <keijaf2011@gmail.com> |
|---|---|
| Date | 2013-02-06 03:23 -0800 |
| Message-ID | <d8859cbe-ed99-4aea-be11-08746c82a5e4@googlegroups.com> |
| In reply to | #22122 |
Hi again, some clarification; Is there any way to compare several boolean matrix’s(25 matrix’s) and bild a new matrix of those 25. The elements in the new matrix will be, an example: If matrix M(0) to M(5) element(2, 1) have value false And if matrix M(6) to M(24) element(2, 1) have value true, Then most probably the value of element(2, 1) is true, since much more matrix’s shows that element(2, 1) is true Java code will be mostly appreciated All the Matrixes have same size NXM Best regards/ Keivan
[toc] | [prev] | [next] | [standalone]
| From | Arved Sandstrom <asandstrom2@eastlink.ca> |
|---|---|
| Date | 2013-02-06 07:55 -0400 |
| Message-ID | <bxrQs.131886$2v.83065@newsfe05.iad> |
| In reply to | #22157 |
On 02/06/2013 07:23 AM, Keivan Jafari wrote: > Hi again, > some clarification; > Is there any way to compare several boolean matrix’s(25 matrix’s) and bild a new matrix of those 25. > > The elements in the new matrix will be, an example: > > If matrix M(0) to M(5) element(2, 1) have value false > > And if matrix M(6) to M(24) element(2, 1) have value true, > Then most probably the value of element(2, 1) is true, since much more matrix’s shows that element(2, 1) is true > > Java code will be mostly appreciated > > All the Matrixes have same size > NXM > > Best regards/ > Keivan > One observation, Keivan. Right now this is all conceptual. There are no matrices in Java, so really we're talking about how you take many datasets (presumably the same size), let's say 25 such datasets, and process the combination to come up with one dataset with the same size. How others might do this would vary perhaps, but before I ever devised an approach I'd want to find out where the data is coming from. After all, since the objective is *one* "matrix" of size M x N, why construct 25 intermediates? AHS
[toc] | [prev] | [next] | [standalone]
| From | Keivan Jafari <keijaf2011@gmail.com> |
|---|---|
| Date | 2013-02-06 04:11 -0800 |
| Message-ID | <5361ab6d-3277-40e9-97eb-d990502be610@googlegroups.com> |
| In reply to | #22158 |
Den onsdagen den 6:e februari 2013 kl. 12:55:50 UTC+1 skrev Arved Sandstrom: > On 02/06/2013 07:23 AM, Keivan Jafari wrote: > > > Hi again, > > > some clarification; > > > Is there any way to compare several boolean matrix�s(25 matrix�s) and bild a new matrix of those 25. > > > > > > The elements in the new matrix will be, an example: > > > > > > If matrix M(0) to M(5) element(2, 1) have value false > > > > > > And if matrix M(6) to M(24) element(2, 1) have value true, > > > Then most probably the value of element(2, 1) is true, since much more matrix�s shows that element(2, 1) is true > > > > > > Java code will be mostly appreciated > > > > > > All the Matrixes have same size > > > NXM > > > > > > Best regards/ > > > Keivan > > > > > One observation, Keivan. Right now this is all conceptual. There are no > > matrices in Java, so really we're talking about how you take many > > datasets (presumably the same size), let's say 25 such datasets, and > > process the combination to come up with one dataset with the same size. > > > > How others might do this would vary perhaps, but before I ever devised > > an approach I'd want to find out where the data is coming from. After > > all, since the objective is *one* "matrix" of size M x N, why construct > > 25 intermediates? > > > > AHS tankyou. Consider a matrix as a picture of size boolean[N][M] the elements can only get value true or false. So I have 25 picture's(Matrix's), I want to build a new picture(Matrix) based on 25 picture's(Matrix's)
[toc] | [prev] | [next] | [standalone]
| From | Arved Sandstrom <asandstrom2@eastlink.ca> |
|---|---|
| Date | 2013-02-06 08:24 -0400 |
| Message-ID | <0YrQs.28802$Ln.18551@newsfe22.iad> |
| In reply to | #22159 |
On 02/06/2013 08:11 AM, Keivan Jafari wrote: > Den onsdagen den 6:e februari 2013 kl. 12:55:50 UTC+1 skrev Arved Sandstrom: >> On 02/06/2013 07:23 AM, Keivan Jafari wrote: >> >>> Hi again, >> >>> some clarification; >> >>> Is there any way to compare several boolean matrix�s(25 matrix�s) and bild a new matrix of those 25. >> >>> >> >>> The elements in the new matrix will be, an example: >> >>> >> >>> If matrix M(0) to M(5) element(2, 1) have value false >> >>> >> >>> And if matrix M(6) to M(24) element(2, 1) have value true, >> >>> Then most probably the value of element(2, 1) is true, since much more matrix�s shows that element(2, 1) is true >> >>> >> >>> Java code will be mostly appreciated >> >>> >> >>> All the Matrixes have same size >> >>> NXM >> >>> >> >>> Best regards/ >> >>> Keivan >> >>> >> >> One observation, Keivan. Right now this is all conceptual. There are no >> >> matrices in Java, so really we're talking about how you take many >> >> datasets (presumably the same size), let's say 25 such datasets, and >> >> process the combination to come up with one dataset with the same size. >> >> >> >> How others might do this would vary perhaps, but before I ever devised >> >> an approach I'd want to find out where the data is coming from. After >> >> all, since the objective is *one* "matrix" of size M x N, why construct >> >> 25 intermediates? >> >> >> >> AHS > tankyou. > > Consider a matrix as a picture of size boolean[N][M] > the elements can only get value true or false. > So I have 25 picture's(Matrix's), I want to build a new picture(Matrix) based > on 25 picture's(Matrix's) > What I'm getting at is, you say you've got 25 pictures (2D arrays I'd prefer to call them in this scenario). How exactly do you have them? Actual pixel data from images? Data from somewhere else? Regardless of where the data comes from, I doubt that I would ever construct 25 intermediate 2D arrays. If I had an intermediate at all there would only be one. AHS
[toc] | [prev] | [next] | [standalone]
| From | Keivan Jafari <keijaf2011@gmail.com> |
|---|---|
| Date | 2013-02-06 06:00 -0800 |
| Message-ID | <2694f982-0152-4815-8008-8f40c023652d@googlegroups.com> |
| In reply to | #22160 |
Den onsdagen den 6:e februari 2013 kl. 13:24:27 UTC+1 skrev Arved Sandstrom: > On 02/06/2013 08:11 AM, Keivan Jafari wrote: > > > Den onsdagen den 6:e februari 2013 kl. 12:55:50 UTC+1 skrev Arved Sandstrom: > > >> On 02/06/2013 07:23 AM, Keivan Jafari wrote: > > >> > > >>> Hi again, > > >> > > >>> some clarification; > > >> > > >>> Is there any way to compare several boolean matrix�s(25 matrix�s) and bild a new matrix of those 25. > > >> > > >>> > > >> > > >>> The elements in the new matrix will be, an example: > > >> > > >>> > > >> > > >>> If matrix M(0) to M(5) element(2, 1) have value false > > >> > > >>> > > >> > > >>> And if matrix M(6) to M(24) element(2, 1) have value true, > > >> > > >>> Then most probably the value of element(2, 1) is true, since much more matrix�s shows that element(2, 1) is true > > >> > > >>> > > >> > > >>> Java code will be mostly appreciated > > >> > > >>> > > >> > > >>> All the Matrixes have same size > > >> > > >>> NXM > > >> > > >>> > > >> > > >>> Best regards/ > > >> > > >>> Keivan > > >> > > >>> > > >> > > >> One observation, Keivan. Right now this is all conceptual. There are no > > >> > > >> matrices in Java, so really we're talking about how you take many > > >> > > >> datasets (presumably the same size), let's say 25 such datasets, and > > >> > > >> process the combination to come up with one dataset with the same size. > > >> > > >> > > >> > > >> How others might do this would vary perhaps, but before I ever devised > > >> > > >> an approach I'd want to find out where the data is coming from. After > > >> > > >> all, since the objective is *one* "matrix" of size M x N, why construct > > >> > > >> 25 intermediates? > > >> > > >> > > >> > > >> AHS > > > tankyou. > > > > > > Consider a matrix as a picture of size boolean[N][M] > > > the elements can only get value true or false. > > > So I have 25 picture's(Matrix's), I want to build a new picture(Matrix) based > > > on 25 picture's(Matrix's) > > > > > What I'm getting at is, you say you've got 25 pictures (2D arrays I'd > > prefer to call them in this scenario). How exactly do you have them? > > Actual pixel data from images? Data from somewhere else? > > > > Regardless of where the data comes from, I doubt that I would ever > > construct 25 intermediate 2D arrays. If I had an intermediate at all > > there would only be one. > > > > AHS I don't have them as exact, that's why I want to extract a exact picture of those 25 pictures. The pixels are as boolean element true or false. Br/ Keivan
[toc] | [prev] | [next] | [standalone]
| From | lipska the kat <"nospam at neversurrender dot co dot uk"> |
|---|---|
| Date | 2013-02-06 14:00 +0000 |
| Message-ID | <g4adnaTQFaqS_4_MnZ2dnUVZ8gOdnZ2d@bt.com> |
| In reply to | #22159 |
On 06/02/13 12:11, Keivan Jafari wrote: > Den onsdagen den 6:e februari 2013 kl. 12:55:50 UTC+1 skrev Arved Sandstrom: >> On 02/06/2013 07:23 AM, Keivan Jafari wrote: >> >>> Hi again, [snip] > > Consider a matrix as a picture of size boolean[N][M] > the elements can only get value true or false. > So I have 25 picture's(Matrix's), I want to build a new picture(Matrix) based > on 25 picture's(Matrix's) Is this what you mean (simplified) Assuming 0 == false 1 == true and assuming we have the following simple matrices matrix 1 0 | 1 | 0 1 | 1 | 0 0 | 0 | 1 matrix 2 1 | 1 | 1 0 | 1 | 0 1 | 1 | 1 matrix 3 0 | 0 | 1 0 | 0 | 1 1 | 1 | 0 ============================================== result assuming 2 input 1 output XOR logic gate working from top down. e.g ((matrix1[0][0] XOR matrix2[0][0]) XOR matrix3[0][0]) = 1 etc 1 | 0 | 0 1 | 0 | 1 0 | 0 | 0 (EAOE :-) Different results would be obtained by using different logic gates e.g OR, NOT, AND, NAND etc etc lipska -- Lipska the Kat©: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2013-02-08 16:18 -0500 |
| Message-ID | <51156b94$0$286$14726298@news.sunsite.dk> |
| In reply to | #22157 |
On 2/6/2013 6:23 AM, Keivan Jafari wrote: > some clarification; > Is there any way to compare several boolean matrix’s(25 matrix’s) and bild a new matrix of those 25. > > The elements in the new matrix will be, an example: > > If matrix M(0) to M(5) element(2, 1) have value false > > And if matrix M(6) to M(24) element(2, 1) have value true, > Then most probably the value of element(2, 1) is true, since much more matrix’s shows that element(2, 1) is true > > Java code will be mostly appreciated > > All the Matrixes have same size > NXM What is wrong with the trivial double for loop and counting? Arne
[toc] | [prev] | [next] | [standalone]
| From | Keivan Jafari <keijaf2011@gmail.com> |
|---|---|
| Date | 2013-02-06 06:35 -0800 |
| Message-ID | <6479f031-e796-4e27-ba9c-d5d77465159e@googlegroups.com> |
| In reply to | #22122 |
Den tisdagen den 5:e februari 2013 kl. 20:19:58 UTC+1 skrev Keivan Jafari: > Hi there, > > > > Is there any way to compare several boolean matrix’s(25 matrix’s) and pick up a final valid matrix of those 25. > > > > The elements in the valid matrix will be, an example: > > > > If matrix M(0) to M(5) element(21) have value false > > > > And if matrix M(6) to M(24) element(21) have value true, Then most probably the value of element 21 is true, since much more matrix’s shows that that element 21 value is true > > > > Java code will be mostly appreciated > > > > Best regards/ > > > > Keivan No, check below: matrix 1 0 | 1 | 0 1 | 1 | 0 0 | 0 | 1 matrix 2 1 | 1 | 1 0 | 1 | 0 1 | 1 | 1 matrix 3 0 | 0 | 1 0 | 0 | 1 1 | 1 | 0 Result will be as below: example: consider element (0,0) of matrix's above: since maximum amount of matrix's(matrix1 and matrix3) says that element(0,0) is false, then I chose false at element (0,0) in result matrix consider another element element (2,0) of matrix's above: since maximum amount of matrixes(matrix2 and matrix3) says that element(2,0) is true, then I chose true at element (2,0) in result matrix Here is result matrix: 0 | 1 | 1 0 | 1 | 0 1 | 1 | 1
[toc] | [prev] | [next] | [standalone]
| From | Patricia Shanahan <pats@acm.org> |
|---|---|
| Date | 2013-02-06 07:49 -0800 |
| Message-ID | <y5ednc9RHrc45o_MnZ2dnUVZ_q6dnZ2d@earthlink.com> |
| In reply to | #22163 |
On 2/6/2013 6:35 AM, Keivan Jafari wrote: ... > matrix 1 > 0 | 1 | 0 > 1 | 1 | 0 > 0 | 0 | 1 > > matrix 2 > 1 | 1 | 1 > 0 | 1 | 0 > 1 | 1 | 1 > > matrix 3 > 0 | 0 | 1 > 0 | 0 | 1 > 1 | 1 | 0 > > > Result will be as below: > example: > consider element (0,0) of matrix's above: > since maximum amount of matrix's(matrix1 and matrix3) says that element(0,0) is false, then I chose false at element (0,0) in result matrix > > consider another element element (2,0) of matrix's above: > since maximum amount of matrixes(matrix2 and matrix3) says that element(2,0) is true, then I chose true at element (2,0) in result matrix > > Here is result matrix: > > 0 | 1 | 1 > 0 | 1 | 0 > 1 | 1 | 1 > Will there always be an odd number of input matrices? If not, what should happen if a given position has equal numbers of true and false inputs? Patricia
[toc] | [prev] | [next] | [standalone]
| From | lipska the kat <"nospam at neversurrender dot co dot uk"> |
|---|---|
| Date | 2013-02-06 16:13 +0000 |
| Message-ID | <xLCdnQdmWv62HI_MnZ2dnUVZ8iednZ2d@bt.com> |
| In reply to | #22163 |
On 06/02/13 14:35, Keivan Jafari wrote: > Den tisdagen den 5:e februari 2013 kl. 20:19:58 UTC+1 skrev Keivan Jafari: >> Hi there, >> >> >> >> Is there any way to compare several boolean matrix’s(25 matrix’s) and pick up a final valid matrix of those 25. >> >> >> >> The elements in the valid matrix will be, an example: >> >> >> >> If matrix M(0) to M(5) element(21) have value false >> >> >> >> And if matrix M(6) to M(24) element(21) have value true, Then most probably the value of element 21 is true, since much more matrix’s shows that that element 21 value is true >> >> >> >> Java code will be mostly appreciated >> >> >> >> Best regards/ >> >> >> >> Keivan > > > No, check below: > > matrix 1 > 0 | 1 | 0 > 1 | 1 | 0 > 0 | 0 | 1 > > matrix 2 > 1 | 1 | 1 > 0 | 1 | 0 > 1 | 1 | 1 > > matrix 3 > 0 | 0 | 1 > 0 | 0 | 1 > 1 | 1 | 0 > > > Result will be as below: > example: > consider element (0,0) of matrix's above: > since maximum amount of matrix's(matrix1 and matrix3) says that element(0,0) is false, then I chose false at element (0,0) in result matrix > > consider another element element (2,0) of matrix's above: > since maximum amount of matrixes(matrix2 and matrix3) says that element(2,0) is true, then I chose true at element (2,0) in result matrix > > Here is result matrix: > > 0 | 1 | 1 > 0 | 1 | 0 > 1 | 1 | 1 I see, so you are 'counting' values at a given index and the 'winner' is the one with the most ... I can see an instant optimization. lipska -- Lipska the Kat©: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun
[toc] | [prev] | [next] | [standalone]
| From | Keivan Jafari <keijaf2011@gmail.com> |
|---|---|
| Date | 2013-02-06 08:01 -0800 |
| Message-ID | <880cb6a3-befd-4982-bd2c-4d1f22397471@googlegroups.com> |
| In reply to | #22122 |
Den tisdagen den 5:e februari 2013 kl. 20:19:58 UTC+1 skrev Keivan Jafari: > Hi there, > > > > Is there any way to compare several boolean matrix’s(25 matrix’s) and pick up a final valid matrix of those 25. > > > > The elements in the valid matrix will be, an example: > > > > If matrix M(0) to M(5) element(21) have value false > > > > And if matrix M(6) to M(24) element(21) have value true, Then most probably the value of element 21 is true, since much more matrix’s shows that that element 21 value is true > > > > Java code will be mostly appreciated > > > > Best regards/ > > > > Keivan Yes,there will be always an odd number of input matrix's (25 matrix's)
[toc] | [prev] | [next] | [standalone]
| From | Keivan Jafari <keijaf2011@gmail.com> |
|---|---|
| Date | 2013-02-06 08:20 -0800 |
| Message-ID | <4683b212-bb4f-4219-9df1-93aa08ea73ce@googlegroups.com> |
| In reply to | #22122 |
Den tisdagen den 5:e februari 2013 kl. 20:19:58 UTC+1 skrev Keivan Jafari: > Hi there, > > > > Is there any way to compare several boolean matrix’s(25 matrix’s) and pick up a final valid matrix of those 25. > > > > The elements in the valid matrix will be, an example: > > > > If matrix M(0) to M(5) element(21) have value false > > > > And if matrix M(6) to M(24) element(21) have value true, Then most probably the value of element 21 is true, since much more matrix’s shows that that element 21 value is true > > > > Java code will be mostly appreciated > > > > Best regards/ > > > > Keivan Exactly! Do you know how to put the algorithm in java? I would appreciate java code. Br/ Keivan
[toc] | [prev] | [next] | [standalone]
| From | lipska the kat <"nospam at neversurrender dot co dot uk"> |
|---|---|
| Date | 2013-02-06 16:33 +0000 |
| Message-ID | <X5mdnTgt4t91GI_MnZ2dnUVZ8uKdnZ2d@bt.com> |
| In reply to | #22167 |
On 06/02/13 16:20, Keivan Jafari wrote: > Den tisdagen den 5:e februari 2013 kl. 20:19:58 UTC+1 skrev Keivan Jafari: >> Hi there, >> >> >> >> Is there any way to compare several boolean matrix’s(25 matrix’s) and pick up a final valid matrix of those 25. >> >> >> >> The elements in the valid matrix will be, an example: >> >> >> >> If matrix M(0) to M(5) element(21) have value false >> >> >> >> And if matrix M(6) to M(24) element(21) have value true, Then most probably the value of element 21 is true, since much more matrix’s shows that that element 21 value is true >> >> >> >> Java code will be mostly appreciated >> >> >> >> Best regards/ >> >> >> >> Keivan > > Exactly! > Do you know how to put the algorithm in java? > I would appreciate java code. > > Br/ > Keivan I'm sure I can think of something, I expect others are having a go as well. I don't think I'll be the first to come up with a solution as I'm getting old and slow but I'll have a look at it Is this 'homework' by any chance ? lipska -- Lipska the Kat©: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | comp.lang.java.programmer
csiph-web