jsat.linear
Class ConcatenatedVec
- java.lang.Object
-
- jsat.linear.Vec
-
- jsat.linear.ConcatenatedVec
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<IndexValue>
public class ConcatenatedVec extends Vec
ConcatenatedVec provides a light wrapper around a list of vectors to provide a view of one single vector that's length is the sum of the lengths of the inputs.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ConcatenatedVec(java.util.List<Vec> vecs)Creates a new Vector that is the concatenation of the given vectors in the given order.ConcatenatedVec(Vec... vecs)Creates a new Vector that is the concatenation of the given vectors in the given order.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description ConcatenatedVecclone()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.voidincrement(int index, double val)Increments the value stored at a specified index in the vectorbooleanisSparse()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 vectorvoidmutableAdd(double c, Vec b)Alters this vector such that this = this + c * b
This method should be overloaded for a serious implementation.intnnz()Computes the number of non zero values in 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, iterator, kurtosis, max, mean, median, min, multiply, multiply, multiply, multiply, mutableAdd, mutableAdd, mutableDivide, mutableMultiply, mutablePairwiseDivide, mutablePairwiseMultiply, mutableSubtract, mutableSubtract, mutableSubtract, normalize, normalized, pairwiseDivide, pairwiseMultiply, pNorm, pNormDist, random, random, skewness, sortedCopy, standardDeviation, subtract, subtract, sum, toString, variance, zeroOut, zeros
-
-
-
-
Constructor Detail
-
ConcatenatedVec
public ConcatenatedVec(java.util.List<Vec> vecs)
Creates a new Vector that is the concatenation of the given vectors in the given order. The vector created is backed by the ones provided, and any mutation to one is visible in the others.- Parameters:
vecs- the list of vectors to concatenate
-
ConcatenatedVec
public ConcatenatedVec(Vec... vecs)
Creates a new Vector that is the concatenation of the given vectors in the given order. The vector created is backed by the ones provided, and any mutation to one is visible in the others.- Parameters:
vecs- the array of vectors to concatenate
-
-
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
-
increment
public void increment(int index, double val)Description copied from class:VecIncrements the value stored at a specified index in the vector
-
nnz
public int nnz()
Description copied from class:VecComputes the number of non zero values in this vector
-
mutableAdd
public void mutableAdd(double c, Vec b)Description copied from class:VecAlters this vector such that this = this + c * b
This method should be overloaded for a serious implementation.- Overrides:
mutableAddin classVec- Parameters:
c- a scalar constantb- the vector to add to this
-
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
-
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.
-
clone
public ConcatenatedVec clone()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG