Sample Applications
M#: The .NET Language for Technical Computing
Introduction
Reference
Introduction
The Extreme Optimization Numerical Libraries for .NET contain
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:
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 1. Supported operators.
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 2. Supported array 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 3. Supported matrix operations.
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 4. Supported special matrices.
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 5. Supported linear algebra operations.
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. |
Table 6. Supported string functions.
Copyright © 2003-2023, Extreme Optimization. All rights reserved.
Extreme Optimization, Complexity made simple, M#, and M Sharp are trademarks of ExoAnalytics Inc.
Microsoft, Visual C#, Visual Basic, Visual Studio, Visual Studio.NET, and the Optimized for Visual Studio logo
are registered trademarks of Microsoft Corporation.