deterministic

Why is concurrent haskell non deterministic while parallel haskell primitives (par and pseq) deterministic?

微笑、不失礼 提交于 2019-12-03 15:14:12
问题 Don't quite understand determinism in the context of concurrency and parallelism in Haskell. Some examples would be helpful. Thanks 回答1: When dealing with pure values, the order of evaluation does not matter. That is essentially what parallelism does: Evaluating pure values in parallel. As opposed to pure values, order usually matters for actions with side-effects. Running actions simultaneously is called concurrency . As an example, consider the two actions putStr "foo" and putStr "bar" .

QueryPerformanceCounter and overflows

我怕爱的太早我们不能终老 提交于 2019-12-03 00:39:23
I'm using QueryPerformanceCounter to do some timing in my application. However, after running it for a few days the application seems to stop functioning properly. If I simply restart the application it starts working again. This makes me a believe I have an overflow problem in my timing code. // Author: Ryan M. Geiss // http://www.geisswerks.com/ryan/FAQS/timing.html class timer { public: timer() { QueryPerformanceFrequency(&freq_); QueryPerformanceCounter(&time_); } void tick(double interval) { LARGE_INTEGER t; QueryPerformanceCounter(&t); if (time_.QuadPart != 0) { int ticks_to_wait =

Code for member/2 with some Determinism

扶醉桌前 提交于 2019-12-01 18:37:49
How can I code member/2 that has determinism for the last element. Currently I am using: member(X,[X|_]). member(X,[_|Y]) :- member(X,Y). When I query the following: ?- member(X,[1,2]). X = 1 ; X = 2 ; No The interpreter continues searching after returning 2 since there is still a choice point left. How could I implement member/2 so that this does not happen anymore? But the full semantic of member/2 should be preserved, i.e. answers such as: ?- member(X,Y) Y = [X|_1] ; Y = [_1,X|_2] ; etc.. Should still work as befor. Bye member(B, [C|A]) :- member_(A, B, C). member_(_, A, A). member_([C|A],

“Cannot reproduce” - is Java deterministic multithreading possible?

霸气de小男生 提交于 2019-12-01 17:03:40
问题 Is this possible to run multithreaded Java application in a deterministic fashion? I mean to have always the same thread switching in two different runs of my application. Reason for that is to run simulation in exactly the same conditions in every run. Similar case is when one gives some arbitrary seed when using random number generator to obtain always the same "random" sequence. 回答1: I am not aware of any practical way to do this. In theory, it would be possible to implement a bytecode

Oracle execution plans when using the LIKE operator with a DETERMINISTIC function

前提是你 提交于 2019-12-01 12:18:44
Now I have a really tricky thing with Oracle execution plans running havoc, when I use a DETERMINISTIC function on the right hand side of the LIKE operator. This is my situation: The Situation I thought it to be wise to execute a query like this (simplified): SELECT [...] FROM customers cust JOIN addresses addr ON addr.cust_id = cust.id WHERE special_char_filter(cust.surname) like special_char_filter(?) And I would bind ? to something like 'Eder%' . Now customers and addresses are very large tables. That's why it's important to use indexes. Of course, there is a regular index on addresses.cust

Deterministic function in mysql

我怕爱的太早我们不能终老 提交于 2019-11-30 16:53:22
I got confused with a seemingly simple concept. Mysql defines deterministic function as a function that always produces the same result for the same input parameters So in my understanding, functions like CREATE FUNCTION foo (val INT) READS SQL DATA BEGIN DECLARE retval INT; SET retval = (SELECT COUNT(*) FROM table_1 WHERE field_1 = val); RETURN retval; END; are not deterministic (there is no guarantee that delete/update/insert does not happen between 2 calls to the function). At the same time, I saw many functions which do pretty much the same, i.e. return value based on result of queries,

Prolog: How to tell if a predicate is deterministic or not

为君一笑 提交于 2019-11-30 13:30:50
So from what I understand about deterministic predicates: Deterministic predicate = 1 solution Non-deterministic predicate = multiple solutions Are there any type of rules as to how you can detect if the predicate is one or the other? Like looking at the search tree, etc. There is no clear, generally accepted consensus about these notions. However, they are usually based rather on the observed answers and not based on the number of solutions. In certain contexts the notions are very implementation related. Non-determinate may mean: leaves a choice point open. And sometimes determinate means:

Deterministic RSA encryption in Java

﹥>﹥吖頭↗ 提交于 2019-11-30 02:52:26
This is my first question on this site, and I only have a basic mathematical understanding of RSA, so please bear with me! :) I'm writing a Java web application for my final year project at university. It's a web-based implementation of "Pret-a-voter", a secure voting system, for those who have heard of it. Essentially my problem is that I want to be able to give someone performing the role of an auditor: a source byte array (the plaintext to be encrypted) an RSA public key file a " destination " byte array, which is the result of my own computation of the cipherdata given the plaintext and

What could cause a deterministic process to generate floating point errors

爷,独闯天下 提交于 2019-11-29 04:30:35
Having already read this question I'm reasonably certain that a given process using floating point arithmatic with the same input (on the same hardware, compiled with the same compiler) should be deterministic. I'm looking at a case where this isn't true and trying to determine what could have caused this. I've compiled an executable and I'm feeding it the exact same data, running on a single machine (non-multithreaded) but I'm getting errors of about 3.814697265625e-06 which after careful googling I found is actually equal to 1/4^9 = 1/2^18 = 1/262144. which is pretty close to the precision

Deterministic RSA encryption in Java

喜欢而已 提交于 2019-11-28 23:17:10
问题 This is my first question on this site, and I only have a basic mathematical understanding of RSA, so please bear with me! :) I'm writing a Java web application for my final year project at university. It's a web-based implementation of "Pret-a-voter", a secure voting system, for those who have heard of it. Essentially my problem is that I want to be able to give someone performing the role of an auditor: a source byte array (the plaintext to be encrypted) an RSA public key file a "