FSharpPlus


Matrix<'NumType,'Rows,'Cols>

This is a fixed size matrix of a (typically) numeric type.

Related Tyes

Abstractions

Examples

#r @"nuget: FSharpPlus"
#r @"nuget: FSharpPlus.TypeLevel"
open FSharpPlus
open FSharpPlus.Data

let matrix3x4_1 =
    matrix (
      (1, 0, 0, 0),
      (0, 1, 0, 0),
      (0, 0, 0, 0)
    )

let matrix3x4_2 =
    matrix (
      (10, 0, 100, 0),
      (30, 1, 100, 0),
      (60, 0, 100, 0)
    )


// Add two matrices

let matrix3x4_sum = matrix3x4_1 + matrix3x4_2


// Add a scalar

let matrix3x4_3 = matrix3x4_1 + result 5


// Another way

open FSharpPlus.Math.Generic

let vector3d_4 = matrix3x4_1 + 5G
namespace FSharpPlus
namespace FSharpPlus.Data
val matrix3x4_1: Matrix<int,TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.Z>>>,TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.Z>>>>>
val matrix: definition: '('a * .. * 'a) * .. * ('a * .. * 'a) -> Matrix<'a0,'m,'n> (requires member CountTuple and member TupleToList and member RuntimeValue and member CountTuple and member TupleToList and member RuntimeValue)
val matrix3x4_2: Matrix<int,TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.Z>>>,TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.Z>>>>>
val matrix3x4_sum: Matrix<int,TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.Z>>>,TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.Z>>>>>
val matrix3x4_3: Matrix<int,TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.Z>>>,TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.Z>>>>>
val result: x: 'T -> 'Functor<'T> (requires member Return)
<summary> Lifts a value into a Functor. Same as return in Computation Expressions. </summary>
<category index="2">Applicative</category>
namespace FSharpPlus.Math
module Generic from FSharpPlus.Math
<summary> Generic numbers, functions and operators. By opening this module some common operators become restricted, like (+) to 'T-&gt;'T-&gt;'T </summary>
val vector3d_4: Matrix<int,TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.Z>>>,TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.S<TypeLevel.Z>>>>>