gov.sandia.cognition.math.matrix.custom

## Class CustomSparseVectorFactory

• All Implemented Interfaces:
java.io.Serializable

```public class CustomSparseVectorFactory
extends VectorFactory<SparseVector>```
Generates Sparse Vectors with all settings initialized properly
Since:
4.0.0
Author:
Jeremy D. Wendt
Serialized Form
• ### Field Summary

Fields
Modifier and Type Field and Description
`static CustomSparseVectorFactory` `INSTANCE`
An instance of this class.
• ### Fields inherited from class gov.sandia.cognition.math.matrix.VectorFactory

`DEFAULT_DENSE_INSTANCE, DEFAULT_SPARSE_INSTANCE`
• ### Constructor Summary

Constructors
Constructor and Description
`CustomSparseVectorFactory()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`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).
`Vector2D` ```createVector2D(double x, double y)```
Creates a two-dimensional vector with the given x and y coordinates: (x, y).
`Vector3D` ```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.
`MatrixFactory<?>` `getAssociatedMatrixFactory()`
Gets the matrix factory implementation associated with this vector factory.
• ### Methods inherited from class gov.sandia.cognition.math.matrix.VectorFactory

`copyArray, copyArray, copyMap, copyValues, copyValues, createGaussianRandom, createUniformRandom, createUniformRandom, createVector, createVector1D, createVector2D, createVector3D, getDefault, 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 CustomSparseVectorFactory INSTANCE`
An instance of this class.
• ### Constructor Detail

• #### CustomSparseVectorFactory

`public CustomSparseVectorFactory()`
• ### Method Detail

• #### copyVector

`public final 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 final 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.
• #### createVector1D

`public final Vector1D createVector1D(double x)`
Creates a one-dimensional vector with the given x coordinate: (x). This is useful mainly for creating a vector wrapper for the double. NOTE: This produces a dense vector because a sparse vector with one element is less memory efficient.
Specified by:
`createVector1D` in class `VectorFactory<SparseVector>`
Parameters:
`x` - The x coordinate.
Returns:
A new one-dimensional vector with the given coordinate.
• #### createVector2D

```public final Vector2D createVector2D(double x,
double y)```
Creates a two-dimensional vector with the given x and y coordinates: (x, y). NOTE: This produces a dense vector because a sparse vector with one element is less memory efficient than a dense vector with two elements.
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 final Vector3D createVector3D(double x,
double y,
double z)```
Creates a three-dimensional vector with the given x, y, and z coordinates: (x, y, z). NOTE: This produces a dense vector because a sparse vector with two elements is less memory efficient than a dense vector with three elements.
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.
• #### getAssociatedMatrixFactory

`public MatrixFactory<?> getAssociatedMatrixFactory()`
Description copied from class: `VectorFactory`
Gets the matrix factory implementation associated with this vector factory.
Specified by:
`getAssociatedMatrixFactory` in class `VectorFactory<SparseVector>`
Returns:
The associated matrix factory.
• #### createVectorCapacity

```public SparseVector createVectorCapacity(int dimensionality,
int initialCapacity)```
Description copied from class: `VectorFactory`
Creates a new, empty vector with the given dimensionality and expected number of nonzero elements.
Specified by:
`createVectorCapacity` in class `VectorFactory<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 vector with the given dimensionality and capacity for at least the given number of nonzeros.