mikera.vectorz.impl
Class JoinedArrayVector
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<java.lang.Double>
-
- mikera.vectorz.AVector
-
- mikera.vectorz.impl.ASizedVector
-
- mikera.vectorz.impl.AJoinedVector
-
- mikera.vectorz.impl.JoinedArrayVector
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<java.lang.Double>, INDArray, IVector
public final class JoinedArrayVector extends AJoinedVector
Class representing a join of one or more array segments, i.e. the vector is constructed from a sequence of fixed chunks of double[] arrays- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidabs()Replaces all elements of this array with their absolute values, according to Math.abs(double)voidadd(AVector a)Adds another vector to this onevoidadd(double value)Adds a double value to all elements in this array.voidadd(double[] srcData, int srcOffset)Adds to this vector from a given double array.voidadd(int offset, AVector a, int aOffset, int length)Adds a segment of another vector into this one, at the specified offsetvoidaddAt(int i, double value)Adds a value to a specific element of the vector This function does not perform bounds checking, i.e.VectoraddCopy(AVector a)Adds a vector element-wise to this vector, returning a new vector.voidaddMultiple(AVector a, double factor)Adds a scaled multiple of another vector to this vectorvoidaddMultiple(int offset, AVector a, int aOffset, int length, double factor)voidaddMultipleToArray(double factor, int offset, double[] array, int arrayOffset, int length)Adds a multiple of a subvector of this vector into a double array at the specified offsetvoidaddProduct(AVector a, AVector b, double factor)Adds the element-wise product of two vectors and a constant factor to this vector.voidaddProduct(AVector a, int aOffset, AVector b, int bOffset, double factor)Adds the scaled elementwise product of two vectors to this vectorvoidaddToArray(int offset, double[] a, int aOffset, int length)Adds a subvector of this vector into a double array at the specified offsetvoidapplyOp(Op op)Applies a unary operator to all elements of the array (in-place)voidclamp(double min, double max)Clamps all values in the vector to a given rangeintcomponentCount()Returns the number of components of this array.static JoinedArrayVectorcreate(AVector v)voiddivideTo(double[] target, int offset)Divides the elements in the target array by corresponding elements in this vectordoubledotProduct(ADenseArrayVector v)Returns the dot product of this vector with a target ADenseArrayVector.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[] arr, int offset)Fast dot product with a double[] array.doubleelementSum()Returns the sum of all elements in a vectorbooleanequalsArray(double[] data, int offset)Returns true if this vector exactly matches the elements in double[] array, starting from the specified offsetJoinedArrayVectorexactClone()Returns an exact clone of this vector, i.e.voidexp()Computes the function e^x (in-place) for all array elementsvoidfill(double value)Fills the entire vector with a given valuedoubleget(int i)Returns the double value at the specified position in a 1D vectorArraySubVectorgetComponent(int i)Gets a component from the array at the specified index Will throw an error if components are not supported, or if the component is out of bounds as defined by 0 <= kvoidgetElements(double[] destArray, 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.booleanisView()Returns true if this vector is of a view type that references other vectors / data.JoinedArrayVectorjoin(ADenseArrayVector v)JoinedArrayVectorjoin(JoinedArrayVector v)static AVectorjoinVectors(ADenseArrayVector a, ADenseArrayVector b)static JoinedArrayVectorjoinVectors(JoinedArrayVector a, JoinedArrayVector b)voidlog()Computes the natural logarithm (in-place) for all array elementsvoidlogistic()Computes the logistic function for every element in this vector.voidmultiply(double value)Multiplies the vector by a constant factorvoidmultiplyTo(double[] target, int offset)Multiplies the elements in the target array by corresponding elements in this vectorvoidnegate()Negates all emlements of this vector in place.longnonZeroCount()Returns the number of non-zero elements in the array.intnumArrays()voidreciprocal()Computes the reciprocal of all elements in this vector.voidscaleAdd(double factor, double constant)Scales this vector and adds a constant to every elementvoidset(AVector v)Sets the vector to equal the value of another vectorvoidset(int i, double value)Sets a value at a given position in a mutable 1D arrayvoidsignum()Calculates the signum of all elements of this mutable array Sets each component of the array to its sign value (-1, 0 or 1)voidsqrt()Computes the square root of all elements in the arrayvoidsquare()Squares all elements of the array in placeVectorsubCopy(AVector a)Subtracts a vector element-wise from this vector, returning a new vector.AVectorsubVector(int start, int length)Obtains a sub-vector view that refers to this vector.voidtanh()Computes the tanh of every element in this vector.AVectortryEfficientJoin(AVector v)Attempts to perform an efficient join with a second vector.doubleunsafeGet(int i)Like get, but performs no bounds checking.voidunsafeSet(int i, double value)Like set, but performs no bounds checking.voidvalidate()Validates the internal data structure of the INDArray.AJoinedVectorwithComponents(INDArray... segments)Reconstructs a new joined vector of the same type and shape with the given segments.static JoinedArrayVectorwrap(ADenseArrayVector v)-
Methods inherited from class mikera.vectorz.impl.AJoinedVector
addSparse, applyOp, copyTo, copyTo, copyTo, copyTo, dotProduct, elementSquaredSum, equals, hasUncountable, isMutable, isZero, reduce, reduce, scaleAdd, setElements, setSparse
-
Methods inherited from class mikera.vectorz.impl.ASizedVector
checkIndex, checkLength, checkRange, elementCount, equalsArray, get, getShape, getShapeClone, isSameShape, length, sliceCount, visitNonZero
-
Methods inherited from class mikera.vectorz.AVector
absCopy, absDiff, absDiff, absDiff, absDiffCopy, add, add, add, add, add, addAt, addCopy, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultipleCopy, addMultipleSparse, addMultipleSparse, addMultipleToArray, addPower, addPower, addProduct, addProductCopy, addProductCopy, addProductToArray, addProductToArray, addSparse, addToArray, addToArray, addWeighted, angle, applyOp, applyOp, applyOp, applyOpCopy, asDoubleArray, asElementList, asVector, broadcast, broadcastLike, broadcastLike, broadcastLike, clampMax, clampMin, clone, compareTo, compareTo, copy, copyTo, crossProduct, crossProduct, dense, denseClone, dimensionality, distance, distanceL1, distanceLinf, distanceSquared, divide, divide, divide, divide, divideCopy, divideCopy, divideCopy, dotProduct, elementAbsPowSum, elementIterator, elementMax, elementMaxAbs, elementMin, elementPowSum, elementProduct, elementsEqual, epsilonEquals, epsilonEquals, epsilonEquals, equals, equals, fillRange, get, get, get, get, get, getElement, getElements, getElements, getLongShape, getShape, getSlices, getTranspose, getTransposeCopy, getTransposeView, hashCode, immutable, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, innerProduct, interpolate, isElementConstrained, isRangeZero, isSameShape, isUnitLengthVector, isUnitLengthVector, iterator, join, join, join, magnitude, magnitudeSquared, maxAbsElement, maxAbsElementIndex, maxElement, maxElementIndex, minElement, minElementIndex, multiply, multiply, multiply, multiply, multiplyCopy, multiplyCopy, multiplyCopy, mutable, negateCopy, nonSparseIndex, nonZeroIndices, nonZeroValues, normalise, normaliseCopy, normaliseMaxAbsElement, outerProduct, outerProduct, pow, projectToPlane, reciprocalCopy, reduceSlices, reduceSlices, reorder, reorder, reshape, rotateCopy, rotateView, rotateView, scale, scaleAdd, scaleAdd, scaleCopy, scaleToMagnitude, select, selectClone, selectView, set, set, set, set, set, set, set, set, set, setApplyOp, setApplyOp, setApplyOp, setElements, setElements, setInnerProduct, setInnerProduct, setInnerProduct, setMultiple, setMultiple, setMultiple, setMultiple, setSparse, setSparse, shiftCopy, slice, slice, sliceValue, softmax, softmaxCopy, sparse, sparseClone, sqrtCopy, squareCopy, sub, sub, subArray, subAt, subCopy, subMultiple, toDoubleArray, toDoubleBuffer, toList, toNormal, toSliceArray, toString, toStringFull, toVector
-
Methods inherited from class mikera.arrayz.impl.AbstractArray
add, addApplyOp, addCopy, addInnerProduct, addInnerProduct, addOuterProduct, addOuterProductSparse, addSparse, broadcastCloneLike, broadcastCopyLike, density, ensureMutable, epsilonEquals, get, get, getComponents, getElements, getElements, getSlices, getSliceViews, isBoolean, isDense, isSparse, scale, set, set, signumCopy, sub, sub
-
Methods inherited from interface mikera.arrayz.INDArray
addApplyOp, addInnerProduct, addOuterProduct, addOuterProductSparse, addSparse, broadcastCloneLike, broadcastCopyLike, ensureMutable, epsilonEquals, get, get, getComponents, getElements, getElements, getSlices, getSliceViews, isBoolean, isDense, isSparse, scale, set, set, signumCopy, sub
-
-
-
-
Method Detail
-
create
public static final JoinedArrayVector create(AVector v)
-
wrap
public static JoinedArrayVector wrap(ADenseArrayVector v)
-
numArrays
public int numArrays()
-
getComponent
public ArraySubVector getComponent(int i)
Description copied from interface:INDArrayGets a component from the array at the specified index Will throw an error if components are not supported, or if the component is out of bounds as defined by 0 <= k- Specified by:
getComponentin interfaceINDArray- Specified by:
getComponentin classAJoinedVector- Returns:
-
isView
public boolean isView()
Description copied from class:AVectorReturns true if this vector is of a view type that references other vectors / data.- Specified by:
isViewin interfaceINDArray- Overrides:
isViewin classAJoinedVector
-
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 classAVector
-
get
public double get(int i)
Description copied from interface:INDArrayReturns the double value at the specified position in a 1D vector
-
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
-
set
public void set(int i, double value)Description copied from interface:INDArraySets a value at a given position in a mutable 1D array
-
unsafeSet
public void unsafeSet(int i, double value)Description copied from class:AVectorLike set, but performs no bounds checking. Results are undefined if the index is out of range
-
addAt
public void addAt(int i, double value)Description copied from class:AVectorAdds a value to a specific element of the vector This function does not perform bounds checking, i.e. is an unsafe operation
-
elementSum
public double elementSum()
Description copied from class:AVectorReturns the sum of all elements in a vector- Specified by:
elementSumin interfaceINDArray- Overrides:
elementSumin classAJoinedVector
-
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
-
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:
-
dotProduct
public double dotProduct(ADenseArrayVector v)
Description copied from class:AVectorReturns the dot product of this vector with a target ADenseArrayVector.- Overrides:
dotProductin classAVector- Returns:
-
dotProduct
public double dotProduct(double[] arr, 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- Overrides:
dotProductin classAJoinedVector
-
add
public void add(AVector a)
Description copied from class:AVectorAdds another vector to this one
-
addCopy
public Vector addCopy(AVector a)
Description copied from interface:IVectorAdds a vector element-wise to this vector, returning a new vector.
-
subCopy
public Vector subCopy(AVector a)
Description copied from interface:IVectorSubtracts a vector element-wise from this vector, returning a new vector.
-
add
public void add(double[] srcData, int srcOffset)Description copied from class:AVectorAdds to this vector from a given double array.
-
add
public void add(int offset, AVector a, int aOffset, int length)Description copied from class:AVectorAdds a segment of another vector into this one, at the specified offset
-
addToArray
public void addToArray(int offset, double[] a, int aOffset, int length)Description copied from class:AVectorAdds a subvector of this vector into a double array at the specified offset- Overrides:
addToArrayin classAVector
-
addProduct
public void addProduct(AVector a, AVector b, double factor)
Description copied from class:AVectorAdds the element-wise product of two vectors and a constant factor to this vector. Mutates this vector.- Overrides:
addProductin classAVector
-
addMultiple
public void addMultiple(AVector a, double factor)
Description copied from class:AVectorAdds a scaled multiple of another vector to this vector- Overrides:
addMultiplein classAVector
-
addMultiple
public void addMultiple(int offset, AVector a, int aOffset, int length, double factor)- Overrides:
addMultiplein classAVector
-
addMultipleToArray
public void addMultipleToArray(double factor, int offset, double[] array, int arrayOffset, int length)Description copied from class:AVectorAdds a multiple of a subvector of this vector into a double array at the specified offset- Overrides:
addMultipleToArrayin classAVector
-
addProduct
public void addProduct(AVector a, int aOffset, AVector b, int bOffset, double factor)
Description copied from class:AVectorAdds the scaled elementwise product of two vectors to this vector- Overrides:
addProductin classAVector
-
applyOp
public void applyOp(Op op)
Description copied from interface:INDArrayApplies a unary operator to all elements of the array (in-place)
-
getElements
public void getElements(double[] destArray, 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
-
multiplyTo
public void multiplyTo(double[] target, 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
-
divideTo
public void divideTo(double[] target, int offset)Description copied from class:AVectorDivides the elements in the target array by corresponding elements in this vector
-
fill
public void fill(double value)
Description copied from class:AVectorFills the entire vector with a given value
-
set
public void set(AVector v)
Description copied from class:AVectorSets the vector to equal the value of another vector
-
multiply
public void multiply(double value)
Description copied from class:AVectorMultiplies the vector by a constant factor
-
scaleAdd
public void scaleAdd(double factor, double constant)Description copied from class:AVectorScales this vector and adds a constant to every element
-
clamp
public void clamp(double min, double max)Description copied from class:AVectorClamps all values in the vector to a given range
-
reciprocal
public void reciprocal()
Description copied from class:AVectorComputes the reciprocal of all elements in this vector. Mutates this vector- Specified by:
reciprocalin interfaceINDArray- Overrides:
reciprocalin classAVector
-
add
public void add(double value)
Description copied from interface:INDArrayAdds a double value to all elements in this array. Implementations may optimize the case of 0.0
-
abs
public void abs()
Description copied from interface:INDArrayReplaces all elements of this array with their absolute values, according to Math.abs(double)
-
exp
public void exp()
Description copied from interface:INDArrayComputes the function e^x (in-place) for all array elements- Specified by:
expin interfaceINDArray- Overrides:
expin classAbstractArray<java.lang.Double>
-
log
public void log()
Description copied from interface:INDArrayComputes the natural logarithm (in-place) for all array elements
-
signum
public void signum()
Description copied from interface:INDArrayCalculates the signum of all elements of this mutable array Sets each component of the array to its sign value (-1, 0 or 1)
-
square
public void square()
Description copied from interface:INDArraySquares all elements of the array in place
-
tanh
public void tanh()
Description copied from class:AVectorComputes the tanh of every element in this vector. Mutates this vector.
-
logistic
public void logistic()
Description copied from class:AVectorComputes the logistic function for every element in this vector. Mutates this vector.
-
sqrt
public void sqrt()
Description copied from interface:INDArrayComputes the square root of all elements in the array- Specified by:
sqrtin interfaceINDArray- Overrides:
sqrtin classAbstractArray<java.lang.Double>
-
negate
public void negate()
Description copied from class:AVectorNegates all emlements of this vector in place.
-
exactClone
public JoinedArrayVector 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
-
subVector
public AVector subVector(int start, int length)
Description copied from class:AVectorObtains a sub-vector view that refers to this vector. Changes to the sub-vector will be reflected in this vector
-
tryEfficientJoin
public AVector tryEfficientJoin(AVector v)
Description copied from class:AVectorAttempts to perform an efficient join with a second vector. An efficient join is guaranteed to be better than a simple JoinedVector(left,right) If possible, returns the joined vector. If not, returns null- Overrides:
tryEfficientJoinin classAVector
-
join
public JoinedArrayVector join(ADenseArrayVector v)
-
join
public JoinedArrayVector join(JoinedArrayVector v)
-
joinVectors
public static JoinedArrayVector joinVectors(JoinedArrayVector a, JoinedArrayVector b)
-
joinVectors
public static AVector joinVectors(ADenseArrayVector a, ADenseArrayVector b)
-
equalsArray
public boolean equalsArray(double[] data, int offset)Description copied from class:AVectorReturns true if this vector exactly matches the elements in double[] array, starting from the specified offset- Specified by:
equalsArrayin interfaceINDArray- Overrides:
equalsArrayin classAJoinedVector- Parameters:
data- Array of double element values to check for equalityoffset- Offset into the data array- Returns:
-
validate
public void validate()
Description copied from interface:INDArrayValidates the internal data structure of the INDArray. Throws an exception on failure. Failure indicates a serious bug and/or data corruption.
-
componentCount
public int componentCount()
Description copied from interface:INDArrayReturns the number of components of this array. May return 0 if components are not supported- Specified by:
componentCountin interfaceINDArray- Specified by:
componentCountin classAJoinedVector- Returns:
-
withComponents
public AJoinedVector withComponents(INDArray... segments)
Description copied from class:AJoinedVectorReconstructs a new joined vector of the same type and shape with the given segments. The segments must be the same shape as the original segments- Specified by:
withComponentsin interfaceINDArray- Specified by:
withComponentsin classAJoinedVector
-
-
DMelt 3.0 © DataMelt by jWork.ORG
You see the box below because you did not login.