Questions tagged [comparison]

Questions about data comparison and efficient ways to accomplish it. Please avoid using this tag for generic (meta) comparison of two issues or concepts.

Questions about data comparison and efficient ways to accomplish it, e.g.: "Which is the fastest algorithm to compare two recordsets and decide which one has more palindromes?", or "What is the fastest way to compare two strings and say if they have more than Y characters in common?"

There are generally six basic "comparison operators": less than, <; less than or equal to, <=; equal to, ==; not equal to, !=; greater than or equal to, >=; and greater than, >.

8118 questions
3
votes
7 answers

Perl, comparing scalar to array (with regex?)

I'll be brief so I don't waste your time; Simple problem, i have an array of say, hundreds of dogs my @dogs = qw(Shepard Lab Dalmation Husky Chow Pitbull ...) and i want to compare it to a single dog my $doggy = "Shepard"; pretty stupid i know,…
user1058357
  • 33
  • 1
  • 3
3
votes
1 answer

how exactly do Javascript numeric comparison operators handle strings?

var i = ['5000','35000']; alert((i[0] < i[1])?'well duh!':'fuzzy math?'); alert((Number(i[0]) < Number(i[1]))?'well duh!':'fuzzy math?'); What's happening here? In the first alert, the text string "5000" evaluates as not less than "35000". I…
Wick
  • 1,222
  • 2
  • 15
  • 21
3
votes
3 answers

MATLAB: words matching between cell arrays of strings

I’m trying to solve the following problem, and I need to do it as efficiently as possible (i.e. trying to avoid loops as much as I can). I have two cell arrays, namely A and B. Each cell of A and B contains a string of characters. The length of…
user1035491
  • 31
  • 1
  • 2
3
votes
2 answers

Comparison of Entity Framework compatible providers for Oracle?

I have read similar questions and their answers, however, it seems none deal with this exact question except for one, which is out of date (from 2009 - pre EF4). Does anyone have any positive or negative experience with EF providers for Oracle, if…
3
votes
4 answers

How can I compare 3 files together (to see what is in common between them)?

I want to compare 3 files together to see how much of the information in the files are the same. The file format is something like this: Chr11 447 . A C 74 . DP=22;AF1=1;CI95=1,1;DP4=0,0,9,8;MQ=15;FQ=-78 GT:PL:GQ…
mahmood
  • 1,203
  • 5
  • 16
  • 27
3
votes
2 answers

fast data comparison in python

I want to compare a large set of data in the form of 2 dictionaries of varying lengths. (edit) post = {0: [0.96180319786071777, 0.37529754638671875], 10: [0.20612385869026184, 0.17849941551685333], 20: [0.20612400770187378,…
sbetharia
  • 363
  • 3
  • 7
3
votes
2 answers

Equality test of images using ImageMagick

Is there any equality predicate function in ImageMagick library? I want to compare two images and find whether they are the exactly same (all colors of the pixels are the same) or have any differences. I’ve looked around, but it seems not to have a…
minhee
  • 5,688
  • 5
  • 43
  • 81
3
votes
1 answer

Parser implementations comparison: correctness confirmation and (perhaps) optimization

I've implemented two expression parsers, in recursive descent and operator precedence. They're implemented in Object Pascal. Here's the recursive descent: function ParseFactor: PNode; var Temp: PNode; begin Result := ParsePrimary; if t.Kind in…
LeleDumbo
  • 9,192
  • 4
  • 24
  • 38
3
votes
5 answers

Ruby: How does one test for similarity between two blocks of text?

So, lets say I have these texts: Text1: absolute obedience to the zerg collective sentience known as the Overmind. The Overmind directed the actions of every zerg creature in the Swarm, functioning through a hierarchy of lesser sentients.…
NullVoxPopuli
  • 61,906
  • 73
  • 206
  • 352
3
votes
2 answers

Compare two interfaces using "is"

I am not sure if I am missing something here. I would like to compare two classes that uses the same interface. Is this possible? I understand that the is operator compares classes, but is there any similar function when you use interfaces? //…
Mattias
  • 3,907
  • 4
  • 28
  • 50
3
votes
4 answers

python - condensing comparisons

I'm a new member here and also new to python. My question is as follows, is it valid to have a line like this? if x or y is 'whatever': I tested this in the interpreter and am getting inconsistent results. It would seem that this line yields more…
thinc
  • 33
  • 3
3
votes
2 answers

Stumped: Javascript Comparison Error

I'm writing a plotting/graphing library for Javascript and came across what seems to be a huge issue. I have 4 number inputs for defining the minimum and maximum values that the graph will display, much like on a TI-84 graphing calculator: XMin,…
mdcio
  • 78
  • 6
3
votes
1 answer

NSNumber comparison with < (less) operator instead of compare

some days ago I've read a post written by another user regarding comparisons between NSNumber objects using the < (less) operator.. He was getting wrong results and people told him that it was comparing the addresses of the NSNumber objects instead…
Gianni Costanzi
  • 6,054
  • 11
  • 48
  • 74
3
votes
1 answer

Enhanced likelihood ratio for comparison of models obtained with the lm() function

I am looking for a function in R to compare models created with the lm() function, with the following statistics: Models df AIC BIC logLik Test L.ratio p.value 1 model1 6 161.65 170.44 -74.83 2 model2 8 159.39…
3
votes
2 answers

How to compare 2 Ordered Dictionaries and create a new Ordered one with differences? (Python 3.7)

I'm struggling on how to generate a "Differences" Ordered-Dictionary containing the Different and also New values appearing on a "Modified" Ordered-Dictionary after comparing with a "Reference" Ordered-Dictionary. EXAMPLE: #python from collections…