Dense matrix class with basic linear algebra operations. Used for graph Laplacian, diffusion kernel, and PageRank computations. All operations use only basic .NET math functions.
Matrix
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| .ctor | 2 | Create a matrix from a 2D array |
| Identity | 1 | Create an identity matrix of size n |
| Diagonal | 1 | Create a diagonal matrix from a vector |
| Zeros | 1 | Create a zero matrix |
| Clone | 1 | Clone this matrix |
| op_Addition | 1 | Matrix addition |
| op_Subtraction | 1 | Matrix subtraction |
| op_Multiply | 3 | Matrix multiplication |
| MultiplyVector | 1 | Matrix-vector multiplication: result = M * v |
| Transpose | 1 | Transpose |
| Solve | 1 | Solve linear system Ax = b using Gaussian elimination with partial pivoting. |
| SolveIterative | 1 | Solve linear system Ax = b using iterative Gauss-Seidel method. |
| Inverse | 1 | Compute matrix inverse using Gaussian elimination. |
| GetRow | 1 | Get a row as a vector |
| GetColumn | 1 | Get a column as a vector |
| SetRow | 1 | Set a row from a vector |
| SetColumn | 1 | Set a column from a vector |
| RowSums | 1 | Compute row sums as a vector |
| ColumnSums | 1 | Compute column sums as a vector |
| Abs | 1 | Element-wise absolute value |
| FrobeniusNorm | 1 | Frobenius norm |
| FromColumns | 1 | Create matrix from column vectors (each vector is a column) |
| ToString | 1 |
03 Properties
04 Members
Int32, Int32)Create an empty matrix of given dimensions
Double[0:,0:])Create a matrix from a 2D array
Int32)Create an identity matrix of size n
Double())Create a diagonal matrix from a vector
Int32, Int32)Create a zero matrix
Clone this matrix
Matrix addition
Matrix subtraction
Double)Scalar multiplication
Double, Matrix)Scalar multiplication (commutative)
Matrix multiplication
Double())Matrix-vector multiplication: result = M * v
Transpose
Double())Solve linear system Ax = b using Gaussian elimination with partial pivoting. Returns solution vector x.
Solve linear system Ax = b using iterative Gauss-Seidel method. More memory-efficient for large sparse-like systems.
Compute matrix inverse using Gaussian elimination. Returns A^{-1}.
Int32)Get a row as a vector
Int32)Get a column as a vector
Int32, Double())Set a row from a vector
Int32, Double())Set a column from a vector
Compute row sums as a vector
Compute column sums as a vector
Element-wise absolute value
Frobenius norm
Double()())Create matrix from column vectors (each vector is a column)
Number of rows
Number of columns
Int32, Int32)Access element at (i, j)
Get the underlying 2D array (copy)