CodePlexProject Hosting for Open Source Software

PowerShell environment for Math.Net Numerics library, defines a few cmdlets that allow to create and manipulate matrices using a straightforward syntax.

Math.Net PowerShell is a Windows PowerShell wrapper around Math.Net Numerics library (http://numerics.mathdotnet.com), it defines a few cmdlets that allow to create matrices using a straightforward syntax and perform some basic matrix manipulation and calculus. Advanced operations are possible by calling the corresponding methods directly on the matrix objects.

You should unblock the downloaded zip file in order to be able to use Math.Net PowerShell, for your convenience, you can also call Setup.bat after extracting all the files, it will also error out if PowerShell is not at least version 3.

$m

$n = i 2

$n

$n[1,1]=2

$n

inv $n

$p = $m * $n

$p

trc $p

det $p

t $p

m "1 0" | t

m -rows 2 -columns 1

$o = m -matrixFile Samples\sampleMatrix.txt

$o

$o.Diagonal()

PS C:\> $m

SparseMatrix 2x2-Single 100.00 % Filled

1 5

5 9

PS C:\> $n = i 2

PS C:\> $n

SparseMatrix 2x2-Single 50.00 % Filled

1 0

0 1

PS C:\> $n[1,1]=2

PS C:\> $n

SparseMatrix 2x2-Single 50.00 % Filled

1 0

0 2

PS C:\> inv $n

SparseMatrix 2x2-Single 50.00 % Filled

1 0

0 0.5

PS C:\> $p = $m * $n

PS C:\> $p

SparseMatrix 2x2-Single 100.00 % Filled

1 10

5 18

PS C:\> trc $p

19

PS C:\> det $p

-32

PS C:\> t $p

SparseMatrix 2x2-Single 100.00 % Filled

1 5

10 18

PS C:\> m "1 0" | t

SparseMatrix 2x1-Single 50.00 % Filled

1

0

PS C:\> m -rows 2 -columns 1

SparseMatrix 2x1-Single 0.00 % Filled

0

0

PS C:\> $o = m -matrixFile Samples\sampleMatrix.txt

PS C:\> $o

SparseMatrix 3x3-Single 100.00 % Filled

1 5 6

7 8 9

6 5 4

PS C:\> $o.Diagonal()

1

8

4

Last edited Jun 28, 2013 at 2:27 AM by firazsamet, version 3