{"action":"created","issue":{"url":"https://api.github.com/repos/quantumlib/Cirq/issues/871","repository_url":"https://api.github.com/repos/quantumlib/Cirq","labels_url":"https://api.github.com/repos/quantumlib/Cirq/issues/871/labels{/name}","comments_url":"https://api.github.com/repos/quantumlib/Cirq/issues/871/comments","events_url":"https://api.github.com/repos/quantumlib/Cirq/issues/871/events","html_url":"https://github.com/quantumlib/Cirq/issues/871","id":352710713,"node_id":"MDU6SXNzdWUzNTI3MTA3MTM=","number":871,"title":"simulator should allow configuration of floating point precision","user":{"login":"babbush","id":14242687,"node_id":"MDQ6VXNlcjE0MjQyNjg3","avatar_url":"https://avatars2.githubusercontent.com/u/14242687?v=4","gravatar_id":"","url":"https://api.github.com/users/babbush","html_url":"https://github.com/babbush","followers_url":"https://api.github.com/users/babbush/followers","following_url":"https://api.github.com/users/babbush/following{/other_user}","gists_url":"https://api.github.com/users/babbush/gists{/gist_id}","starred_url":"https://api.github.com/users/babbush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babbush/subscriptions","organizations_url":"https://api.github.com/users/babbush/orgs","repos_url":"https://api.github.com/users/babbush/repos","events_url":"https://api.github.com/users/babbush/events{/privacy}","received_events_url":"https://api.github.com/users/babbush/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-08-21T21:07:38Z","updated_at":"2018-08-21T23:51:26Z","closed_at":null,"author_association":"COLLABORATOR","body":"I'm running some simulations now that involve simulating feedback. I need to do this in a hacky way that involves running a circuit which involves a measurement, getting the output state, and reinitializing the system register again and continuing. If I do enough iterations I eventually get the error \"ValueError: State is not normalized instead had norm 1.0000141\". This is definitely due to the single precision simulator.\r\n\r\nBut more generally the single precision is frustrating because numpy defaults to double precision arrays. So whenever I feed the simulator an initial state I need to manually write \".astype(numpy.complex64)\". This is showing up all over my code. Furthermore, I find it a bit annoying to see normalizations and expectation values that are things like 1.00000006 instead of just \"1\".\r\n\r\nIn short, single precision is just not what users expect, and I think it makes the experience worse. I imagine this is a fairly straightforward fix."},"comment":{"url":"https://api.github.com/repos/quantumlib/Cirq/issues/comments/414858817","html_url":"https://github.com/quantumlib/Cirq/issues/871#issuecomment-414858817","issue_url":"https://api.github.com/repos/quantumlib/Cirq/issues/871","id":414858817,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDg1ODgxNw==","user":{"login":"babbush","id":14242687,"node_id":"MDQ6VXNlcjE0MjQyNjg3","avatar_url":"https://avatars2.githubusercontent.com/u/14242687?v=4","gravatar_id":"","url":"https://api.github.com/users/babbush","html_url":"https://github.com/babbush","followers_url":"https://api.github.com/users/babbush/followers","following_url":"https://api.github.com/users/babbush/following{/other_user}","gists_url":"https://api.github.com/users/babbush/gists{/gist_id}","starred_url":"https://api.github.com/users/babbush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babbush/subscriptions","organizations_url":"https://api.github.com/users/babbush/orgs","repos_url":"https://api.github.com/users/babbush/repos","events_url":"https://api.github.com/users/babbush/events{/privacy}","received_events_url":"https://api.github.com/users/babbush/received_events","type":"User","site_admin":false},"created_at":"2018-08-21T23:51:26Z","updated_at":"2018-08-21T23:51:26Z","author_association":"COLLABORATOR","body":"@Strilanc myself, Jarrod and Ian are using Cirq for research and we've been discussing these things frequently. I think we're a typical user group. I'm opening these issues in response to frustration that I encounter while using the package. However, in the future I'll be careful to explain that this is my opinion.\r\n\r\nDoes using double precision really slow the code down by a factor of two? I would find that surprising. You're not dealing with vectorized instruction sets or anything, right? What are you doing that goes twice slow with double precision?\r\n\r\nBut in any event, you know what you're doing a lot better than me. Assuming that this would really slow things down by a factor of two, then I am in favor of not requiring safe casting. And if that is the case I don't even think it is necessary to add the option to use double precision."}}
{"actor":{"display_login":"babbush"}}