Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > compare several boolean matrix’s

Reply
Thread Tools

compare several boolean matrix’s

 
 
Keivan Jafari
Guest
Posts: n/a
 
      02-06-2013
Den onsdagen den 6:e februari 2013 kl. 18:29:39 UTC+1 skrev Lars Enderin:
> 2013-02-06 18:14, Keivan Jafari skrev:
>
> > sorry! I'm new.

>
> > My reply was for lipska the kat

>
> >

>
>
>
> I see that you are new (and that you probably are posting from Sweden,
>
> like me). You did reply to me correctly, so you do know how to do it. It
>
> helps to keep message threads consistent. A traditional news client may
>
> have a little trouble otherwise.
>
>
>
> --
>
> Lars Enderin

Ok!
Now, I go to the match between Argantina and Sweden.
 
Reply With Quote
 
 
 
 
Lars Enderin
Guest
Posts: n/a
 
      02-06-2013
2013-02-06 19:18, lipska the kat skrev:
> On 06/02/13 17:29, Keivan Jafari wrote:
>> Den onsdagen den 6:e februari 2013 kl. 18:19:58 UTC+1 skrev lipska the
>> kat:
>>> On 06/02/13 16:42, Keivan Jafari wrote:

>
> [snip]
>
>> I'm too old and busy!
>> Please stick to the problem, take it as a challenge!

>
> What is it with you Scandinavian types ?
>


I warned him privately about your possible reaction.
Keivan's name is not Scandinavian, although he lives near Stockholm. I
have no idea how long he's been living in Sweden, maybe his whole life,
but his roots are probably somewhere in the Middle East.

--
Lars Enderin
 
Reply With Quote
 
 
 
 
T®oll
Guest
Posts: n/a
 
      02-06-2013
lipska the kat <"nospam at neversurrender dot co dot uk">
blew smoke:
/clipT
>You warned him did you ... oh dear, my reputation precedes me
>

you betcha sweet bippy it does, asshole.

>Thank you (I think).
>

be sure;
http://preview.tinyurl.com/b3ygsjt
or wrapped URL
http://groups.google.com/groups/sear...ok+twisted&as_
epq=&as_oq=&as_eq=&num=100&scoring=&lr=&as_sitesea rch=&as_qdr=&as_mind
=1&as_minm=1&as_miny=2013&as_maxd=1&as_maxm=1&as_m axy=2013&as_
ugroup=&as_usubject=&as_uauthors=&safe=off

>lips stuck to Lews ass

sig corrected for all to know, lamer.

 
Reply With Quote
 
Keivan Jafari
Guest
Posts: n/a
 
      02-08-2013
Den onsdagen den 6:e februari 2013 kl. 19:18:04 UTC+1 skrev lipska the kat:
> On 06/02/13 17:29, Keivan Jafari wrote:
>
> > Den onsdagen den 6:e februari 2013 kl. 18:19:58 UTC+1 skrev lipska the kat:

>
> >> On 06/02/13 16:42, Keivan Jafari wrote:

>
>
>
> [snip]
>
>
>
> > I'm too old and busy!

>
> > Please stick to the problem, take it as a challenge!

>
>
>
> What is it with you Scandinavian types ?
>
>
>
> I'll give you the benefit of the doubt this one time only.
>
>
>
> http://pastebin.com/iNpSxjJd
>
>
>
> This is a starting point only. There is no error handling
>
> minimal comments and lots of assumptions made.
>
>
>
> Eric Sosman also gave you an outline solution upthread.
>
>
>
> I have provided you with a simple working solution that you can build
>
> upon. The result matrix is filled with the '1 counts' at each position
>
>
>
> The rest is up to you.
>
>
>
> lipska
>
>
>
> --
>
> Lipska the Kat�: Troll hunter, sandbox destroyer
>
> and farscape dreamer of Aeryn Sun

Tanks man!
I'm trying to create new revolutionary android application allots things tothink about.
I will remember your help.
Sometimes you have so little time!

Br/
Keivan

 
Reply With Quote
 
Keivan Jafari
Guest
Posts: n/a
 
      02-08-2013
Den fredagen den 8:e februari 2013 kl. 20:21:39 UTC+1 skrev Keivan Jafari:
> Den onsdagen den 6:e februari 2013 kl. 19:18:04 UTC+1 skrev lipska the kat:
>
> > On 06/02/13 17:29, Keivan Jafari wrote:

>
> >

>
> > > Den onsdagen den 6:e februari 2013 kl. 18:19:58 UTC+1 skrev lipska the kat:

>
> >

>
> > >> On 06/02/13 16:42, Keivan Jafari wrote:

>
> >

>
> >

>
> >

>
> > [snip]

>
> >

>
> >

>
> >

>
> > > I'm too old and busy!

>
> >

>
> > > Please stick to the problem, take it as a challenge!

>
> >

>
> >

>
> >

>
> > What is it with you Scandinavian types ?

>
> >

>
> >

>
> >

>
> > I'll give you the benefit of the doubt this one time only.

>
> >

>
> >

>
> >

>
> > http://pastebin.com/iNpSxjJd

>
> >

>
> >

>
> >

>
> > This is a starting point only. There is no error handling

>
> >

>
> > minimal comments and lots of assumptions made.

>
> >

>
> >

>
> >

>
> > Eric Sosman also gave you an outline solution upthread.

>
> >

>
> >

>
> >

>
> > I have provided you with a simple working solution that you can build

>
> >

>
> > upon. The result matrix is filled with the '1 counts' at each position

>
> >

>
> >

>
> >

