Generic Module

Functions and values

Function or value Description

add matrix1 matrix2

Full Usage: add matrix1 matrix2

Parameters:
Returns: Matrix<'a>

Performs a element wise addition of matrices matrix1 and matrix2 (matrix1 + matrix2).
Only usable if both matrices have the same dimensions.

matrix1 : Matrix<'a>

matrix2 : Matrix<'a>

Returns: Matrix<'a>

Example

compare matrix1 matrix2

Full Usage: compare matrix1 matrix2

Parameters:
Returns: int
matrix1 : Matrix<'a>
matrix2 : Matrix<'a>
Returns: int

constDiag n x

Full Usage: constDiag n x

Parameters:
    n : int
    x : 'a

Returns: Matrix<'a>
n : int
x : 'a
Returns: Matrix<'a>

copy matrix

Full Usage: copy matrix

Parameters:
Returns: Matrix<'a>
matrix : Matrix<'a>
Returns: Matrix<'a>

cptMax matrix1 matrix2

Full Usage: cptMax matrix1 matrix2

Parameters:
Returns: Matrix<'a>

Performs a element wise comparison of matrices matrix1 and matrix2 always preserving the greater value.
Only usable if both matrices have the same dimensions.

matrix1 : Matrix<'a>

matrix2 : Matrix<'a>

Returns: Matrix<'a>

Example

cptMin matrix1 matrix2

Full Usage: cptMin matrix1 matrix2

Parameters:
Returns: Matrix<'a>

Performs a element wise comparison of matrices matrix1 and matrix2 always preserving the smaller value.
Only usable if both matrices have the same dimensions.

matrix1 : Matrix<'a>

matrix2 : Matrix<'a>

Returns: Matrix<'a>

Example

cptMul matrix1 matrix2

Full Usage: cptMul matrix1 matrix2

Parameters:
Returns: Matrix<'a>

Performs a element wise multiplication of matrices matrix1 and matrix2 (matrix1 * matrix2, Hadamard-Product).
Only usable if both matrices have the same dimensions.

matrix1 : Matrix<'a>

matrix2 : Matrix<'a>

Returns: Matrix<'a>

Example

create lengthRow lengthCol value

Full Usage: create lengthRow lengthCol value

Parameters:
    lengthRow : int
    lengthCol : int
    value : 'a

Returns: Matrix<'a>
lengthRow : int
lengthCol : int
value : 'a
Returns: Matrix<'a>

diag v

Full Usage: diag v

Parameters:
Returns: Matrix<'a>
v : Vector<'a>
Returns: Matrix<'a>

dot matrix1 matrix2

Full Usage: dot matrix1 matrix2

Parameters:
Returns: 'a

Performs a dot product of matrices matrix1 and matrix2.
Only usable if both matrices have the same dimensions.

matrix1 : Matrix<'a>

matrix2 : Matrix<'a>

Returns: 'a

Example

exists predicate matrix

Full Usage: exists predicate matrix

Parameters:
    predicate : 'a -> bool -
    matrix : Matrix<'a> -

Returns: bool

Iterates the given Matrix row wise and applies the function predicate element wise.
The iteration stops and returns true if an element satisfies the condition or false when the end of
the matrix is reached.

predicate : 'a -> bool

matrix : Matrix<'a>

Returns: bool

Example

existsi predicate matrix

Full Usage: existsi predicate matrix

Parameters:
    predicate : int -> int -> 'a -> bool -
    matrix : Matrix<'a> -

Returns: bool

Iterates the given Matrix row wise and applies the function predicate element wise.
The iteration stops and returns true if an element satisfies the condition or false when the end of
the matrix is reached.

predicate : int -> int -> 'a -> bool

matrix : Matrix<'a>

Returns: bool

Example

flattenColWise matrix

Full Usage: flattenColWise matrix

Parameters:
Returns: Vector<'a>

Iterates the given Matrix column wise and places every element in a new vector with length n*m.

matrix : Matrix<'a>

Returns: Vector<'a>

Example

flattenRowWise matrix

Full Usage: flattenRowWise matrix

Parameters:
Returns: Vector<'a>

Iterates the given Matrix row wise and places every element in a new vector with length n*m.

matrix : Matrix<'a>

Returns: Vector<'a>

Example

fold folder state matrix

