linearalgebra
Class VectorSpace

java.lang.Object
  extended by linearalgebra.VectorSpace
All Implemented Interfaces:
VectorSpaceInterface

public class VectorSpace
extends java.lang.Object
implements VectorSpaceInterface


Field Summary
private  NumericMatrixInterface invL
           
private  NumericMatrixInterface L
           
private  NumericMatrixInterface m
           
private  int[] m_basisColumns
           
private  int[] m_basisRows
           
private  int m_nDimension
           
private  int m_nRank
           
private  PermutationMatrix p
           
private  NumericMatrixInterface U
           
 
Constructor Summary
VectorSpace(NumericMatrixInterface m)
           
VectorSpace(NumericVectorInterface[] columns)
           
 
Method Summary
 boolean areIndependentColumns()
          Returns true if all non-trivial combinations of all column vectors are non-zero.
 boolean areOrthogonalColumns()
           
 int[] getBasisColumns()
          Returns the columns for the column basis
 int[] getBasisRows()
           
 int getColumnCount()
          Returns the number of column vectors used to define this space.
 VectorSpaceInterface getColumnSpace()
          A basis for a vector space is the set of column vectors such that all vectors are linearly independent and the set spans the space.
 VectorInterface getColumnVector(int colIndex)
          Returns one of the column vectors of the space.
 int getDimension()
          All bases of this space have the same number of vectors.
private  NumericMatrixInterface getInverseL()
           
private  NumericMatrixInterface getL()
           
 VectorSpaceInterface getLeftNullspace()
           
 NumericMatrixInterface getMatrix()
           
private  NumericMatrixInterface getMatrixColumns(NumericMatrixInterface m2, int[] colList)
           
private  NumericMatrixInterface getMatrixRows(NumericMatrixInterface m2, int[] rowList)
           
 VectorSpaceInterface getNullspace()
           
private  PermutationMatrix getP()
           
 int getRank()
          Returns the number of non-zero pivots in U after the system A describing the vector space has been factored into A=LU.
 VectorSpaceInterface getRowSpace()
          Returns the space spanned by all of the rows
 VectorSpaceInterface getSubspace(VectorInterface v)
           
private  NumericMatrixInterface getU()
           
 boolean hasExistence()
          There is 1 to infinite solutions.
 boolean hasUniqueness()
          There is 0 or 1 solution At most one solution.
 boolean isInconsistent()
          For the system ax=b describing this space, if a=0 and b!=0 there are an zero number of solutions.
 boolean isMember(NumericVectorInterface v)
          The space is defined by the system ax=b.
 boolean isNonsingular()
          For the system ax=b that describes the space, return true if a!=0.
 boolean isOrthogonal(VectorSpaceInterface vs)
           
 boolean isSubspace(VectorSpaceInterface v)
          Returns true if all vectors in v are contained in this space.
 boolean isUnderdetermined()
          For the system ax=b describing this space, if a=0 and b=0 there are an infinite number of solutions.
 boolean normalizeColumns()
           
 boolean spansSpace(VectorSpaceInterface v)
          Checks if all of the vectors in v can be described by a linear combination of the vectors in this space.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m

private NumericMatrixInterface m

m_basisColumns

private int[] m_basisColumns

m_basisRows

private int[] m_basisRows

m_nRank

private int m_nRank

m_nDimension

private int m_nDimension

L

private NumericMatrixInterface L

U

private NumericMatrixInterface U

p

private PermutationMatrix p

invL

private NumericMatrixInterface invL
Constructor Detail

VectorSpace

public VectorSpace(NumericMatrixInterface m)

VectorSpace

public VectorSpace(NumericVectorInterface[] columns)
Method Detail

getMatrix

public NumericMatrixInterface getMatrix()
Specified by:
getMatrix in interface VectorSpaceInterface

areIndependentColumns

public boolean areIndependentColumns()
Description copied from interface: VectorSpaceInterface
Returns true if all non-trivial combinations of all column vectors are non-zero.

Specified by:
areIndependentColumns in interface VectorSpaceInterface

areOrthogonalColumns

public boolean areOrthogonalColumns()
Specified by:
areOrthogonalColumns in interface VectorSpaceInterface

normalizeColumns

public boolean normalizeColumns()
Specified by:
normalizeColumns in interface VectorSpaceInterface

getBasisColumns

public int[] getBasisColumns()
Description copied from interface: VectorSpaceInterface
Returns the columns for the column basis

Specified by:
getBasisColumns in interface VectorSpaceInterface

getBasisRows

public int[] getBasisRows()

getMatrixRows

private NumericMatrixInterface getMatrixRows(NumericMatrixInterface m2,
                                             int[] rowList)