>
> > The rest is up to you.

>
> >

>
> >

>
> >

>
> > lipska

>
> >

>
> >

>
> >

>
> > --

>
> >

>
> > Lipska the Kat�: Troll hunter, sandbox destroyer

>
> >

>
> > and farscape dreamer of Aeryn Sun

>
> Tanks man!
>
> I'm trying to create new revolutionary android application allots things to think about.
>
> I will remember your help.
>
> Sometimes you have so little time!
>
>
>
> Br/
>
> Keivan


got the help! tanks alots to "lipska the kat"
 
Reply With Quote
 
Keivan Jafari
Guest
Posts: n/a
 
      02-08-2013
Den fredagen den 8:e februari 2013 kl. 20:49:01 UTC+1 skrev lipska the kat:
> On 08/02/13 19:31, Keivan Jafari wrote:
>
> > Den fredagen den 8:e februari 2013 kl. 20:21:39 UTC+1 skrev Keivan Jafari:

>
> >> Den onsdagen den 6:e februari 2013 kl. 19:18:04 UTC+1 skrev lipska thekat:

>
> >>

>
> >>> On 06/02/13 17:29, Keivan Jafari wrote:

>
>
>
> [snip]
>
>
>
> >>

>
> >> Sometimes you have so little time!

>
>
>
> Indeed
>
>
>
> Because you bothered to respond here's one that works with boolean values
>
>
>
> http://pastebin.com/ay5hCBuZ
>
>
>
> lipska
>
>
>
> --
>
> Lipska the Kat©: Troll hunter, sandbox destroyer
>
> and farscape dreamer of Aeryn Sun


I take my hatt for you "lipska"
this is my last post.
 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      02-08-2013
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


 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      02-08-2013
On 2/8/2013 2:21 PM, Keivan Jafari wrote:
> I'm trying to create new revolutionary android application allots things to think about.


> Sometimes you have so little time!


A revolutionary application and you are stuck in for loops??

Arne


 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      02-09-2013
On 2/8/2013 2:49 PM, lipska the kat wrote:
> On 08/02/13 19:31, Keivan Jafari wrote:
>> Den fredagen den 8:e februari 2013 kl. 20:21:39 UTC+1 skrev Keivan
>> Jafari:
>>> Den onsdagen den 6:e februari 2013 kl. 19:18:04 UTC+1 skrev lipska
>>> the kat:
>>>
>>>> On 06/02/13 17:29, Keivan Jafari wrote:

>
> [snip]
>
>>>
>>> Sometimes you have so little time!

>
> Indeed
>
> Because you bothered to respond here's one that works with boolean values
>
> http://pastebin.com/ay5hCBuZ


The code is not too big to post here.

Arne

 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      02-09-2013
On 2/8/2013 11:30 PM, Arne Vajhøj wrote:
> On 2/8/2013 2:49 PM, lipska the kat wrote:
>> On 08/02/13 19:31, Keivan Jafari wrote:
>>> Den fredagen den 8:e februari 2013 kl. 20:21:39 UTC+1 skrev Keivan
>>> Jafari:
>>>> Den onsdagen den 6:e februari 2013 kl. 19:18:04 UTC+1 skrev lipska
>>>> the kat:
>>>>
>>>>> On 06/02/13 17:29, Keivan Jafari wrote:

>>
>> [snip]
>>
>>>>
>>>> Sometimes you have so little time!

>>
>> Indeed
>>
>> Because you bothered to respond here's one that works with boolean values
>>
>> http://pastebin.com/ay5hCBuZ

>
> The code is not too big to post here.


And the code is OK.

I would have done a few things differently, but ...

Arne

====

public class MatrixSummarize {
public static boolean[][] summarize(boolean[][][] matrices) {
assert matrices.length % 2 == 1 : "Number of matrices must be odd";
int majority = (matrices.length + 1) / 2;
boolean[][] result = new
boolean[matrices[0].length][matrices[0][0].length];
for(int i = 0; i < result.length; i++) {
for(int j = 0; j < result[i].length; j++) {
int ntrue = 0;
for(int k = 0; k < matrices.length; k++) {
if(matrices[k][i][j]) ntrue++;
if(ntrue >= majority) {
result[i][j] = true;
break;
} else if(k + 1 - ntrue >= majority) {
break;
}
}
}
}
return result;
}
public static void print(boolean[][] result) {
for(int i = 0; i < result.length; i++) {
for(int j = 0; j < result[i].length; j++) {
System.out.printf(" %-5b", result[i][j]);
}
System.out.println();
}
}
public static void main(String[] args){
boolean [][] matrix1 = {
{ true, true, false },
{ true, false, true },
{false, true, false }
};
boolean [][] matrix2 = {
{ false, true, false },
{ true, false, false },
{ false, true, false }
};
boolean [][] matrix3 = {
{ true, false, true },
{ true, false, false },
{ false, true, false }
};
boolean[][][] matrices = { matrix1, matrix2, matrix3 };
boolean[][] result = summarize(matrices);
print(result);
}
}


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtle difference between boolean value and boolean comparison? Metre Meter Javascript 7 08-06-2010 08:40 PM
difference between 'boolean' and 'java.lang.Boolean' J Leonard Java 4 01-19-2008 02:56 AM
RDOC: several related modules in several C files Victor \Zverok\ Shepelev Ruby 3 03-16-2007 04:15 PM
boolean to std_logic valentin tihomirov VHDL 3 01-05-2004 04:48 PM
Re: boolean to std_logic David R Brooks VHDL 0 12-31-2003 11:13 PM



Advertisments