mikera.vectorz
Class BitVector
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<java.lang.Double>
-
- mikera.vectorz.AVector
-
- mikera.vectorz.impl.ASizedVector
-
- mikera.vectorz.impl.ABooleanVector
-
- mikera.vectorz.BitVector
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<java.lang.Double>, INDArray, IVector
public final class BitVector extends ABooleanVector
Boolean vector backed by densely packed single bits - constrained to 0.0 / 1.0 values Setting the BitVector will set to 1.0 for any positive values (true) and 0.0 otherwise (false) Intended for compact representation/storage of boolean vectors- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static doubleBIT_OFFstatic doubleBIT_ONstatic doubleBIT_THRESHOLD
-
Constructor Summary
Constructors Constructor and Description BitVector(int length)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static BitVectorcreate(AVector source)static BitVectorcreateLength(int length)doubledotProduct(AVector v)Returns the dot product of this vector with another vector The vectors must have the same length: if not the result is undefineddoubledotProduct(double[] data, int offset)Fast dot product with a double[] array.doubleelementMax()Returns the maximum element value in this array.doubleelementSum()Returns the sum of all elements in a vectorBitVectorexactClone()Returns an exact clone of this vector, i.e.doubleget(int i)Returns the double value at the specified position in a 1D vectorvoidgetElements(double[] data, int offset)Copies all elements of this array a double array at the specified offsetbooleanisFullyMutable()Returns true if this vector is fully mutable, i.e.booleanisMutable()Returns true if this vector is mutable.booleanisView()Returns true if this vector is of a view type that references other vectors / data.booleanisZero()Returns true if this vector is a zero vector (all components zero)VectormultiplyCopy(AVector v)Multiplies a vector element-wise with this vector, returning a new vector.voidmultiplyTo(double[] data, int offset)Multiplies the elements in the target array by corresponding elements in this vectorlongnonZeroCount()Returns the number of non-zero elements in the array.static BitVectorof(double... values)voidset(int i, double value)Sets a value at a given position in a mutable 1D arrayjava.lang.StringtoString()doubleunsafeGet(int i)Like get, but performs no bounds checking.-
Methods inherited from class mikera.vectorz.impl.ABooleanVector
elementAbsPowSum, elementPowSum, elementSquaredSum, hasUncountable, isBoolean, isElementConstrained
-
Methods inherited from class mikera.vectorz.impl.ASizedVector
checkIndex, checkLength, checkRange, elementCount, equalsArray, equalsArray, get, getShape, getShapeClone, isSameShape, length, sliceCount, visitNonZero
-
Methods inherited from class mikera.vectorz.AVector
abs, absCopy, absDiff, absDiff, absDiff, absDiffCopy, add, add, add, add, add, add, add, add, add, addAt, addAt, addCopy, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultipleCopy, addMultipleSparse, addMultipleSparse, addMultipleToArray, addMultipleToArray, addPower, addPower, addProduct, addProduct, addProduct, addProductCopy, addProductCopy, addProductToArray, addProductToArray, addSparse, addSparse, addToArray, addToArray, addToArray, addWeighted, angle, applyOp, applyOp, applyOp, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, asVector, broadcast, broadcastLike, broadcastLike, broadcastLike, clamp, clampMax, clampMin, clone, compareTo, compareTo, copy, copyTo, copyTo, copyTo, copyTo, copyTo, crossProduct, crossProduct, dense, denseClone, dimensionality, distance, distanceL1, distanceLinf, distanceSquared, divide, divide, divide, divide, divideCopy, divideCopy, divideCopy, divideTo, dotProduct, dotProduct, dotProduct, elementIterator, elementMaxAbs, elementMin, elementProduct, elementsEqual, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, equals, fill, fillRange, get, get, get, get, get, getElement, getElements, getElements, getLongShape, getShape, getSlices, getTranspose, getTransposeCopy, getTransposeView, hashCode, immutable, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, interpolate, isRangeZero, isSameShape, isUnitLengthVector, isUnitLengthVector, iterator, join, join, join, log, logistic, magnitude, magnitudeSquared, maxAbsElement, maxAbsElementIndex, maxElement, maxElementIndex, minElement, minElementIndex, multiply, multiply, multiply, multiply, multiply, multiplyCopy, multiplyCopy, mutable, negate, negateCopy, nonSparseIndex, nonZeroIndices, nonZeroValues, normalise, normaliseCopy, normaliseMaxAbsElement, outerProduct, outerProduct, pow, projectToPlane, reciprocal, reciprocalCopy, reduce, reduce, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateCopy, rotateView, rotateView, scale, scaleAdd, scaleAdd, scaleAdd, scaleAdd, scaleCopy, scaleToMagnitude, select, selectClone, selectView, set, set, set, set, set, set, set, set, set, set, setApplyOp, setApplyOp, setApplyOp, setElements, setElements, setElements, setInnerProduct, setInnerProduct, setInnerProduct, setMultiple, setMultiple, setMultiple, setMultiple, setSparse, setSparse, setSparse, shiftCopy, signum, slice, slice, sliceValue, softmax, softmaxCopy, sparse, sparseClone, sqrtCopy, square, squareCopy, sub, sub, subArray, subAt, subCopy, subCopy, subMultiple, subVector, tanh, toDoubleArray, toDoubleBuffer, toList, toNormal, toSliceArray, toStringFull, toVector, tryEfficientJoin, unsafeSet, validate
-
Methods inherited from class mikera.arrayz.impl.AbstractArray
add, addApplyOp, addCopy, addInnerProduct, addInnerProduct, addOuterProduct, addOuterProductSparse, addSparse, broadcastCloneLike, broadcastCopyLike, componentCount, density, ensureMutable, epsilonEquals, exp, get, get, getComponent, getComponents, getElements, getElements, getSlices, getSliceViews, isDense, isSparse, scale, set, set, signumCopy, sqrt, sub, sub, withComponents
-
Methods inherited from interface mikera.arrayz.INDArray
addApplyOp, addInnerProduct, addOuterProduct, addOuterProductSparse, addSparse, broadcastCloneLike, broadcastCopyLike, componentCount, ensureMutable, epsilonEquals, exp, get, get, getComponent, getComponents, getElements, getElements, getSlices, getSliceViews, isDense, isSparse, scale, set, set, signumCopy, sqrt, sub, withComponents
-
-
-
-
Field Detail
-
BIT_ON
public static final double BIT_ON
- See Also:
- Constant Field Values
-
BIT_OFF
public static final double BIT_OFF
- See Also:
- Constant Field Values
-
BIT_THRESHOLD
public static final double BIT_THRESHOLD
- See Also:
- Constant Field Values
-
-
Method Detail
-
createLength
public static BitVector createLength(int length)
-
unsafeGet
public double unsafeGet(int i)
Description copied from class:AVectorLike get, but performs no bounds checking. Results are undefined if the index is out of range
-
get
public double get(int i)
Description copied from interface:INDArrayReturns the double value at the specified position in a 1D vector
-
isFullyMutable
public boolean isFullyMutable()
Description copied from class:AVectorReturns true if this vector is fully mutable, i.e. can contain any unconstrained double values- Specified by:
isFullyMutablein interfaceINDArray- Overrides:
isFullyMutablein classABooleanVector
-
isView
public boolean isView()
Description copied from class:AVectorReturns true if this vector is of a view type that references other vectors / data.
-
isZero
public boolean isZero()
Description copied from class:AVectorReturns true if this vector is a zero vector (all components zero)
-
elementSum
public double elementSum()
Description copied from class:AVectorReturns the sum of all elements in a vector- Specified by:
elementSumin interfaceINDArray- Overrides:
elementSumin classAVector
-
elementMax
public double elementMax()
Description copied from interface:INDArrayReturns the maximum element value in this array. Throws an error if there are no elements.- Specified by:
elementMaxin interfaceINDArray- Overrides:
elementMaxin classAVector
-
nonZeroCount
public long nonZeroCount()
Description copied from interface:INDArrayReturns the number of non-zero elements in the array.- Specified by:
nonZeroCountin interfaceINDArray- Overrides:
nonZeroCountin classAVector
-
isMutable
public boolean isMutable()
Description copied from class:AVectorReturns true if this vector is mutable.
-
dotProduct
public double dotProduct(double[] data, int offset)Description copied from class:AVectorFast dot product with a double[] array. Performs no bounds checking. Likely to be faster than most other dot product operations- Specified by:
dotProductin classAVector
-
dotProduct
public double dotProduct(AVector v)
Description copied from class:AVectorReturns the dot product of this vector with another vector The vectors must have the same length: if not the result is undefined- Overrides:
dotProductin classAVector- Returns:
-
multiplyTo
public void multiplyTo(double[] data, int offset)Description copied from class:AVectorMultiplies the elements in the target array by corresponding elements in this vector- Overrides:
multiplyToin classAVectoroffset- The offset into the target array
-
multiplyCopy
public Vector multiplyCopy(AVector v)
Description copied from interface:IVectorMultiplies a vector element-wise with this vector, returning a new vector.- Specified by:
multiplyCopyin interfaceIVector- Overrides:
multiplyCopyin classAVector- Returns:
-
getElements
public void getElements(double[] data, int offset)Description copied from interface:INDArrayCopies all elements of this array a double array at the specified offset- Specified by:
getElementsin interfaceINDArray- Overrides:
getElementsin classAVector
-
set
public void set(int i, double value)Description copied from interface:INDArraySets a value at a given position in a mutable 1D array
-
of
public static BitVector of(double... values)
-
exactClone
public BitVector exactClone()
Description copied from class:AVectorReturns an exact clone of this vector, i.e. of the same type- Specified by:
exactClonein interfaceINDArray- Specified by:
exactClonein classAVector- Returns:
- A clone of the original array
-
-
DMelt 3.0 © DataMelt by jWork.ORG