jsat.linear
Class SubVector
- java.lang.Object
-
- jsat.linear.Vec
-
- jsat.linear.SubVector
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<IndexValue>
public class SubVector extends Vec
SubVector takes an already existing vector and creates a new one that is a subset of and backed by the original one. Altering the sub vector will effect the original and vise versa.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description SubVector(int startPosition, int length, Vec vec)Creates a new sub vector of the input vector
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Vecclone()doubleget(int index)Gets the value stored at a specific index in the vectorjava.util.Iterator<IndexValue>getNonZeroIterator(int start)Returns an iterator that will go over the non zero values starting from the specified index in the given vector.booleanisSparse()Indicates whether or not this vector is optimized for sparce computation, meaning that most values in the vector are zero - and considered implicit.intlength()Returns the length of this vectorvoidset(int index, double val)Sets the value stored at a specified index in the vector-
Methods inherited from class jsat.linear.Vec
add, add, applyFunction, applyIndexFunction, arrayCopy, canBeMutated, copyTo, copyToCol, copyToRow, countNaNs, divide, dot, equals, equals, getNonZeroIterator, hashCode, increment, iterator, kurtosis, max, mean, median, min, multiply, multiply, multiply, multiply, mutableAdd, mutableAdd, mutableAdd, mutableDivide, mutableMultiply, mutablePairwiseDivide, mutablePairwiseMultiply, mutableSubtract, mutableSubtract, mutableSubtract, nnz, normalize, normalized, pairwiseDivide, pairwiseMultiply, pNorm, pNormDist, random, random, skewness, sortedCopy, standardDeviation, subtract, subtract, sum, toString, variance, zeroOut, zeros
-
-
-
-
Constructor Detail
-
SubVector
public SubVector(int startPosition, int length, Vec vec)Creates a new sub vector of the input vector- Parameters:
startPosition- the starting index (inclusive) or the original vectorlength- the length of the new sub vectorvec- the original vector to back this sub vector.
-
-
Method Detail
-
length
public int length()
Description copied from class:VecReturns the length of this vector
-
get
public double get(int index)
Description copied from class:VecGets the value stored at a specific index in the vector
-
set
public void set(int index, double val)Description copied from class:VecSets the value stored at a specified index in the vector
-
isSparse
public boolean isSparse()
Description copied from class:VecIndicates whether or not this vector is optimized for sparce computation, meaning that most values in the vector are zero - and considered implicit. Only non-zero values are stored.
-
getNonZeroIterator
public java.util.Iterator<IndexValue> getNonZeroIterator(int start)
Description copied from class:VecReturns an iterator that will go over the non zero values starting from the specified index in the given vector. The iterator does not support theIterator.remove()method.
This method should be overloaded for a serious implementation.- Overrides:
getNonZeroIteratorin classVec- Parameters:
start- the first index (inclusive) to start returning non-zero values from- Returns:
- an iterator for the non zero index value pairs
-
-
DataMelt 3.0 © DataMelt by jWork.ORG