diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 19e3ecf2..11c0afde 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -81,6 +81,7 @@ Changes as of now:
- Matrix.ClearSubMatrix no longer throws on 0 or negative col/row count (nop)
- BUG: Fix bug in routine to copy a vector into a sub-row of a matrix.
- Both canonical modulus and remainder operations on matrices and vectors.
+- Matrix kernel (null space) and range (column space)
### Linear Algebra MKL Native Provider
diff --git a/src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs b/src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs
index 4d3d3e36..1eede533 100644
--- a/src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs
+++ b/src/Numerics/LinearAlgebra/Matrix.Arithmetic.cs
@@ -29,6 +29,7 @@
//
using System;
+using System.Linq;
using MathNet.Numerics.Properties;
namespace MathNet.Numerics.LinearAlgebra
@@ -1312,7 +1313,7 @@ namespace MathNet.Numerics.LinearAlgebra
public abstract T Trace();
///
- /// Calculates the rank of the matrix
+ /// Calculates the rank of the matrix.
///
/// effective numerical rank, obtained from SVD
public virtual int Rank()
@@ -1320,6 +1321,15 @@ namespace MathNet.Numerics.LinearAlgebra
return Svd(false).Rank;
}
+ ///
+ /// Calculates the nullity of the matrix.
+ ///
+ /// effective numerical nullity, obtained from SVD
+ public int Nullity()
+ {
+ return ColumnCount - Rank();
+ }
+
/// Calculates the condition number of this matrix.
/// The condition number of the matrix.
/// The condition number is calculated using singular value decomposition.
@@ -1340,6 +1350,26 @@ namespace MathNet.Numerics.LinearAlgebra
return LU().Determinant;
}
+ ///
+ /// Computes an orthonormal basis for the null space of this matrix,
+ /// also known as the kernel of the corresponding matrix transformation.
+ ///
+ public virtual Vector[] Kernel()
+ {
+ var svd = Svd(true);
+ return svd.VT.EnumerateRows(svd.Rank, ColumnCount - svd.Rank).ToArray();
+ }
+
+ ///
+ /// Computes an orthonormal basis for the column space of this matrix,
+ /// also known as the range or image of the corresponding matrix transformation.
+ ///
+ public virtual Vector[] Range()
+ {
+ var svd = Svd(true);
+ return svd.U.EnumerateColumns(0, svd.Rank).ToArray();
+ }
+
/// Computes the inverse of this matrix.
/// The inverse of this matrix.
public virtual Matrix Inverse()
@@ -1357,7 +1387,7 @@ namespace MathNet.Numerics.LinearAlgebra
/// with M = this.Rows * lower.Rows and N = this.Columns * lower.Columns.
///
/// The other matrix.
- /// The kronecker product of the two matrices.
+ /// The Kronecker product of the two matrices.
public Matrix KroneckerProduct(Matrix other)
{
var result = Build.SameAs(this, other, RowCount*other.RowCount, ColumnCount*other.ColumnCount);
@@ -1370,7 +1400,7 @@ namespace MathNet.Numerics.LinearAlgebra
/// with M = this.Rows * lower.Rows and N = this.Columns * lower.Columns.
///
/// The other matrix.
- /// The kronecker product of the two matrices.
+ /// The Kronecker product of the two matrices.
/// If the result matrix's dimensions are not (this.Rows * lower.rows) x (this.Columns * lower.Columns).
public virtual void KroneckerProduct(Matrix other, Matrix result)
{