mikera.vectorz.impl
Class JoinedMultiVector
- java.lang.Object
-
- mikera.arrayz.impl.AbstractArray<java.lang.Double>
-
- mikera.vectorz.AVector
-
- mikera.vectorz.impl.ASizedVector
-
- mikera.vectorz.impl.AJoinedVector
-
- mikera.vectorz.impl.JoinedMultiVector
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<INDArray>, java.lang.Iterable<java.lang.Double>, INDArray, IVector
public final class JoinedMultiVector extends AJoinedVector
A vector that represents the concatenation of many vectors.- 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(AVector a, int aOffset)Adds part another vector to this one, starting at the specified offset in the source vectorvoidadd(double constant)Adds a double value to all elements in this array.voidadd(double[] data, int offset)Adds to this vector from a given double array.voidadd(JoinedMultiVector a)voidaddAt(int i, double v)Adds a value to a specific element of the vector This function does not perform bounds checking, i.e.voidaddMultiple(AVector a, double factor)Adds a scaled multiple of another vector to this vectorvoidaddMultiple(AVector a, int aOffset, double factor)Adds a multiple of a subvector of another vector to this vector.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(double[] dest, int offset, int stride)Adds this vector to a double[] array, using the specified offset and stride into the destination arrayvoidaddToArray(int offset, double[] array, int arrayOffset, 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.voidcopyTo(AVector dest, int offset)Copies a the contents of a vector to a vector at the specified offsetstatic AVectorcreate(AVector... vecs)voiddivideTo(double[] data, int offset)Divides the elements in the target array by corresponding elements in this vectordoubledotProduct(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.doubleelementMin()Returns the maximum element value in this array.doubleelementProduct()Returns the product of all elements in the array.doubleelementSum()Returns the sum of all elements in a vectorbooleanequals(AVector v)Returns true if this array is exactly equal to a vector.booleanequals(JoinedMultiVector v)booleanequalsArray(double[] data, int offset)Returns true if this vector exactly matches the elements in double[] array, starting from the specified offsetJoinedMultiVectorexactClone()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 vectorAVectorgetComponent(int k)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[] 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.AVectorjoin(JoinedMultiVector v)AVectorjoin(JoinedVector v)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[] data, 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.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 src)Sets the vector to equal the value of another vectorvoidset(AVector src, int srcOffset)Set the vector equal to an offset into 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 placeAVectorsubVector(int start, int length)Obtains a sub-vector view that refers to this vector.voidtanh()Computes the tanh of every element in this vector.double[]toDoubleArray()Copies the elements of this array to a new double[] array.voidtoDoubleBuffer(java.nio.DoubleBuffer dest)Copies the elements of this INDArray to the specified double buffer.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 AVectorwrap(AVector... vecs)-
Methods inherited from class mikera.vectorz.impl.AJoinedVector
addSparse, applyOp, copyTo, copyTo, copyTo, dotProduct, elementSquaredSum, hasUncountable, isMutable, isView, 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, addCopy, addInnerProduct, addInnerProduct, addInnerProduct, addInnerProduct, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultiple, addMultipleCopy, addMultipleSparse, addMultipleSparse, addMultipleToArray, addPower, addPower, addProduct, addProductCopy, addProductCopy, addProductToArray, addProductToArray, addSparse, 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, dotProduct, elementAbsPowSum, elementIterator, elementMaxAbs, elementPowSum, 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, 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, subCopy, subMultiple, 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
-
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
-
copyTo
public void copyTo(AVector dest, int offset)
Description copied from class:AVectorCopies a the contents of a vector to a vector at the specified offset- Overrides:
copyToin classAJoinedVector
-
toDoubleBuffer
public void toDoubleBuffer(java.nio.DoubleBuffer dest)
Description copied from interface:INDArrayCopies the elements of this INDArray to the specified double buffer.- Specified by:
toDoubleBufferin interfaceINDArray- Overrides:
toDoubleBufferin classAVector
-
addToArray
public void addToArray(int offset, double[] array, int arrayOffset, int length)Description copied from class:AVectorAdds a subvector of this vector into a double array at the specified offset- Overrides:
addToArrayin classAVector
-
addToArray
public void addToArray(double[] dest, int offset, int stride)Description copied from class:AVectorAdds this vector to a double[] array, using the specified offset and stride into the destination array- Overrides:
addToArrayin 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
-
addAt
public void addAt(int i, double v)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
-
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
-
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
-
divideTo
public void divideTo(double[] data, int offset)Description copied from class:AVectorDivides the elements in the target array by corresponding elements in this vector
-
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 AVector join(JoinedMultiVector v)
-
join
public AVector join(JoinedVector v)
-
add
public void add(AVector a)
Description copied from class:AVectorAdds another vector to this one
-
add
public void add(JoinedMultiVector a)
-
scaleAdd
public void scaleAdd(double factor, double constant)Description copied from class:AVectorScales this vector and adds a constant to every element
-
add
public void add(double constant)
Description copied from interface:INDArrayAdds a double value to all elements in this array. Implementations may optimize the case of 0.0
-
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
-
clamp
public void clamp(double min, double max)Description copied from class:AVectorClamps all values in the vector to a given range
-
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(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- Overrides:
dotProductin classAJoinedVector
-
add
public void add(AVector a, int aOffset)
Description copied from class:AVectorAdds part another vector to this one, starting at the specified offset in the source vector
-
add
public void add(double[] data, int offset)Description copied from class:AVectorAdds to this vector from a given double array.
-
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(AVector a, int aOffset, double factor)
Description copied from class:AVectorAdds a multiple of a subvector of another vector to this vector. Useful as a specialised override for joined vectors etc.- Overrides:
addMultiplein 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
-
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
-
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)
-
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
-
negate
public void negate()
Description copied from class:AVectorNegates all emlements of this vector in place.
-
applyOp
public void applyOp(Op op)
Description copied from interface:INDArrayApplies a unary operator to all elements of the array (in-place)
-
elementSum
public double elementSum()
Description copied from class:AVectorReturns the sum of all elements in a vector- Specified by:
elementSumin interfaceINDArray- Overrides:
elementSumin classAJoinedVector
-
elementProduct
public double elementProduct()
Description copied from interface:INDArrayReturns the product of all elements in the array.- Specified by:
elementProductin interfaceINDArray- Overrides:
elementProductin classAVector- Returns:
-
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
-
elementMin
public double elementMin()
Description copied from interface:INDArrayReturns the maximum element value in this array. Throws an error if there are no elements.- Specified by:
elementMinin interfaceINDArray- Overrides:
elementMinin 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
-
get
public double get(int i)
Description copied from interface:INDArrayReturns the double value at the specified position in a 1D vector
-
set
public void set(AVector src)
Description copied from class:AVectorSets the vector to equal the value of another 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(AVector src, int srcOffset)
Description copied from class:AVectorSet the vector equal to an offset into another vector
-
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
-
fill
public void fill(double value)
Description copied from class:AVectorFills the entire vector with a given value
-
square
public void square()
Description copied from interface:INDArraySquares all elements of the array in place
-
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>
-
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.
-
multiply
public void multiply(double value)
Description copied from class:AVectorMultiplies the vector by a constant factor
-
toDoubleArray
public double[] toDoubleArray()
Description copied from interface:INDArrayCopies the elements of this array to a new double[] array.- Specified by:
toDoubleArrayin interfaceINDArray- Overrides:
toDoubleArrayin classAVector
-
equals
public boolean equals(AVector v)
Description copied from class:AbstractArrayReturns true if this array is exactly equal to a vector.- Overrides:
equalsin classAJoinedVector- Returns:
-
equals
public boolean equals(JoinedMultiVector v)
-
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:
-
exactClone
public JoinedMultiVector 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
-
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:
-
getComponent
public AVector getComponent(int k)
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:
-
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.