Class FeatureBlockVector
-
- All Implemented Interfaces:
public final class FeatureBlockVector extends RealVectorA lightweight RealVector implementation backed by a FeatureBlock.
Unlike ArrayRealVector, this class does NOT hold its own
double[]data array. Instead, all get/set operations are delegated to the shared FeatureBlock, which stores all node feature vectors in a single contiguous DoubleArray.This dramatically reduces heap object count: for a document with N nodes, we go from N
double[]arrays (one perArrayRealVector) to a singleDoubleArrayin the block.Only the core accessor methods (getEntry, setEntry, getDimension) are supported; vector-arithmetic methods (append, ebeMultiply, ebeDivide, etc.) throw UnsupportedOperationException as they are never used in feature access patterns.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classFeatureBlockVector.Companion
-
Field Summary
Fields Modifier and Type Field Description public final static FeatureBlockVector.CompanionCompanion
-
Constructor Summary
Constructors Constructor Description FeatureBlockVector(FeatureBlock block, Integer nodeIndex, Integer dimension)
-
Method Summary
Modifier and Type Method Description IntegergetDimension()DoublegetEntry(Integer index)UnitsetEntry(Integer index, Double value)RealVectorcopy()Creates an independent copy of this row as an ArrayRealVector. RealVectorappend(RealVector v)RealVectorappend(Double d)RealVectorgetSubVector(Integer index, Integer n)VoidsetSubVector(Integer index, RealVector v)BooleanisNaN()BooleanisInfinite()RealVectorebeDivide(RealVector v)RealVectorebeMultiply(RealVector v)-
Methods inherited from class org.apache.commons.math3.linear.RealVector
add, addToEntry, combine, combineToSelf, cosine, dotProduct, equals, getDistance, getL1Distance, getL1Norm, getLInfDistance, getLInfNorm, getMaxIndex, getMaxValue, getMinIndex, getMinValue, getNorm, hashCode, iterator, map, mapAdd, mapAddToSelf, mapDivide, mapDivideToSelf, mapMultiply, mapMultiplyToSelf, mapSubtract, mapSubtractToSelf, mapToSelf, outerProduct, projection, set, sparseIterator, subtract, toArray, unitVector, unitize, walkInDefaultOrder, walkInDefaultOrder, walkInDefaultOrder, walkInDefaultOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
FeatureBlockVector
FeatureBlockVector(FeatureBlock block, Integer nodeIndex, Integer dimension)
- Parameters:
block- The shared feature block for the documentnodeIndex- The index of this node within the document (0-based)dimension- The number of features per node
-
-
Method Detail
-
getDimension
Integer getDimension()
-
copy
RealVector copy()
Creates an independent copy of this row as an ArrayRealVector. The copy owns its own data and is detached from the FeatureBlock.
-
append
RealVector append(RealVector v)
-
getSubVector
RealVector getSubVector(Integer index, Integer n)
-
setSubVector
Void setSubVector(Integer index, RealVector v)
-
isInfinite
Boolean isInfinite()
-
ebeDivide
RealVector ebeDivide(RealVector v)
-
ebeMultiply
RealVector ebeMultiply(RealVector v)
-
-
-
-