Aug 7, 2014 at 8:14 AM
Edited Aug 7, 2014 at 9:40 AM

Would it be possible to add an example of how to create a random matrix in F# say for the uniform distribution?
http://numerics.mathdotnet.com/docs/Matrix.html
The doc explains how to do it via Array2d conversion or linear sequences, but I guess it's directly possible as well. Something like
let m : Matrix<float> = DenseMatrix.random 3 4 (ContinuousUniform 0 1)
Thanks!
Edit: This seems to work:
open MathNet.Numerics
open MathNet.Numerics.LinearAlgebra
open MathNet.Numerics.Distributions
let m : Matrix<float> = DenseMatrix.random 3 4 (new ContinuousUniform(0.0 1.0))


Coordinator
Aug 7, 2014 at 9:52 AM

Good point, I just added a few examples:
// random matrix with standard distribution:
let m6 = DenseMatrix.randomStandard<float> 3 4
// random matrix with a uniform and one with a Gamma distribution:
let m7a = DenseMatrix.random<float> 3 4 (ContinuousUniform(2.0, 4.0))
let m7b = DenseMatrix.random<float> 3 4 (Gamma(1.0, 2.0))
I.e. in your examples was very close  ContinuousUniform is a normal constructor and thus requires tuple syntax:
let m : Matrix<float> = DenseMatrix.random 3 4 (ContinuousUniform(0.0, 1.0))

