Skip to content

Add a 2d normal random function.#5724

Merged
danking merged 2 commits intohail-is:masterfrom
patrick-schultz:rand_norm2d
Mar 29, 2019
Merged

Add a 2d normal random function.#5724
danking merged 2 commits intohail-is:masterfrom
patrick-schultz:rand_norm2d

Conversation

@patrick-schultz
Copy link
Copy Markdown
Member

No description provided.

Comment thread hail/python/hail/expr/functions.py Outdated
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a*b?

m1 = 0
m2 = 0
else:
m1 = mean[0]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@patrick-schultz patrick-schultz deleted the rand_norm2d branch September 17, 2019 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants