Class RealVectorSpace
- java.lang.Object
-
- dev.nm.algebra.linear.vector.doubles.operation.RealVectorSpace
-
public class RealVectorSpace extends Object
A vector space is a set of vectors that are closed under some operations. The basis of a vector space is a set of vectors that, in a linear combination, can represent every vector in the space, and that no element of the set can be represented as a linear combination of the others. In other words, a basis is a linearly independent spanning set. The orthogonal complement A⊥ of a subspace A of an inner product space V is the set of all vectors in V that are orthogonal to every vector in A. Informally, it is called the perp, short for perpendicular complement. For an m x n matrix A, where m ≥ n, the orthogonal basis are the orthogonalization of the columns. The orthogonal complement is A⊥ = Null(A.t()).
-
-
Constructor Summary
Constructors Constructor Description RealVectorSpace(double epsilon, Vector... elements)
Construct a vector space from an array of vectors.RealVectorSpace(Matrix A)
Construct a vector space from a matrix (a set of column vectors).RealVectorSpace(Matrix A, double epsilon)
Construct a vector space from a matrix (a set of column vectors).RealVectorSpace(Vector... elements)
Construct a vector space from an array of vectors.RealVectorSpace(List<Vector> elements)
Construct a vector space from a list of vectors.RealVectorSpace(List<Vector> elements, double epsilon)
Construct a vector space from a list of vectors.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<Vector>
getBasis()
Get the orthogonal basis.List<Vector>
getComplement()
Get the basis of the orthogonal complement.Vector
getLinearSpan(double... d)
Deprecated.Not supported yet.Vector
getSpanningCoefficients(Vector b)
Find a linear combination of the basis that best approximates a vector in the least square sense.boolean
isInKernel(Vector b)
Deprecated.Not supported yet.boolean
isSpanned(Vector b)
Check whether a vector is in the span of the basis.int
rank()
Get the rank of this vector space.
-
-
-
Constructor Detail
-
RealVectorSpace
public RealVectorSpace(Matrix A, double epsilon)
Construct a vector space from a matrix (a set of column vectors). This implementation computes the orthogonal basis and the orthogonal complement.- Parameters:
A
- a matrix, i.e., (a set of column vectors)epsilon
- a precision parameter: when a number |x| ≤ ε, it is considered 0. The ε is used to determine the numerical rank of the linear space.
-
RealVectorSpace
public RealVectorSpace(Matrix A)
Construct a vector space from a matrix (a set of column vectors). This implementation computes the orthogonal basis and the orthogonal complement.- Parameters:
A
- a matrix, i.e., (a set of column vectors)
-
RealVectorSpace
public RealVectorSpace(List<Vector> elements, double epsilon)
Construct a vector space from a list of vectors. This implementation computes the orthogonal basis and the orthogonal complement.- Parameters:
elements
- a list of vectorsepsilon
- a precision parameter: when a number |x| ≤ ε, it is considered 0. The ε is used to determine the numerical rank of the linear space.
-
RealVectorSpace
public RealVectorSpace(List<Vector> elements)
Construct a vector space from a list of vectors. This implementation computes the orthogonal basis and the orthogonal complement.- Parameters:
elements
- a list of vectors
-
RealVectorSpace
public RealVectorSpace(double epsilon, Vector... elements)
Construct a vector space from an array of vectors. This implementation computes the orthogonal basis and the orthogonal complement.- Parameters:
epsilon
- a precision parameter: when a number |x| ≤ ε, it is considered 0. The ε is used to determine the numerical rank of the linear space.elements
- a list of vectors
-
RealVectorSpace
public RealVectorSpace(Vector... elements)
Construct a vector space from an array of vectors. This implementation computes the orthogonal basis and the orthogonal complement.- Parameters:
elements
- a list of vectors
-
-
Method Detail
-
rank
public int rank()
Get the rank of this vector space.- Returns:
- the rank
-
getComplement
public List<Vector> getComplement()
Get the basis of the orthogonal complement.- Returns:
- the orthogonal basis of the nullspace
-
getLinearSpan
@Deprecated public Vector getLinearSpan(double... d)
Deprecated.Not supported yet.Get the linear span of the orthogonal basis from a set of coefficients.- Parameters:
d
- coefficients- Returns:
- a span of the basis
-
getSpanningCoefficients
public Vector getSpanningCoefficients(Vector b)
Find a linear combination of the basis that best approximates a vector in the least square sense. This implementation solves an OLS problem.- Parameters:
b
- a vector- Returns:
- the coefficients for a linear combination of basis;
null
ifb
is not in the vector space - See Also:
OLSSolver
-
isSpanned
public boolean isSpanned(Vector b)
Check whether a vector is in the span of the basis. That is, whether there exists a linear combination of the basis that equals the vector.- Parameters:
b
- a vector- Returns:
true
ifb
is in this vector space
-
isInKernel
@Deprecated public boolean isInKernel(Vector b)
Deprecated.Not supported yet.Check whether a vector is in the span of the the kernel/nullspace. That is, whether there exists a linear combination of the basis of the kernel that equals the vector.- Parameters:
b
- a vector- Returns:
true
ifb
is in the kernel/nullspace of this vector space
-
-