comparison

Video-codec rater by image comparison algorithm?

…衆ロ難τιáo~ 提交于 2019-12-13 00:08:51
问题 perhaps anyone knows if this is possible. comparing image quality is almost imposible to describe without subjective influences. When someone rates an image quality as good there is at least one person, that doesn't think so. human preferences are always different. So, I would like to know if there is away to "rate" the image quality by an algorithm that compares the original image to the produced one in following issues colour change(difference pixel by pixel blur rate artifacts and

Converting letters using a dictionary

梦想与她 提交于 2019-12-12 22:07:52
问题 I'm trying to write a program that converts letters matching a key in a dictionary to the value associated with that key e.g. if the dictionary is {'A':'T', 'C':'G', 'T':'A', 'G':'C'} and the string is 'AAG' the output should be 'TTC'. EDIT: This is what I've got now thanks to some of your answers: def matching_codons(complements, poolA): answer = [] codon = '' counter = 0 for i in poolA: for a in i: codon+= complements[a] counter += 1 if counter == 3: answer.append(codon) Unfortunately this

Efficient pairwise comparisons - rows of Numpy 2D array

喜夏-厌秋 提交于 2019-12-12 19:08:40
问题 I would like to compare each row of a Numpy 2D array with all other rows and get an output of a binary matrix, that indicates the non-matching features of each pair of rows. Perhaps, for an input: index col1 col2 col3 col4 0 2 1 3 3 1 2 3 3 4 2 4 1 3 2 I would like to get the following output: index col1 col2 col3 col4 i j 0 0 1 0 1 0 1 1 1 0 0 1 0 2 2 1 1 0 1 1 2 As 'i' and 'j' hold the original indexes of the compared rows What is the most efficient way to implement this? My current

Why does PHP appear to evaluate this condition incorrectly?

两盒软妹~` 提交于 2019-12-12 18:34:28
问题 I have the following code in PHP, where I've attempted to overcome the stated issue by type-casting the variables into Integers and also avoiding floating-point errors by multiplying all values by 100 before comparison in order remove the 2 decimal places. However, the following code still evaluates the expression to true and colours the text in red instead of green but when I echo the two values of $eq_left and $eq_right, they are identical with no decimal point. Here's the code: $eq_left =

Comparing values longitudinally in R… with a twist

两盒软妹~` 提交于 2019-12-12 18:05:44
问题 I have the results of a test taken by a number of individuals at as many as four time periods. Here's a sample: dat <- structure(list(Participant_ID = c("A", "A", "A", "A", "B", "B", "B", "B", "C", "C", "C", "C"), phase = structure(c(1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L), .Label = c("base", "sixmos", "twelvemos", "eighteenmos"), class = "factor"), result = c("Negative", "Negative", "Negative", "Negative", "Negative", "Positive", "Negative", NA, "Positive", "Indeterminate", "Negative

Wrong output for integer comparison values

馋奶兔 提交于 2019-12-12 17:14:26
问题 I have the following code. public static void doIntCompareProcess() { int a = 100; int b = 100; Integer c = 200; Integer d = 200; int f = 20000; int e = 20000; System.out.println(c == d); compareInt(e, f); compareInt(a, b); } public static void compareInt(Integer v1, Integer v2) { System.out.println(v1 == v2); } That gives me this output: false false true Where the currect output should be: false false false Why am I getting the wrong output for the code? 回答1: The last line corresponds to:

Check whether two lists have at least one common item

梦想与她 提交于 2019-12-12 16:52:31
问题 If there are two lists: Dim list1 As New List(Of Integer) list1.AddRange({1, 2, 3}) Dim list2 As New List(Of Integer) list2.AddRange({1, 4, 5}) What is the best way in VB.NET, in terms of performance, to detect whether they have one or more common items? As much as possible this should be generic. 回答1: <System.Runtime.CompilerServices.Extension()> _ Function ContainsAny(Of T)(col1 As IEnumerable(Of T), col2 As IEnumerable(Of T)) As Boolean ' performance checks If col1 Is Nothing OrElse col2

Comparing a Substring to a string in Java

旧街凉风 提交于 2019-12-12 16:12:50
问题 so basically, a user inputs 2 strings ( CATSATONTHEMAT AT ) and we need to count how many time the second string appears in the first string ( so the answer here is 3 ) this is what I have so far, and it keeps saying "Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 81223 at java.lang.String.substring(Unknown Source) at practice.main(practice.java:60)" any help would be appreciated! I just can't see to find where I went wrong String s = scan

SQL Server - Compare 2 tables for data in the same columns without checking for equality

雨燕双飞 提交于 2019-12-12 13:08:12
问题 I asked this question before here, but the answer actually wasn't what I was looking for. Suppose I have the following two tables in my SQL Server (2012) DB: Tbl1: ID: Col1: Col2: Col3: 1 Val11 Val21 Val31 2 <NULL> Val21 <NULL> 3 Val11 <NULL> Val31 4 Val11 <NULL> Val31 Tbl2: ID: Col1: Col2: Col3: 1 Val12 Val22 Val32 2 <NULL> Val22 <NULL> 3 <NULL> <NULL> Val32 5 <NULL> <NULL> Val32 And, at this point, all I want to see is: Any rows that are in one table but not the other (based on ID pk) If

How can I build if sentence with compare to various values?

十年热恋 提交于 2019-12-12 11:46:48
问题 How can i write this if statement condition in better way? if ((data_in(8 downto 1)=x"70") or (data_in(8 downto 1)=x"69") or (data_in(8 downto 1)=x"72") or (data_in(8 downto 1)=x"7A") or (data_in(8 downto 1)=x"6B") or (data_in(8 downto 1)=x"73") or (data_in(8 downto 1)=x"74") or (data_in(8 downto 1)=x"6C") or (data_in(8 downto 1)=x"75") or (data_in(8 downto 1)=x"7D")) then data_make_code <= data_in (8 downto 1); -- enter key to buffer wrong_data <='0'; cnt_bit :=0; -- if valid key then