gov.sandia.cognition.math.matrix.mtj
Class SparseVectorFactoryMTJ

java.lang.Object
  extended by gov.sandia.cognition.math.matrix.VectorFactory<VectorType>
      extended by gov.sandia.cognition.math.matrix.SparseVectorFactory<SparseVector>
          extended by gov.sandia.cognition.math.matrix.mtj.SparseVectorFactoryMTJ
All Implemented Interfaces:
Serializable

public class SparseVectorFactoryMTJ
extends SparseVectorFactory<SparseVector>

Factory for MTJ's SparseVector

Since:
1.0
Author:
Kevin R. Dixon
See Also:
Serialized Form

Field Summary
static SparseVectorFactoryMTJ INSTANCE
          Default instance of this
 
Fields inherited from class gov.sandia.cognition.math.matrix.VectorFactory
DEFAULT_DENSE_INSTANCE, DEFAULT_SPARSE_INSTANCE
 
Constructor Summary
SparseVectorFactoryMTJ()
          Creates a new instance of SparseVectorFactoryMTJ
 
Method Summary
 SparseVector copyVector(Vector m)
          Creates a deep copy new Vector given another, argument is unchanged
 SparseVector createVector(int dim)
          Creates an empty Vector of the specified dimension, all elements must be all zeros!
 Vector1D createVector1D(double x)
          Creates a one-dimensional vector with the given x coordinate: (x).
 Vector2 createVector2D(double x, double y)
          Creates a two-dimensional vector with the given x and y coordinates: (x, y).
 Vector3 createVector3D(double x, double y, double z)
          Creates a three-dimensional vector with the given x, y, and z coordinates: (x, y, z).
 SparseVector createVectorCapacity(int dimensionality, int initialCapacity)
          Creates a new, empty vector with the given dimensionality and expected number of nonzero elements.
 SparseVector createWrapper(no.uib.cipr.matrix.sparse.SparseVector internalVector)
          Creates a new wrapper for a sparse MTJ vector.
 
Methods inherited from class gov.sandia.cognition.math.matrix.SparseVectorFactory
getDefault
 
Methods inherited from class gov.sandia.cognition.math.matrix.VectorFactory
copyArray, copyArray, copyValues, copyValues, createUniformRandom, createVector, createVector1D, createVector2D, createVector3D, getDenseDefault, getSparseDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final SparseVectorFactoryMTJ INSTANCE
Default instance of this

Constructor Detail

SparseVectorFactoryMTJ

public SparseVectorFactoryMTJ()
Creates a new instance of SparseVectorFactoryMTJ

Method Detail

copyVector

public SparseVector copyVector(Vector m)
Description copied from class: VectorFactory
Creates a deep copy new Vector given another, argument is unchanged

Specified by:
copyVector in class VectorFactory<SparseVector>
Parameters:
m - Vector to copy
Returns:
Deep copy of the given Vector

createVector

public SparseVector createVector(int dim)
Description copied from class: VectorFactory
Creates an empty Vector of the specified dimension, all elements must be all zeros!

Specified by:
createVector in class VectorFactory<SparseVector>
Parameters:
dim - number of elements in the Vector
Returns:
A new Vector or the given dimensionality with all zero elements.

createVectorCapacity

public SparseVector createVectorCapacity(int dimensionality,
                                         int initialCapacity)
Description copied from class: SparseVectorFactory
Creates a new, empty vector with the given dimensionality and expected number of nonzero elements.

Specified by:
createVectorCapacity in class SparseVectorFactory<SparseVector>
Parameters:
dimensionality - The dimensionality for the vector to create.
initialCapacity - The expected initial number of nonzero elements of the vector to create.
Returns:
A new sparse vector with the given dimensionality and number of nonzeros.

createVector1D

public Vector1D createVector1D(double x)
Description copied from class: VectorFactory
Creates a one-dimensional vector with the given x coordinate: (x). This is useful mainly for creating a vector wrapper for the double.

Specified by:
createVector1D in class VectorFactory<SparseVector>
Parameters:
x - The x coordinate.
Returns:
A new one-dimensional vector with the given coordinate.

createVector2D

public Vector2 createVector2D(double x,
                              double y)
Description copied from class: VectorFactory
Creates a two-dimensional vector with the given x and y coordinates: (x, y).

Specified by:
createVector2D in class VectorFactory<SparseVector>
Parameters:
x - The x coordinate.
y - The y coordinate.
Returns:
A new two-dimensional vector with the given coordinates.

createVector3D

public Vector3 createVector3D(double x,
                              double y,
                              double z)
Description copied from class: VectorFactory
Creates a three-dimensional vector with the given x, y, and z coordinates: (x, y, z).

Specified by:
createVector3D in class VectorFactory<SparseVector>
Parameters:
x - The x coordinate.
y - The y coordinate.
z - The z coordinate.
Returns:
A new three-dimensional vector with the given coordinates.

createWrapper

public SparseVector createWrapper(no.uib.cipr.matrix.sparse.SparseVector internalVector)
Creates a new wrapper for a sparse MTJ vector.

Parameters:
internalVector - The MTJ vector to wrap.
Returns:
A wrapper of the given MTJ vector.