QuantEcon/QuantEcon.jl

random_stochastic_matrix and random_markov_chain support sparse output

Closed

#102 opened on Mar 17, 2016

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Julia (300 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (495 stars)
PR merge metrics
 (Avg merge 1d 1h) (2 merged PRs in 30d)

Description

This might look like this:

random_markov_chain{T}(n::Int, k::Int=n, ::Type{Matrix{T}})  # ==> return dense array
random_markov_chain{T}(n::Int, k::Int=n, ::Type{SparseMatrixCSC{Int,T}})  # ==> return sparse array

Also, having Union{Int,Void} shouldn't be necessary here as it is in python because default arguments can depend on one another. (e.g. def f(n, k=n): is n't possible in python but function f(n, k=n) is possible in Julia)

Contributor guide