Full Usage: fold folder state matrix

Parameters:
    folder : 'a -> 'b -> 'a
    state : 'a
    matrix : Matrix<'b>

Returns: 'a
folder : 'a -> 'b -> 'a
state : 'a
matrix : Matrix<'b>
Returns: 'a

foldi folder state matrix

Full Usage: foldi folder state matrix

Parameters:
    folder : int -> int -> 'b -> 'c -> 'b
    state : 'b
    matrix : Matrix<'c>

Returns: 'b
folder : int -> int -> 'b -> 'c -> 'b
state : 'b
matrix : Matrix<'c>
Returns: 'b

forall predicate matrix

Full Usage: forall predicate matrix

Parameters:
    predicate : 'a -> bool -
    matrix : Matrix<'a> -

Returns: bool

Iterates the given Matrix row wise and applies the function predicate element wise.
The iteration stops and returns false if an element fails the condition or true when the end of
the matrix is reached.

predicate : 'a -> bool

matrix : Matrix<'a>

Returns: bool

Example

foralli predicate matrix

Full Usage: foralli predicate matrix

Parameters:
    predicate : int -> int -> 'a -> bool -
    matrix : Matrix<'a> -

Returns: bool

Iterates the given Matrix row wise and applies the function predicate element wise.
The iteration stops and returns false if an element fails the condition or true when the end of
the matrix is reached.

predicate : int -> int -> 'a -> bool

matrix : Matrix<'a>

Returns: bool

Example

get matrix indexRow indexCol

Full Usage: get matrix indexRow indexCol

Parameters:
    matrix : Matrix<'a>
    indexRow : int
    indexCol : int

Returns: 'a
matrix : Matrix<'a>
indexRow : int
indexCol : int
Returns: 'a

getCol matrix index

Full Usage: getCol matrix index

Parameters:
    matrix : Matrix<'a> -
    index : int -

Returns: Vector<'a>

Returns col of given index of a matrix

matrix : Matrix<'a>

index : int

Returns: Vector<'a>

Example

getCols matrix column1 column2

Full Usage: getCols matrix column1 column2

Parameters:
    matrix : Matrix<'a>
    column1 : int
    column2 : int

Returns: Matrix<'a>
matrix : Matrix<'a>
column1 : int
column2 : int
Returns: Matrix<'a>

getDiag matrix

Full Usage: getDiag matrix

Parameters:
Returns: Vector<'a>
matrix : Matrix<'a>
Returns: Vector<'a>

getDiagN a n

Full Usage: getDiagN a n

Parameters:
Returns: Vector<'a>
a : Matrix<'a>
n : int
Returns: Vector<'a>

getRegion matrix column1 row1 column2 row2

Full Usage: getRegion matrix column1 row1 column2 row2

Parameters:
    matrix : Matrix<'a>
    column1 : int
    row1 : int
    column2 : int
    row2 : int

Returns: Matrix<'a>
matrix : Matrix<'a>
column1 : int
row1 : int
column2 : int
row2 : int
Returns: Matrix<'a>

getRow matrix index

Full Usage: getRow matrix index

Parameters:
    matrix : Matrix<'a> -
    index : int -

Returns: RowVector<'a>

Returns row of given index of a matrix

matrix : Matrix<'a>

index : int

Returns: RowVector<'a>

Example

getRows matrix row1 row2

Full Usage: getRows matrix row1 row2

Parameters:
    matrix : Matrix<'a>
    row1 : int
    row2 : int

Returns: Matrix<'a>
matrix : Matrix<'a>
row1 : int
row2 : int
Returns: Matrix<'a>

hash matrix

Full Usage: hash matrix

Parameters:
Returns: int
matrix : Matrix<'a>
Returns: int

identity m

Full Usage: identity m

Parameters:
    m : int

Returns: Matrix<'a>
m : int
Returns: Matrix<'a>

init lengthRow lengthCol initializer

Full Usage: init lengthRow lengthCol initializer

Parameters:
    lengthRow : int
    lengthCol : int
    initializer : int -> int -> 'b

Returns: Matrix<'b>
lengthRow : int
lengthCol : int
initializer : int -> int -> 'b
Returns: Matrix<'b>

initDense lengthRow lengthCol source

Full Usage: initDense lengthRow lengthCol source

