[Solved] loop unrolling not giving expected speedup for floating-point dot product

Your unroll doesn’t help with the FP latency bottleneck: sum + x + y + z without -ffast-math is the same order of operations as sum += x; sum += y; … so you haven’t done anything about the single dependency chain running through all the + operations. Loop overhead (or front-end throughput) is not … Read more

[Solved] Sort mixed text lines (alphanum) in Perl

The Schwartzian Transform as suggested in Toto’s answer is probably the fastest way to sort your lines here. But you said you’re a Perl newbie, and I like to show how the lines can be sorted traditionally. Perl has a sort function that sorts a list simply by alphabet. But you can supply a custom … Read more

[Solved] How to search a webpage with keywords from a .txt list? [closed]

Assuming that the .txt file contains one word per line, here is a simple solution: string[] keywords = System.IO.File.ReadAllLines(@”C:\Temp\keywords.txt”); List<string> nomatch = new List<string>(); System.Net.WebClient wc = new System.Net.WebClient(); foreach (string word in keywords) { string response = wc.DownloadString(“http://www.website.com/search.php?word=” + word); if (response != null && response.Contains(“No matches found”)) nomatch.Add(word); } if (nomatch.Count > 0) … Read more

[Solved] Convert .5 into 1/2

PHP code demo(In HTML it will work fine) <?php $number=”10.5000″; if(preg_match(“/^[1-9][0-9]*\.5[0]{0,}$/”, $number)) { echo $used = preg_replace(“/\.5[0]{0,}$/”, “&frac12;”, $number); } elseif(preg_match(“/^[0]*\.5[0]{0,}$/”, $number)) { echo $used = str_replace(“$number”, “&frac12;”, $number); } else { echo $number; } Output: 10½ 14 solved Convert .5 into 1/2

[Solved] Optimal Algorithm [closed]

Just ask any one of them the following question: If you were the opposite to what you are going to be when you answer this question, which would be the right way to go? If he’s the indecisive type in lying mode, he’ll have to tell you to go the wrong way because, as a … Read more

[Solved] What are the techniques of Compression? [closed]

Maybe the simplest lossless one is Run-length encoding the string: WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW will be encoded to: 12W1B12W3B24W1B14W or: WW12BWW12BB3WW24BWW14 And the simplest lossy encoding algorithm would be something like: down-sampling, or averaging over 3 neighbors cells of a vector and keep the average value. 1 solved What are the techniques of Compression? [closed]

[Solved] computing hashValue of a file

The problem is you declare resultstream as CHAR resultstream[33]; but then you use in your code resultstream[33] = ‘\0’; The resultstream array is 0 indexed so valid values are 0-32, you are accessing memory not allocated for that array (hence the “Access violation”) 0 solved computing hashValue of a file