Math.NET Numerics
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

168 lines
18 KiB

<HTML><HEAD><TITLE>Microsoft.FSharp.Math.Matrix</TITLE><link rel="stylesheet" type="text/css"href="../msdn.css"></link></HEAD><BODY>
<br><dl>
<dt></dt><dd>
<h1>[<a href='../namespaces.html'>Home</a>] Module <a href='Microsoft.FSharp.Math.html'>Microsoft.FSharp.Math</a>.Matrix </h1><br>
</dd>
<dt></dt><dd>
<table>
<tr valign='top'><td><summary>
Operations to manipulate floating
point matrices. The submodule <tt>Matrix.Generic</tt> contains a
matching set of operations to manipulate matrix types carrying
arbitrary element types.
</summary>
<dt><h3>Modules (as contributed by assembly 'FSharp.PowerPack')</h3></dt><dd>
<table width="100%%">
<tr><th width=30%>Module</th><th>Description</th></tr>
<tr valign="top"><td><a href='Microsoft.FSharp.Math.Matrix.Generic.html'>Microsoft.FSharp.Math.Matrix.Generic</a></td><td><summary>
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&lt;'T&gt;
or some more specific numeric association (see <tt>GlobalAssociations</tt>) ((else NotSupportedException)).
</summary></td></tr>
</table>
</dd>
<dt><h3>Values</h3></dt><dd>
<table width="100%%">
<tr><th width=60%>Value</th><th>Description</th></tr>
<tr valign="top"><td><pre>val add : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Add two matrices (operator +)
</summary></td></tr>
<tr valign="top"><td><pre>val copy : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Create a new matrix that is a copy of the given array
</summary></td></tr>
<tr valign="top"><td><pre>val cptMax : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Point-wise maximum element of two matrices
</summary></td></tr>
<tr valign="top"><td><pre>val cptMin : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Point-wise minimum element of two matrices
</summary></td></tr>
<tr valign="top"><td><pre>val cptPow : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Pointwise exponential of a matrix.
</summary></td></tr>
<tr valign="top"><td><pre>val create : <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Create a matrix with all entries the given constant
</summary></td></tr>
<tr valign="top"><td><pre>val dot : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a></pre></td><td><summary>
Dot product
</summary></td></tr>
<tr valign="top"><td><pre>val exists : (<a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary>
Check if a predicate holds for at least one element of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val existsi : (<a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary>
Check if a predicate holds for at least one element of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val fold : ('T -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> 'T) -> 'T -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> 'T</pre></td><td><summary>
Fold the given function over all elements of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val foldByCol :
('T -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> 'T) -> <a href='Microsoft.FSharp.Math.type_RowVector-1.html'>RowVector</a>&lt;'T&gt; -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type_RowVector-1.html'>RowVector</a>&lt;'T&gt;</pre></td><td><summary>
Fold the given function down each column of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val foldByRow :
('T -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> 'T) -> <a href='Microsoft.FSharp.Math.type_Vector-1.html'>Vector</a>&lt;'T&gt; -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type_Vector-1.html'>Vector</a>&lt;'T&gt;</pre></td><td><summary>
Fold the given function along each row of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val foldCol : ('T -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> 'T) -> 'T -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T</pre></td><td><summary>
Fold the given function along a particular column of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val foldi : (<a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> 'T) -> 'T -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> 'T</pre></td><td><summary>
Fold the given function over all elements of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val foldRow : ('T -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> 'T) -> 'T -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> 'T</pre></td><td><summary>
Fold the given function down a particular row of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val forall : (<a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary>
Check if a predicate holds for all elements of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val foralli : (<a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__bool.html'>bool</a>) -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__bool.html'>bool</a></pre></td><td><summary>
Check if a predicate holds for all elements of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val get : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a></pre></td><td><summary>
Get an element of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val identity : <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Create a square matrix with the constant 1.0 lying on diagonal
</summary></td></tr>
<tr valign="top"><td><pre>val init : <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> (<a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a>) -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td></td></tr>
<tr valign="top"><td><pre>val initDense : <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Collections.type__seq-1.html'>seq</a>&lt;<a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> * <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> * <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a>&gt; -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Create a dense representation matrix with the given entries.
</summary></td></tr>
<tr valign="top"><td><pre>val initDiagonal : <a href='Microsoft.FSharp.Math.type__vector.html'>vector</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Create a square matrix with the given vector lying on diagonal
</summary></td></tr>
<tr valign="top"><td><pre>val initSparse : <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Collections.type__seq-1.html'>seq</a>&lt;<a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> * <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> * <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a>&gt; -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
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.
</summary></td></tr>
<tr valign="top"><td><pre>val inplace_add : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary>
In-place addition mutates first matrix argument.
</summary></td></tr>
<tr valign="top"><td><pre>val inplace_sub : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary>
In-place subtraction mutates first matrix argument.
</summary></td></tr>
<tr valign="top"><td><pre>val map : (<a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a>) -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Map the given function over each element of the matrix, producing a new matrix
</summary></td></tr>
<tr valign="top"><td><pre>val mapi : (<a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a>) -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Map the given indexed function over each element of the matrix, producing a new matrix
</summary></td></tr>
<tr valign="top"><td><pre>val norm : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a></pre></td><td><summary>
sqrt(sum(x*x)) of all the elements of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val of_array2 : <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td></td></tr>
<tr valign="top"><td><pre>val of_list : <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> <a href='../FSharp.Core/Microsoft.FSharp.Collections.type__list-1.html'>list</a> <a href='../FSharp.Core/Microsoft.FSharp.Collections.type__list-1.html'>list</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td></td></tr>
<tr valign="top"><td><pre>val of_rowvec : <a href='Microsoft.FSharp.Math.type__rowvec.html'>rowvec</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td></td></tr>
<tr valign="top"><td><pre>val of_scalar : <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td></td></tr>
<tr valign="top"><td><pre>val of_seq : <a href='../FSharp.Core/Microsoft.FSharp.Collections.type__seq-1.html'>seq</a>&lt;#<a href='../FSharp.Core/Microsoft.FSharp.Collections.type__seq-1.html'>seq</a>&lt;<a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a>&gt;&gt; -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td></td></tr>
<tr valign="top"><td><pre>val of_vector : <a href='Microsoft.FSharp.Math.type__vector.html'>vector</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td></td></tr>
<tr valign="top"><td><pre>val prod : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a></pre></td><td><summary>
Multiply all the elements of the matrix
</summary></td></tr>
<tr valign="top"><td><pre>val randomize : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
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.
</summary></td></tr>
<tr valign="top"><td><pre>val set : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__unit.html'>unit</a></pre></td><td><summary>
Set an element of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val sum : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a></pre></td><td><summary>
Sum all the elements of a matrix
</summary></td></tr>
<tr valign="top"><td><pre>val to_array2 : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__[,]-1.html'>[,]</a></pre></td><td></td></tr>
<tr valign="top"><td><pre>val to_dense : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Ensure that a matrix uses dense representation. See init_sparse
</summary></td></tr>
<tr valign="top"><td><pre>val to_rowvec : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__rowvec.html'>rowvec</a></pre></td><td></td></tr>
<tr valign="top"><td><pre>val to_scalar : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a></pre></td><td></td></tr>
<tr valign="top"><td><pre>val to_vector : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__vector.html'>vector</a></pre></td><td></td></tr>
<tr valign="top"><td><pre>val trace : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__float.html'>float</a></pre></td><td><summary>
Sum of the diagonal elements of the matrix
</summary></td></tr>
<tr valign="top"><td><pre>val transpose : <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Transpose of a matrix. Use also m.Transpose
</summary></td></tr>
<tr valign="top"><td><pre>val zero : <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='../FSharp.Core/Microsoft.FSharp.Core.type__int.html'>int</a> -> <a href='Microsoft.FSharp.Math.type__matrix.html'>matrix</a></pre></td><td><summary>
Create a matrix with all entries zero
</summary></td></tr>
</table>
</dd>
</td></tr>
<tr valign='top'><td>
<dt><h3>See Also</h3></dt><dd>
<a href="Microsoft.FSharp.Math.html">Microsoft.FSharp.Math</a> </dd>
</td></tr>
</table>
</dd>
</dl>
<br /> <br/><p><i>Documentation for assembly FSharp.PowerPack, version 1.9.6.16, generated using <a href='http://research.microsoft.com/fsharp/'>F# Programming Language</a> version 1.9.6.16</i></p>
</BODY></HTML>