Parameters:
    lengthRow : int
    lengthCol : int
    source : seq<int * int * 'a>

Returns: Matrix<'a>
lengthRow : int
lengthCol : int
source : seq<int * int * 'a>
Returns: Matrix<'a>

initDiagonal v

Full Usage: initDiagonal v

Parameters:
Returns: Matrix<'a>
v : Vector<'a>
Returns: Matrix<'a>

initNumeric lengthRow lengthCol initializer

Full Usage: initNumeric lengthRow lengthCol initializer

Parameters:
    lengthRow : int
    lengthCol : int
    initializer : INumeric<'a> -> int -> int -> 'a

Returns: Matrix<'a>
lengthRow : int
lengthCol : int
initializer : INumeric<'a> -> int -> int -> 'a
Returns: Matrix<'a>

initSparse lengthRow lengthCol source

Full Usage: initSparse lengthRow lengthCol source

Parameters:
    lengthRow : int
    lengthCol : int
    source : seq<int * int * 'a>

Returns: Matrix<'a>
lengthRow : int
lengthCol : int
source : seq<int * int * 'a>
Returns: Matrix<'a>

inplaceAdd matrix1 matrix2

Full Usage: inplaceAdd matrix1 matrix2

Parameters:

Performs an element wise addition of matrices matrix1 and matrix2 (matrix1 + matrix2).
Attention: the output overrides matrix1.
Only usable if both matrices have the same dimensions.

matrix1 : Matrix<'a>

matrix2 : Matrix<'a>

Example

inplaceSub matrix1 matrix2

Full Usage: inplaceSub matrix1 matrix2

Parameters:

Performs an element wise substraction of matrices matrix1 and matrix2 (matrix1 - matrix2).
Attention: the output overrides matrix1.
Only usable if both matrices have the same dimensions.

matrix1 : Matrix<'a>

matrix2 : Matrix<'a>

Example

inplace_assign f matrix

Full Usage: inplace_assign f matrix

Parameters:
    f : int -> int -> 'a
    matrix : Matrix<'a>

f : int -> int -> 'a
matrix : Matrix<'a>

inplace_cptMul matrix1 matrix2

Full Usage: inplace_cptMul matrix1 matrix2

Parameters:
matrix1 : Matrix<'a>
matrix2 : Matrix<'a>

inplace_map mapping matrix

Full Usage: inplace_map mapping matrix

Parameters:
    mapping : 'a -> 'a
    matrix : Matrix<'a>

mapping : 'a -> 'a
matrix : Matrix<'a>

inplace_mapi mapping matrix

Full Usage: inplace_mapi mapping matrix

Parameters:
    mapping : int -> int -> 'a -> 'a
    matrix : Matrix<'a>

mapping : int -> int -> 'a -> 'a
matrix : Matrix<'a>

inplace_scale value matrix

Full Usage: inplace_scale value matrix

Parameters:
    value : 'a
    matrix : Matrix<'a>

value : 'a
matrix : Matrix<'a>

map mapping matrix

Full Usage: map mapping matrix

Parameters:
    mapping : 'a -> 'a
    matrix : Matrix<'a>

Returns: Matrix<'a>
mapping : 'a -> 'a
matrix : Matrix<'a>
Returns: Matrix<'a>

mapCols mapping matrix

Full Usage: mapCols mapping matrix

Parameters:
Returns: RowVector<'b>

Applies mapping function along column axis

mapping : Vector<'a> -> 'b

matrix : Matrix<'a>

Returns: RowVector<'b>

Example

mapRows mapping matrix

Full Usage: mapRows mapping matrix

Parameters:
Returns: Vector<'b>

Applies mapping function along row axis

mapping : RowVector<'a> -> 'b

matrix : Matrix<'a>

Returns: Vector<'b>

Example

mapi mapping matrix

Full Usage: mapi mapping matrix

Parameters:
    mapping : int -> int -> 'a -> 'a
    matrix : Matrix<'a>

Returns: Matrix<'a>
mapping : int -> int -> 'a -> 'a
matrix : Matrix<'a>
Returns: Matrix<'a>

mapiCols mapping matrix

Full Usage: mapiCols mapping matrix

Parameters:
Returns: RowVector<'b>

Maps every matrix column using the position dependant function

mapping : int -> Vector<'a> -> 'b

matrix : Matrix<'a>

Returns: RowVector<'b>

Example

mapiRows mapping matrix

Full Usage: mapiRows mapping matrix

Parameters:
Returns: Vector<'b>

Maps every matrix row using the position dependent function

mapping : int -> RowVector<'a> -> 'b

matrix : Matrix<'a>

Returns: Vector<'b>

Example

mul matrix1 matrix2

Full Usage: mul matrix1 matrix2

Parameters:
Returns: Matrix<'a>

Performs a left sided matrix multiplication of matrices matrix1 and matrix2 (matrix1 * matrix2).
Only usable if both matrices have the same dimensions.

matrix1 : Matrix<'a>

matrix2 : Matrix<'a>

Returns: Matrix<'a>

Example

mulRV rowVector matrix

Full Usage: mulRV rowVector matrix

Parameters:
Returns: RowVector<'a>

Performs a matrix multiplication of the 1*n rowVector and the m*n matrix (rowVector*matrix).
Only usable if column number (n) of the vector equals the row number (m) of the matrix.

rowVector : RowVector<'a>

matrix : Matrix<'a>

Returns: RowVector<'a>

Example

mulV matrix vector

Full Usage: mulV matrix vector

Parameters:
Returns: Vector<'a>

Performs a matrix multiplication of a m*n matrix and the m*1 vector (matrix*vector).
Only usable if column number (n) of the matrix equals the row number (m) of the vector.

matrix : Matrix<'a>

vector : Vector<'a>

Returns: Vector<'a>

Example

neg matrix

Full Usage: neg matrix

Parameters:
Returns: Matrix<'a>

Scales the matrix by element wise mulitplication with minus 1.

matrix : Matrix<'a>

Returns: Matrix<'a>

Example

nonzeroEntries matrix

Full Usage: nonzeroEntries matrix

Parameters:
Returns: seq<int * int * 'a>
matrix : Matrix<'a>
Returns: seq<int * int * 'a>

norm matrix

Full Usage: norm matrix

Parameters:
Returns: float

Frobenius matrix norm

matrix : Matrix<'a>

Returns: float

Example

ofArray2D array

Full Usage: ofArray2D array

Parameters:
    array : 'T[,]

Returns: Matrix<'T>
array : 'T[,]
Returns: Matrix<'T>

ofColSeq sources

Full Usage: ofColSeq sources

Parameters:
    sources : seq<'a>

Returns: Matrix<'b>
sources : seq<'a>
Returns: Matrix<'b>

ofList lists

Full Usage: ofList lists

Parameters:
    lists : 'a list list

Returns: Matrix<'a>
lists : 'a list list
Returns: Matrix<'a>

ofRowVector rowVector

Full Usage: ofRowVector rowVector

Parameters:
Returns: Matrix<'a>
rowVector : RowVector<'a>
Returns: Matrix<'a>

ofScalar scalar

Full Usage: ofScalar scalar

Parameters:
    scalar : 'a

Returns: Matrix<'a>
scalar : 'a
Returns: Matrix<'a>

ofSeq sources

Full Usage: ofSeq sources

Parameters:
    sources : seq<'a>

Returns: Matrix<'b>
sources : seq<'a>
Returns: Matrix<'b>

ofVector vector

Full Usage: ofVector vector

Parameters:
Returns: Matrix<'a>
vector : Vector<'a>
Returns: Matrix<'a>

prod matrix

Full Usage: prod matrix

Parameters:
Returns: 'a

Computes the product of all matrix elements.

matrix : Matrix<'a>

Returns: 'a

Example

readCSV path separator removeHeaderRow removeHeaderCol transform

Full Usage: readCSV path separator removeHeaderRow removeHeaderCol transform

Parameters:
    path : string -
    separator : char -
    removeHeaderRow : bool -
    removeHeaderCol : bool -
    transform : string -> 'a -

Returns: Matrix<'a>

reads matrix from delimiter separated file

path : string

separator : char

removeHeaderRow : bool

removeHeaderCol : bool

transform : string -> 'a

Returns: Matrix<'a>

Example

scale value matrix

Full Usage: scale value matrix

Parameters:
    value : 'a -
    matrix : Matrix<'a> -

Returns: Matrix<'a>