getMatrixColumns

private NumericMatrixInterface getMatrixColumns(NumericMatrixInterface m2,
                                                int[] colList)

getColumnCount

public int getColumnCount()
Description copied from interface: VectorSpaceInterface
Returns the number of column vectors used to define this space. This number may change as the space is manipulated.

Specified by:
getColumnCount in interface VectorSpaceInterface

getColumnVector

public VectorInterface getColumnVector(int colIndex)
Description copied from interface: VectorSpaceInterface
Returns one of the column vectors of the space.

Specified by:
getColumnVector in interface VectorSpaceInterface

getRank

public int getRank()
Description copied from interface: VectorSpaceInterface
Returns the number of non-zero pivots in U after the system A describing the vector space has been factored into A=LU.

Specified by:
getRank in interface VectorSpaceInterface

getDimension

public int getDimension()
Description copied from interface: VectorSpaceInterface
All bases of this space have the same number of vectors. This number is called the degree of freedom, or the dimension, of the space. Note that this is a different concept than the dimension of a vector.

Specified by:
getDimension in interface VectorSpaceInterface

getSubspace

public VectorSpaceInterface getSubspace(VectorInterface v)
Specified by:
getSubspace in interface VectorSpaceInterface

isInconsistent

public boolean isInconsistent()
Description copied from interface: VectorSpaceInterface
For the system ax=b describing this space, if a=0 and b!=0 there are an zero number of solutions. No x satisfies 0x=b.

Specified by:
isInconsistent in interface VectorSpaceInterface

isMember

public boolean isMember(NumericVectorInterface v)
Description copied from interface: VectorSpaceInterface
The space is defined by the system ax=b. Returns true if a solution exists for ax=v meaning v is located in the hyper-plane defined by this space. Returns false otherwise.

Specified by:
isMember in interface VectorSpaceInterface
Parameters:
v - The vector to check for membership.

isNonsingular

public boolean isNonsingular()
Description copied from interface: VectorSpaceInterface
For the system ax=b that describes the space, return true if a!=0. There exists a single solution to ax=b. Returns false otherwise.

Specified by:
isNonsingular in interface VectorSpaceInterface

isSubspace

public boolean isSubspace(VectorSpaceInterface v)
Description copied from interface: VectorSpaceInterface
Returns true if all vectors in v are contained in this space.

Specified by:
isSubspace in interface VectorSpaceInterface

isUnderdetermined

public boolean isUnderdetermined()
Description copied from interface: VectorSpaceInterface
For the system ax=b describing this space, if a=0 and b=0 there are an infinite number of solutions. Any x satisfies 0x=0.

Specified by:
isUnderdetermined in interface VectorSpaceInterface

spansSpace

public boolean spansSpace(VectorSpaceInterface v)
Description copied from interface: VectorSpaceInterface
Checks if all of the vectors in v can be described by a linear combination of the vectors in this space. If so, then v spans this.

Specified by:
spansSpace in interface VectorSpaceInterface
Parameters:
v - A vector space that may span this space.
Returns:
Returns true if v spans this space. Returns false otherwise.

getRowSpace

public final VectorSpaceInterface getRowSpace()
Description copied from interface: VectorSpaceInterface
Returns the space spanned by all of the rows

Specified by:
getRowSpace in interface VectorSpaceInterface

getNullspace

public VectorSpaceInterface getNullspace()
Specified by:
getNullspace in interface VectorSpaceInterface

getColumnSpace

public VectorSpaceInterface getColumnSpace()
Description copied from interface: VectorSpaceInterface
A basis for a vector space is the set of column vectors such that all vectors are linearly independent and the set spans the space.

Specified by:
getColumnSpace in interface VectorSpaceInterface

getLeftNullspace

public VectorSpaceInterface getLeftNullspace()
Specified by:
getLeftNullspace in interface VectorSpaceInterface

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getU

private NumericMatrixInterface getU()

getP

private PermutationMatrix getP()

getL

private NumericMatrixInterface getL()

getInverseL

private NumericMatrixInterface getInverseL()

hasExistence

public boolean hasExistence()
Description copied from interface: VectorSpaceInterface
There is 1 to infinite solutions. At least one solution.

Specified by:
hasExistence in interface VectorSpaceInterface

hasUniqueness

public boolean hasUniqueness()
Description copied from interface: VectorSpaceInterface
There is 0 or 1 solution At most one solution.

Specified by:
hasUniqueness in interface VectorSpaceInterface

isOrthogonal

public boolean isOrthogonal(VectorSpaceInterface vs)
Specified by:
isOrthogonal in interface VectorSpaceInterface