Numerics.NET contains
extensive support for numerical linear algebra. To illustrate the range and
versatility of the linear algebra classes, we created M#: the the .NET language
for numerical computing. M# comes with a complete environment for linear
algebra computations. The language (pronounced “M sharp”) implements a subset
of the Matlab®
language. Data types supported are boolean values, scalars, vectors, matrices and
strings. It supports control flow constructs such as if, for,
and while, as well as a large number of built-in functions.
Reference
The following tables list the operators and functions supported by the M#
language:
Table 1. Supported operators.
Operator
Description
`+`
Addition, unary plus.
`-`
Subtraction, unary minus.
`*`
Multiplication, matrix multiplication.
`/`
Division, solution of linear system.
`\`
Backwards division, solution of linear system.
`^`
Raise a matrix or number to a power.
`.*`
Componentwise multiplication.
`./`
Componentwise division.
`.\`
Componentwise backward division.
`.^`
Componentwise power operator.
`'`
Matrix transpose.
`== ~= < > <= >= `
Relational operators.
`:`
Colon ('range') operator.
Table 2. Supported array operations.
Function
Description
`size`
Size of a matrix.
`numel`
Number of elements.
`cat`
Concatenate matrices.
`horzcat`
Concatenate matrices horizontally.
`vertcat`
Concatenate matrices vertically.
`repmat`
Tile a matrix horizontally and vertically.
`flipud`
Flip a matrix horizontally.
`fliplr`
Flip a matrix vertically.
`find`
Find non-zero elements of a matrix.
`tril`
Extract lower triangular matrix.
`triu`
Extract upper triangular matrix.
Table 3. Supported matrix operations.
Function
Description
`sum`
Sum of elements in matrix columns.
`cumsum`
Cumulative sum of elements in matrix columns.
`prod`
Product of elements in matrix columns.
`cumprod`
Cumulative product of elements in matrix columns.
`min`
Return largest component(s).
`max`
Return smallest component(s).
Table 4. Supported special matrices.
Function
Description
`zeros`
Creates a matrix of all zeros.
`ones`
Creates a matrix of all ones.
`eye`
Creates an identity matrix.
`rand`
Creates a matrix with random components.
`magic`
Creates a magic square.
`hilb`
Creates a Hilbert matrix.
`pascal`
Creates a part of the Pascal triangle..
`linspace`
Creates a vector of equally spaced components.
`logspace`
Creates a vector of logarithmically spaced components.
Table 5. Supported linear algebra operations.
Function
Description
`det`
Determinant of a matrix.
`trace`
Trace of a matrix.
`inv`
Inverse matrix.
`rcond`
Estimate for the reciprocal of the condition number.
`lu`
LU decomposition of a matrix.
`qr`
QR decomposition of a matrix..
Table 6. Supported string functions.
Function
Description
`blanks`
Returns a string of spaces.
`deblank`
Removes trailing spaces from a string.
`findstr`
Finds all occurrances of a string in another string.
`lower`
Converts a string to lower case.
`strcat`
Concatenates two or more strings.
`strcmp`
Compares two strings for equality.
`strcmpi`
Compares two strings for equality independent of case.
`strjust`
Aligns a string.
`upper`
Converts a string to upper case.
This website uses cookies to improve your experience. Learn more.