From e8270af721ba6471cea0b0a086634e71767c46c8 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Thu, 7 Aug 2014 11:46:21 +0200 Subject: [PATCH] Docs: F# examples how to create random matrix with distribution --- docs/content/Matrix.fsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/content/Matrix.fsx b/docs/content/Matrix.fsx index 2888b573..b38cf6ab 100644 --- a/docs/content/Matrix.fsx +++ b/docs/content/Matrix.fsx @@ -3,6 +3,7 @@ #r "MathNet.Numerics.dll" #r "MathNet.Numerics.FSharp.dll" open MathNet.Numerics.LinearAlgebra +open MathNet.Numerics.Distributions (** Matrices and Vectors @@ -206,6 +207,14 @@ let m4 = DiagonalMatrix.identity 4 let x = Seq.init 4 (fun c -> Seq.init 3 (fun r -> float (100*r + c))) let m5 = DenseMatrix.ofColumnSeq x +// random matrix with standard distribution: +let m6 = DenseMatrix.randomStandard 3 4 + +// random matrix with a uniform and one with a Gamma distribution: +let m7a = DenseMatrix.random 3 4 (ContinuousUniform(-2.0, 4.0)) +let m7b = DenseMatrix.random 3 4 (Gamma(1.0, 2.0)) + + (** Or using any other of all the available functions.