Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a 2d normal random function. #5724

merged 2 commits into from Mar 29, 2019


Copy link

@patrick-schultz patrick-schultz commented Mar 28, 2019

No description provided.

The covariance of a 2d normal distribution is a 2x2 symmetric matrix
[[a, b], [b, c]]. This is specified in `cov` as a length 3 array [a, b, c].
The covariance matrix must be positive semi-definite, i.e. a>0, c>0, and
a*d - c^2 > 0.
Copy link

@tpoterba tpoterba Mar 28, 2019


m1 = 0
m2 = 0
m1 = mean[0]
Copy link

@tpoterba tpoterba Mar 28, 2019

we'll need to wrap this in a bind so that we don't evaluate the arguments multiple times.

Something like:

if mean is None:
    mean = [0, 0]
if cov is None:
    cov = [1, 0, 1]

def f(mean, cov):
    m1 = mean[0]

return hl.rbind(mean, cov, f)

@danking danking merged commit e14d169 into hail-is:master Mar 29, 2019
1 check passed
@patrick-schultz patrick-schultz deleted the rand_norm2d branch Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants