SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.vector.doubles.dense.operation
Class VectorSpace

java.lang.Object
  extended by com.numericalmethod.suanshu.vector.doubles.dense.operation.VectorSpace

public class VectorSpace
extends java.lang.Object

A vector space is a set of vectors that are closed under some operations.

A basis is a set of vectors that, in a linear combination, can represent every vector in a given vector space, and such 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()).

See Also:

Field Summary
 double epsilon
          a precision parameter: when a number |x| ≤ ε, it is considered 0
 
Constructor Summary
VectorSpace(double epsilon, Vector... elements)
          Construct a vector space from an array of vectors.
VectorSpace(Matrix A)
          Construct a vector space from a matrix (a set of column vectors).
VectorSpace(Matrix A, double epsilon)
          Construct a vector space from a matrix (a set of column vectors).
VectorSpace(Vector... elements)
          Construct a vector space from an array of vectors.
VectorSpace(VectorList elements)
          Construct a vector space from a list of vectors.
VectorSpace(VectorList elements, double epsilon)
          Construct a vector space from a list of vectors.
 
Method Summary
 VectorList basis()
          Get a copy of the orthogonal basis.
 VectorList complement()
          Get a copy of the basis of the orthogonal complement.
 boolean isInKernel(Vector b)
          Deprecated. Not supported yet.
 boolean isSpanned(Vector b)
          Check whether a vector is in the span of the the basis.
 Vector linearSpan(double... d)
          Deprecated. Not supported yet.
 int rank()
          Get the rank of this vector space.
 Vector spanningCoefficients(Vector b)
          Find a linear combination of the basis that best approximates a vector in the linear least square sense.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

epsilon

public final double epsilon
a precision parameter: when a number |x| ≤ ε, it is considered 0

Constructor Detail

VectorSpace

public VectorSpace(VectorList elements,
                   double epsilon)
Construct a vector space from a list of vectors. This computes the orthogonal basis and orthogonal complement.

Parameters:
elements - a list of 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.

VectorSpace

public VectorSpace(VectorList elements)
Construct a vector space from a list of vectors. This computes the orthogonal basis and orthogonal complement.

Parameters:
elements - a list of vectors

VectorSpace

public VectorSpace(double epsilon,
                   Vector... elements)
Construct a vector space from an array of vectors. This computes the orthogonal basis and 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

VectorSpace

public VectorSpace(Vector... elements)
Construct a vector space from an array of vectors. This computes the orthogonal basis and orthogonal complement.

Parameters:
elements - a list of vectors

VectorSpace

public VectorSpace(Matrix A,
                   double epsilon)
Construct a vector space from a matrix (a set of column vectors). This computes the orthogonal basis and 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.

VectorSpace

public VectorSpace(Matrix A)
Construct a vector space from a matrix (a set of column vectors). This computes the orthogonal basis and orthogonal complement.

Parameters:
A - a matrix, i.e., (a set of column vectors)
Method Detail

rank

public int rank()
Get the rank of this vector space.

Returns:
the rank

basis

public VectorList basis()
Get a copy of the orthogonal basis.

Returns:
a copy of the orthogonal basis

complement

public VectorList complement()
Get a copy of the basis of the orthogonal complement.

Returns:
a copy of the orthogonal basis of the nullspace

linearSpan

@Deprecated
public Vector linearSpan(double... d)
Deprecated. Not supported yet.

Get the linear span of the orthogonal basis from a set of coefficients.

Parameters:
d - an array of coefficients.
Returns:
a vector which is a span of the basis

spanningCoefficients

public Vector spanningCoefficients(Vector b)
Find a linear combination of the basis that best approximates a vector in the linear least square sense. This is accomplished by solving an OLS problem.

Parameters:
b - a vector
Returns:
the coefficients for a linear combination of basis
See Also:
OLSSolver

isSpanned

public boolean isSpanned(Vector b)
Check whether a vector is in the span of the the basis. That is, whether there exists a linear combination of the basis that equals the vector.

Parameters:
b - a vector
Returns:
true iff b 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 iff b is in the kernel/nullspace of this vector space

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.