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

Make TracyWidom order a type parameter? #54

Closed
dahong67 opened this issue Apr 20, 2020 · 5 comments · Fixed by #55
Closed

Make TracyWidom order a type parameter? #54

dahong67 opened this issue Apr 20, 2020 · 5 comments · Fixed by #55

Comments

@dahong67
Copy link
Contributor

Hi! Thanks all for this nice package, I'm quite happily using it to evaluate the Tracy-Widom law of order 1. :)

I was wondering if it might make sense to make TracyWidom a parametric type with the order/index beta as the parameter, i.e., replace

struct TracyWidom <: ContinuousUnivariateDistribution end

with

struct TracyWidom{β} <: ContinuousUnivariateDistribution end

This seems conceptually nice, and (as far as I could tell) would also simplify some of the code by replacing if/else statements in the current code with dispatch (e.g., https://github.com/JuliaMath/RandomMatrices.jl/blob/master/src/densities/TracyWidom.jl#L63-L77).

If interested, I'd be happy to try it out in a pull request!

@dlfivefifty
Copy link
Member

Why in the type? Alternatively we can do

struct TracyWidom{T} <: ContinuousUnivariateDistribution
    β::T
end

A good reason to prefer this is to support BigFloat.

@dlfivefifty
Copy link
Member

If interested, I'd be happy to try it out in a pull request!

Yes please!

@dahong67
Copy link
Contributor Author

Great! I'll get started on one. :)

Making β a field rather than type parameter is an interesting idea, and supporting BigFloat is a neat point! On a related note, I'm (personally) only familiar with Tracy-Widom for β = 1,2,4. Do you have a reference you'd recommend for other β's being used?

One advantage of putting β in the type is that we could then dispatch on it.

@dlfivefifty
Copy link
Member

Dumitriu and Edelman have a lot of papers on general β. The easiest construction is via a tridiagonal matrix with χ distributed off diagonal entries

I can’t see why one would need dispatch, an if statement will be just as convenient

@dahong67
Copy link
Contributor Author

Ah right, thanks so much for the pointer! I also thought some more and agree with you that there is not really a need for dispatch here.

I'll start the pull request once I get some free time - hopefully this weekend!

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 a pull request may close this issue.

2 participants