JuliaLinearAlgebra / MatrixDepot.jl

An Extensible Test Matrix Collection for Julia
http://matrixdepotjl.readthedocs.org/
Other
75 stars 22 forks source link

Random matrices for testing purposes #5

Closed mschauer closed 9 years ago

mschauer commented 9 years ago

Hi weijian, I have this old file https://github.com/mschauer/SDE.jl/blob/v3/src/Randm.jl with which generates random symmetric, positive definite, stable, normal, orthogonal and unitary matrices for testing purposes. Maybe you are interested, or I can make a pull request, if you wish.

weijianzhg commented 9 years ago

Hello @mschauer,

Thanks a lot for this. It would be useful to include these in Matrix Depot.

Rather than including 6 separate functions, I am thinking of designing a "generic function" for all the matrices in your collection. Maybe called rand ?

It looks like

function rand{T}(::Type{T}, n::Int, mode::Int)
# the implementations
end

Then for example mode = 1 will give you randsym, mode = 2 will give you randposdef, etc. User can use it as

matrixdepot("rand", 6, 1)

It would be great if you want implement this and I am happy to merge it.

Thanks,

Weijian

weijianzhg commented 9 years ago

cc @higham

mschauer commented 9 years ago

I hope you don't mind, but I don't think this should be a single function, a function should not sometimes return a symmetric matrix and sometimes a non symmetric matrix, also because in Julia those are of different types.

mschauer commented 9 years ago

I thought a bit about it, maybe it is not so useful to integrate these functions into the MatrixDepot package, for three reasons: First, these are random matrices, second, these are naturally Float64 matrices, because "randn" is naturally Float64, and third, the matrices are somewhat "ad hoc". I put those now for now at https://github.com/mschauer/RandomTestMatrices.jl

weijianzhg commented 9 years ago

Yeah, I see your point. Thanks for letting me know. Best wishes.