Class Kernel
- java.lang.Object
-
- dev.nm.algebra.linear.matrix.doubles.linearsystem.Kernel
-
public class Kernel extends Object
The kernel or null space (also nullspace) of a matrix A is the set of all vectors x for which Ax = 0. The kernel of a matrix with n columns is a linear subspace of n-dimensional Euclidean space. Also, the kernel of a matrix A is exactly the same as the kernel of the linear mapping defined by the matrix-vector multiplication, x → Ax. That is, the set of vectors that map to the zero vector. The rank-nullity theorem says that the rank of A + the dimension of the kernel of A = the number of columns in A. The kernel is the solution of a system of homogeneous linear equations. With the transformation matrix T, which turns A into the reduced row echelon form, it can solve also a system of non-homogeneous linear equations. Specifically, to find a particular solution for a non-homogeneous system of linear equations with a matrix A, i.e.,Ax = b
we solveT * A = U
and thenx = T * b
where x is a particular solution.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Kernel.Method
These are the available methods to compute kernel basis.
-
Constructor Summary
Constructors Constructor Description Kernel(Matrix A)
Construct the kernel of a matrix.Kernel(Matrix A, Kernel.Method method, double epsilon)
Construct the kernel of a matrix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Vector>
basis()
Get the kernel basis.Map<Integer,Vector>
basisAndFreeVars()
Get the kernel basis and the associated free variables for each basis/column.boolean
isZero()
Check if the kernel has zero dimension, that is, if A has full rank.int
nullity()
Get the nullity of A.int
rank()
Get the rank of A.Matrix
T()
Get the transformation matrix, T, such that T * A = U.Matrix
U()
Get the upper triangular matrix U, such that T * A = U.
-
-
-
Constructor Detail
-
Kernel
public Kernel(Matrix A, Kernel.Method method, double epsilon)
Construct the kernel of a matrix.- Parameters:
A
- a matrixmethod
- the kernel computation methodepsilon
- a precision parameter: when a number |x| ≤ ε, it is considered 0; the ε is used to determine the numerical rank of the linear space
-
Kernel
public Kernel(Matrix A)
Construct the kernel of a matrix.- Parameters:
A
- a matrix
-
-
Method Detail
-
nullity
public int nullity()
Get the nullity of A. That is, the dimension of the kernel.- Returns:
- the nullity
-
rank
public int rank()
Get the rank of A. That is, the number of linearly independent columns or rows in A.- Returns:
- the rank
-
basisAndFreeVars
public Map<Integer,Vector> basisAndFreeVars()
Get the kernel basis and the associated free variables for each basis/column. This method is only meaningful when the kernel is computed usingKernel.Method.GAUSSIAN_JORDAN_ELIMINATION
. Using this process, a free variable corresponds to an entry '1' in a column. For the example in Wikipedia, x3 (the 3rd variable) is a free variable, and it corresponds to [3,-5,1,0,0,0]t. If the kernel basis is computed using a different method, callbasis()
instead.- Returns:
- a map of indices and kernel basis vectors
- See Also:
- Wikipedia: Basis
-
isZero
public boolean isZero()
Check if the kernel has zero dimension, that is, if A has full rank.- Returns:
true
if the kernel is null
-
T
public Matrix T()
Get the transformation matrix, T, such that T * A = U. To find a particular solution for a non-homogeneous system of linear equations Ax = b, we dox = T * b
where x is a particular solution.- Returns:
- the transformation matrix T
-
U
public Matrix U()
Get the upper triangular matrix U, such that T * A = U.- Returns:
- the U matrix
-
-