[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.Core')

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<'a> or some more specific numeric association (see [[GlobalAssociations]]) ((else NotSupportedException)).

Values

ValueDescription
val add : matrix -> matrix -> matrix
Add two matrices (operator +)
val constDiag : int -> float -> matrix
Create a square matrix with the constant lying on diagonal
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 cptMul : matrix -> matrix -> matrix
Point-wise multiplication of two matrices (operator .*)
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 diag : vector -> matrix
Create a square matrix with the given vector lying on diagonal
val dims : matrix -> int * int
Get the dimensions of a matrix (rows x columns)
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 : ('a -> float -> 'a) -> 'a -> matrix -> 'a
Fold the given function over all elements of a matrix
val foldByCol : ('a -> float -> 'a) -> RowVector<'a> -> matrix -> RowVector<'a>
Fold the given function down each column of a matrix
val foldByRow : ('a -> float -> 'a) -> Vector<'a> -> matrix -> Vector<'a>
Fold the given function along each row of a matrix
val foldCol : ('a -> float -> 'a) -> 'a -> matrix -> int -> 'a
Fold the given function along a particular column of a matrix
val foldi : (int -> int -> 'a -> float -> 'a) -> 'a -> matrix -> 'a
Fold the given function over all elements of a matrix
val foldRow : ('a -> float -> 'a) -> 'a -> matrix -> int -> 'a
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 getCol : matrix -> int -> vector
Select a column from a matrix as a vector.
val getCols : matrix -> int -> int -> matrix
Select a number of columns from a matrix.
val getDiag : matrix -> vector
Return the primary diagonal of a matrix, as a vector.
val getDiagN : matrix -> int -> vector
Return the nth diagonal of a matrix, as a vector. Diagonal 0 is the primary diagonal, positive diagonals are further to the upper-right of the matrix.
val getRegion : matrix -> int -> int -> int -> int -> matrix
Select a region from a matrix.
val getRow : matrix -> int -> rowvec
Select a row from a matrix as a row vector.
val getRows : matrix -> int -> int -> matrix
Select a number of rows from 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 init_dense : int -> int -> #seq<int * int * float> -> matrix
Create a matrix with the given entries. Create a dense representation matrix with the given entries.
val init_sparse : 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_assign : (int -> int -> float) -> matrix -> unit
In-place assign mutates matrix argument.
val inplace_cptMul : matrix -> matrix -> unit
In-place componentwise-multiplication mutates first matrix argument.
val inplace_mapi : (int -> int -> float -> float) -> matrix -> unit
In-place map mutates matrix argument.
val inplace_scale : float -> matrix -> unit
In-place scaling mutates 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 mul : matrix -> matrix -> matrix
Multiply two matrices (operator * )
val mulRV : rowvec -> matrix -> rowvec
Multiply row vector by matrix (operator *% )
val mulV : matrix -> vector -> vector
Multiply matrix by vector (operator *% )
val ncols : matrix -> int
Get the number of columns of a matrix
val neg : matrix -> matrix
Negation of the matrix (each element is negated) (unary operator -)
val nonzero_entries : matrix -> seq<int * int * float>
val norm : matrix -> float
sqrt(sum(x*x)) of all the elements of a matrix
val nrows : matrix -> int
Get the number of rows 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<'b> -> matrix when 'b :> seq<float>
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 scale : float -> matrix -> matrix
Pointwise multiplication of a matrix by a scalar
val set : matrix -> int -> int -> float -> unit
Set an element of a matrix
val sub : matrix -> matrix -> matrix
Subtract one matrix from another (operator -)
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.Core, version 1.9.4.19, generated using F# version 1.9.4.19