Builds a new matrix where the elements are the result of multiplying every element of the given matrix with the given value

value : 'a

matrix : Matrix<'a>

Returns: Matrix<'a>

Example

set matrix indexRow indexCol value

Full Usage: set matrix indexRow indexCol value

Parameters:
    matrix : Matrix<'a>
    indexRow : int
    indexCol : int
    value : 'a

matrix : Matrix<'a>
indexRow : int
indexCol : int
value : 'a

setCol matrix index vector

Full Usage: setCol matrix index vector

Parameters:

Replaces column of given index of a matrix with values of a vector, if vector length matches columnsize

matrix : Matrix<'a>

index : int

vector : Vector<'a>

Example

setRow matrix index vector

Full Usage: setRow matrix index vector

Parameters:

Replaces row of given index of a matrix with values of a vector, if vector length matches rowsize

matrix : Matrix<'a>

index : int

vector : Vector<'a>

Example

sparseOfArray2D array

Full Usage: sparseOfArray2D array

Parameters:
    array : 'T[,] -

Returns: Matrix<'T>

Creates a sparse matrix based on the CSR format

array : 'T[,]

Returns: Matrix<'T>

Example

sub matrix1 matrix2

Full Usage: sub matrix1 matrix2

Parameters:
Returns: Matrix<'a>

Performs a element wise substraction of matrices matrix1 and matrix2 (matrix1 - matrix2).
Only usable if both matrices have the same dimensions.

matrix1 : Matrix<'a>

matrix2 : Matrix<'a>

Returns: Matrix<'a>

Example

sum matrix

Full Usage: sum matrix

Parameters:
Returns: 'a

Computes the sum of all matrix elements.

matrix : Matrix<'a>

Returns: 'a

Example

toArray2D matrix

Full Usage: toArray2D matrix

Parameters:
Returns: 'a[,]
matrix : Matrix<'a>
Returns: 'a[,]

toDense matrix

Full Usage: toDense matrix

Parameters:
Returns: Matrix<'a>
matrix : Matrix<'a>
Returns: Matrix<'a>

toJaggedArray m

Full Usage: toJaggedArray m

Parameters:
Returns: 'a[][]
m : Matrix<'a>
Returns: 'a[][]

toJaggedColArray m

Full Usage: toJaggedColArray m

Parameters:
Returns: 'a[][]
m : Matrix<'a>
Returns: 'a[][]

toJaggedColSeq m

Full Usage: toJaggedColSeq m

Parameters:
Returns: seq<seq<'a>>
m : Matrix<'a>
Returns: seq<seq<'a>>

toJaggedSeq m

Full Usage: toJaggedSeq m

Parameters:
Returns: seq<seq<'a>>
m : Matrix<'a>
Returns: seq<seq<'a>>

toRowVector matrix

Full Usage: toRowVector matrix

Parameters:
Returns: RowVector<'a>

takes the first row of the matrix as rowvector

matrix : Matrix<'a>

Returns: RowVector<'a>

Example

toScalar matrix

Full Usage: toScalar matrix

Parameters:
Returns: 'a
matrix : Matrix<'a>
Returns: 'a

toSparse matrix

Full Usage: toSparse matrix

Parameters:
Returns: Matrix<'a>

Creates a sparse matrix based on the CSR format

matrix : Matrix<'a>

Returns: Matrix<'a>

Example

toVector matrix

Full Usage: toVector matrix

Parameters:
Returns: Vector<'a>

takes the first column of the matrix as vector

matrix : Matrix<'a>

Returns: Vector<'a>

Example

trace matrix

Full Usage: trace matrix

Parameters:
Returns: 'a

Computes the trace of the matrix by summing elements of the diagonal.
Only usable if the matrix is a square matrix (m*m).

matrix : Matrix<'a>

Returns: 'a

Example

transpose matrix

Full Usage: transpose matrix

Parameters:
Returns: Matrix<'a>

Returns the transpose of the matrix.

matrix : Matrix<'a>

Returns: Matrix<'a>

Example

zeroCreate lengthRow lengthCol

Full Usage: zeroCreate lengthRow lengthCol

Parameters:
    lengthRow : int
    lengthCol : int

Returns: Matrix<'a>
lengthRow : int
lengthCol : int
Returns: Matrix<'a>