Browse Source

Docs: F# examples how to create random matrix with distribution

pull/248/head
Christoph Ruegg 12 years ago
parent
commit
e8270af721
  1. 9
      docs/content/Matrix.fsx

9
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<float32> 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<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))
(**
Or using any other of all the available functions.

Loading…
Cancel
Save