[Home] Module Microsoft.FSharp.Math.Matrix


Operations to manipulate floating point matrices. The submodule Matrix.Generic contains a matching set of operations to manipulate matrix types carrying arbitrary element types.

Modules (as contributed by assembly 'FSharp.PowerPack')

ModuleDescription
Microsoft.FSharp.Math.Matrix.Generic Operations to manipulate matrix types carrying arbitrary element types. The names and types of the operations match those in the containing module Math.Matrix. The numeric operations on the element type (add, zero etc.) are inferred from the type argument itself. That is, for some operations the element type of the matrix must have an associated instance of INumeric<'T> or some more specific numeric association (see GlobalAssociations) ((else NotSupportedException)).

Values

ValueDescription
val add : matrix -> matrix -> matrix
Add two matrices (operator +)
val copy : matrix -> matrix
Create a new matrix that is a copy of the given array
val cptMax : matrix -> matrix -> matrix
Point-wise maximum element of two matrices
val cptMin : matrix -> matrix -> matrix
Point-wise minimum element of two matrices
val cptPow : matrix -> float -> matrix
Pointwise exponential of a matrix.
val create : int -> int -> float -> matrix
Create a matrix with all entries the given constant
val dot : matrix -> matrix -> float
Dot product
val exists : (float -> bool) -> matrix -> bool
Check if a predicate holds for at least one element of a matrix
val existsi : (int -> int -> float -> bool) -> matrix -> bool
Check if a predicate holds for at least one element of a matrix
val fold : ('T -> float -> 'T) -> 'T -> matrix -> 'T
Fold the given function over all elements of a matrix
val foldByCol :
  ('T -> float -> 'T) -> RowVector<'T> -> matrix -> RowVector<'T>
Fold the given function down each column of a matrix
val foldByRow :
  ('T -> float -> 'T) -> Vector<'T> -> matrix -> Vector<'T>
Fold the given function along each row of a matrix
val foldCol : ('T -> float -> 'T) -> 'T -> matrix -> int -> 'T
Fold the given function along a particular column of a matrix
val foldi : (int -> int -> 'T -> float -> 'T) -> 'T -> matrix -> 'T
Fold the given function over all elements of a matrix
val foldRow : ('T -> float -> 'T) -> 'T -> matrix -> int -> 'T
Fold the given function down a particular row of a matrix
val forall : (float -> bool) -> matrix -> bool
Check if a predicate holds for all elements of a matrix
val foralli : (int -> int -> float -> bool) -> matrix -> bool
Check if a predicate holds for all elements of a matrix
val get : matrix -> int -> int -> float
Get an element of a matrix
val identity : int -> matrix
Create a square matrix with the constant 1.0 lying on diagonal
val init : int -> int -> (int -> int -> float) -> matrix
val initDense : int -> int -> seq<int * int * float> -> matrix
Create a dense representation matrix with the given entries.
val initDiagonal : vector -> matrix
Create a square matrix with the given vector lying on diagonal
val initSparse : int -> int -> seq<int * int * float> -> matrix
Create a sparse representation matrix with the given entries. Not all operations are available for sparse matrices, and mutation is not permitted. If an operation on sparse matrices raises a runtime exception then consider converting to a dense matrix using to_dense.
val inplace_add : matrix -> matrix -> unit
In-place addition mutates first matrix argument.
val inplace_sub : matrix -> matrix -> unit
In-place subtraction mutates first matrix argument.
val map : (float -> float) -> matrix -> matrix
Map the given function over each element of the matrix, producing a new matrix
val mapi : (int -> int -> float -> float) -> matrix -> matrix
Map the given indexed function over each element of the matrix, producing a new matrix
val norm : matrix -> float
sqrt(sum(x*x)) of all the elements of a matrix
val of_array2 : float [,] -> matrix
val of_list : float list list -> matrix
val of_rowvec : rowvec -> matrix
val of_scalar : float -> matrix
val of_seq : seq<#seq<float>> -> matrix
val of_vector : vector -> matrix
val prod : matrix -> float
Multiply all the elements of the matrix
val randomize : matrix -> matrix
Generate a new matrix of the same size as the input with random entries drawn from the range 0..aij. Random numbers are generated using a globally shared System.Random instance with the initial seed 99.
val set : matrix -> int -> int -> float -> unit
Set an element of a matrix
val sum : matrix -> float
Sum all the elements of a matrix
val to_array2 : matrix -> float [,]
val to_dense : matrix -> matrix
Ensure that a matrix uses dense representation. See init_sparse
val to_rowvec : matrix -> rowvec
val to_scalar : matrix -> float
val to_vector : matrix -> vector
val trace : matrix -> float
Sum of the diagonal elements of the matrix
val transpose : matrix -> matrix
Transpose of a matrix. Use also m.Transpose
val zero : int -> int -> matrix
Create a matrix with all entries zero

See Also

Microsoft.FSharp.Math


Documentation for assembly FSharp.PowerPack, version 1.9.6.16, generated using F# Programming Language version 1.9.6.16