{"action":"created","issue":{"url":"https://api.github.com/repos/firedrakeproject/firedrake/issues/867","repository_url":"https://api.github.com/repos/firedrakeproject/firedrake","labels_url":"https://api.github.com/repos/firedrakeproject/firedrake/issues/867/labels{/name}","comments_url":"https://api.github.com/repos/firedrakeproject/firedrake/issues/867/comments","events_url":"https://api.github.com/repos/firedrakeproject/firedrake/issues/867/events","html_url":"https://github.com/firedrakeproject/firedrake/issues/867","id":173253186,"number":867,"title":"Random variables in interpolation","user":{"login":"colinjcotter","id":6105842,"avatar_url":"https://avatars.githubusercontent.com/u/6105842?v=3","gravatar_id":"","url":"https://api.github.com/users/colinjcotter","html_url":"https://github.com/colinjcotter","followers_url":"https://api.github.com/users/colinjcotter/followers","following_url":"https://api.github.com/users/colinjcotter/following{/other_user}","gists_url":"https://api.github.com/users/colinjcotter/gists{/gist_id}","starred_url":"https://api.github.com/users/colinjcotter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colinjcotter/subscriptions","organizations_url":"https://api.github.com/users/colinjcotter/orgs","repos_url":"https://api.github.com/users/colinjcotter/repos","events_url":"https://api.github.com/users/colinjcotter/events{/privacy}","received_events_url":"https://api.github.com/users/colinjcotter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-25T16:41:18Z","updated_at":"2016-08-26T08:56:20Z","closed_at":null,"body":"I would like to have a UFL symbol for a random variable, say randn, such that when I interpolate a UFL expression to a function, randn gets replaced with iid N(0,1) random numbers for each basis function coefficient. E.g.,\r\n\r\nu.interpolate(sin(x[0]) + 0.01*randn)"},"comment":{"url":"https://api.github.com/repos/firedrakeproject/firedrake/issues/comments/242671766","html_url":"https://github.com/firedrakeproject/firedrake/issues/867#issuecomment-242671766","issue_url":"https://api.github.com/repos/firedrakeproject/firedrake/issues/867","id":242671766,"user":{"login":"colinjcotter","id":6105842,"avatar_url":"https://avatars.githubusercontent.com/u/6105842?v=3","gravatar_id":"","url":"https://api.github.com/users/colinjcotter","html_url":"https://github.com/colinjcotter","followers_url":"https://api.github.com/users/colinjcotter/followers","following_url":"https://api.github.com/users/colinjcotter/following{/other_user}","gists_url":"https://api.github.com/users/colinjcotter/gists{/gist_id}","starred_url":"https://api.github.com/users/colinjcotter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colinjcotter/subscriptions","organizations_url":"https://api.github.com/users/colinjcotter/orgs","repos_url":"https://api.github.com/users/colinjcotter/repos","events_url":"https://api.github.com/users/colinjcotter/events{/privacy}","received_events_url":"https://api.github.com/users/colinjcotter/received_events","type":"User","site_admin":false},"created_at":"2016-08-26T08:56:20Z","updated_at":"2016-08-26T08:56:20Z","body":"Just interpolation initially. The main advantage would be that we could\nincorporate random variables into nonlinear functions etc.\n\nWe could just have a convenience function that uses a parloop to put random\nnumbers into basis coefficients, and then use that function in UFL\nexpressions. This doesn't address the questions you wrote about parallel\nand reproducibility.\n\n--cjc\n\nOn 26 August 2016 at 09:39, Lawrence Mitchell <notifications@github.com>\nwrote:\n\n> We need to think about this carefully. Generating the appropriate code is\n> not difficult, the semantics need to be correct.\n>\n> Where do you want to be able to use this. Just in interpolation? If so, I\n> would rather you just go ahead and write either a par_loop to do this, or\n> else just write to the data array directly.\n>\n> If you'd like random variables in forms what does that mean? Let's say we\n> write:\n>\n> class Random(ufl.Expr):\n>     def __init__(self, seed=None):\n>         super(Random, self).__init__()\n>         self.ufl_shape = ()\n>         self.seed = seed\n> class Normal(Random):\n>     def __init__(self, mean, variance, seed=None):\n>        super(Normal, self).__init__(seed=seed)\n>        self.mean = mean\n>        self.variance = variance\n>\n> Now we do:\n>\n> # Scalar drawn from normal distribution\n> randn = Normal(0, 1)\n> V = FunctionSpace(mesh, ...)\n> u = TrialFunction(V)\n> v = TestFunction(V)\n> a = randn*u*v*dx\n>\n> What does this do? Do I make u*v*dx on each element and then hit each\n> entry of the element tensor with a random normal deviate? Do I make u*v*dx\n> globally and hit each entry of the global matrix with a random normal\n> deviate? Do I evaluate each deviate at the quad points and just incorporate\n> it into normal integration matrix? So changing the quadrature degree\n> changes the randomness.\n>\n> What about in parallel? Do you need statistically independent variables on\n> each process? Do they just need to be \"a bit different\"?\n>\n> What about reproducibility. How do you seed the random number generator.\n> Again, how does this commute with parallel execution?\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/firedrakeproject/firedrake/issues/867#issuecomment-242667927>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AF0q8sY1oO4SnROu0YSRGov1NXiu3OTuks5qjqYtgaJpZM4JtRT4>\n> .\n>\n\n\n\n-- \nhttp://www.imperial.ac.uk/people/colin.cotter\n\nwww.cambridge.org/9781107663916\n"}}
{"actor":{"display_login":"colinjcotter"}}