public abstract class AVector extends AbstractArray<Double> implements IVector, Comparable<AVector>, Serializable
| Constructor and Description |
|---|
AVector() |
| Modifier and Type | Method and Description |
|---|---|
void |
abs()
Sets each component of the vector to its absolute value
|
void |
add(AVector v)
Adds another vector to this one
|
void |
add(AVector src,
int srcOffset)
Adds part another vector to this one, starting at the specified offset in the source vector
|
void |
add(double constant)
Adds a double value to all elements in this array
|
void |
add(INDArray a)
Adds all the elements of another array to this array, in an elementwise order.
|
void |
add(int offset,
AVector a)
Adds another vector into this one, at the specified offset
|
void |
add(int offset,
AVector a,
int aOffset,
int length)
Adds another vector into this one, at the specified offset
|
void |
addAt(int i,
double v)
Adds a value to a specific element of the vector
This function does not perform bounds checking
|
void |
addMultiple(AVector src,
double factor)
Adds a scaled multiple of another vector to this one
|
void |
addMultiple(AVector source,
Index sourceToDest,
double factor)
Adds source vector to this vector at the specified indexes which should map from source->this
|
void |
addMultiple(AVector src,
int srcOffset,
double factor) |
void |
addMultiple(Index destToSource,
AVector source,
double factor)
Adds to this vector at taking values from source at the specified indexes which should map from this->source
|
void |
addMultiple(Index destToSource,
Vector source,
double factor)
Adds to this vector at taking values from source at the specified indexes which should map from this->source
|
void |
addMultiple(int offset,
AVector v,
double factor) |
void |
addMultiple(int offset,
AVector src,
int srcOffset,
int length,
double factor) |
void |
addMultiple(Vector source,
Index sourceToDest,
double factor)
Adds source vector to this vector at the specified indexes which should map from source->this
|
void |
addMultipleToArray(double factor,
int offset,
double[] array,
int arrayOffset,
int length) |
void |
addProduct(AVector a,
AVector b) |
void |
addProduct(AVector a,
AVector b,
double factor) |
void |
addProduct(AVector a,
int aOffset,
AVector b,
int bOffset,
double factor) |
void |
addProductToArray(double factor,
int offset,
AArrayVector other,
int otherOffset,
double[] array,
int arrayOffset,
int length) |
void |
addProductToArray(double factor,
int offset,
AVector other,
int otherOffset,
double[] array,
int arrayOffset,
int length) |
void |
addToArray(double[] array,
int offset) |
void |
addToArray(int offset,
double[] array,
int arrayOffset,
int length) |
void |
addWeighted(AVector v,
double factor)
Updates a weighted average of this vector with another vector
|
double |
angle(AVector v)
Returns the Euclidean angle between this vector and another vector
|
void |
applyOp(IOp op)
Applies a unary operator to all elements of the array (in-place)
|
void |
applyOp(Op op)
Applies a unary operator to all elements of the array (in-place)
|
double[] |
asDoubleArray()
Returns the underlying double array representing the packed elements of this array
Returns nil if there is no such underlying array
|
List<Double> |
asElementList()
Returns a list containing all elements of this array
|
AVector |
asVector()
Constructs a view of the array as a single vector in row-major order.
|
INDArray |
broadcast(int... targetShape)
Returns a view of this array broadcasted up to a larger shape
|
INDArray |
broadcastLike(AMatrix target) |
INDArray |
broadcastLike(INDArray target)
Broadcasts to match the shape of the target
|
void |
clamp(double min,
double max)
Clamps all values in the vector to a given range
|
void |
clampMax(double max) |
void |
clampMin(double min) |
AVector |
clone()
Clones the vector, creating a new copy of all data.
|
int |
compareTo(AVector a) |
void |
copyTo(AArrayVector dest,
int destOffset)
Copies a the contents of a vector to a vector at the specified offset
|
void |
copyTo(AVector dest,
int destOffset)
Copies a the contents of a vector to a vector at the specified offset
|
void |
copyTo(double[] arr)
Copies all the elements of this INDArray to the specified double array
|
void |
copyTo(double[] data,
int offset)
Copies a the contents of a vector to a double array at the specified offset
|
void |
copyTo(int offset,
AVector dest,
int destOffset,
int length)
Copies a subset of this vector to a vector at the specified offset
|
void |
copyTo(int offset,
double[] dest,
int destOffset,
int length) |
void |
crossProduct(AVector a) |
int |
dimensionality()
Returns the dimensionality of the array (number of dimensions in the array shape)
e.g.
|
double |
distance(AVector v) |
double |
distanceL1(AVector v) |
double |
distanceLinf(AVector v) |
double |
distanceSquared(AVector v) |
void |
divide(AVector v) |
void |
divide(double factor)
Divides all elements by a given factor
|
void |
divide(double[] data,
int offset) |
void |
divide(INDArray a)
Divides all elements by the equivalent elements in a second array
|
void |
divideTo(double[] data,
int offset) |
double |
dotProduct(AVector v) |
double |
dotProduct(AVector v,
Index ix) |
double |
dotProduct(double[] data,
int offset)
Fast dot product with a double[] array.
|
double |
dotProduct(Vector v) |
long |
elementCount()
Returns the total number of elements in this array.
|
Iterator<Double> |
elementIterator()
Returns an iterator over all elements in this array.
|
double |
elementSquaredSum()
Returns the total sum of elements in this array.
|
double |
elementSum()
Returns the sum of all elements in a vector
|
boolean |
epsilonEquals(AVector v) |
boolean |
epsilonEquals(AVector v,
double tolerance) |
boolean |
epsilonEquals(INDArray a)
Tests is this array is approximately equal to another array.
|
boolean |
epsilonEquals(INDArray a,
double tolerance)
Tests is this array is approximately equal to another array, up to a given tolerance (epsilon)
The arrays must have the same shape
|
boolean |
equals(AVector v) |
boolean |
equals(INDArray v)
Returns true if the two arrays are exactly equal in value and shape
|
boolean |
equals(Object o)
Test for equality on vectors.
|
boolean |
equalsArray(double[] data) |
abstract AVector |
exactClone()
Returns an exact clone of this vector, i.e.
|
void |
fill(double value)
Fills the entire vector with a given value
|
void |
fillRange(int offset,
int length,
double value) |
double |
get()
Returns the double value of a scalar array
|
double |
get(int... indexes)
Returns the double value at the specified index position in an array
|
abstract double |
get(int i)
Returns the double value at the specified position in a 1D vector
|
void |
getElements(double[] dest,
int offset)
Gets all elements of the array, copying them into a double array
|
long[] |
getLongShape()
Returns the shape of the array as an array of longs.
|
int[] |
getShape()
Returns the shape of the array as an array of ints.
|
int |
getShape(int dim)
Returns the dimension size for a specific dimension in the array's shape
|
List<Double> |
getSlices()
Returns a list of all major slices of this array.
|
AVector |
getTranspose()
Returns the transpose of this array.
|
Vector |
getTransposeCopy()
Returns a transposed copy of the array.
|
AVector |
getTransposeView()
Returns a transposed view of the array.
|
int |
hashCode()
Computes the hashcode of a vector.
|
AVector |
innerProduct(AMatrix m) |
AVector |
innerProduct(AScalar s) |
Scalar |
innerProduct(AVector v) |
INDArray |
innerProduct(INDArray a)
Calculates the inner product of this array with another array.
|
Scalar |
innerProduct(Vector v) |
void |
interpolate(AVector a,
AVector b,
double alpha) |
void |
interpolate(AVector v,
double alpha) |
boolean |
isElementConstrained()
Returns true if this array has some constraints on element values
|
boolean |
isFullyMutable()
Returns true if this vector is fully mutable, i.e.
|
boolean |
isMutable()
Returns true if this vector is mutable.
|
boolean |
isSameShape(AVector a) |
boolean |
isSameShape(INDArray a)
Returns true if this array is the same shape as another array
|
boolean |
isUnitLengthVector()
Returns true if the vector has unit length
|
boolean |
isView()
Returns true if this vector is of a view type that references other vectors / data.
|
boolean |
isZero()
Returns true if this vector is a zero vector (all components zero)
|
Iterator<Double> |
iterator() |
AVector |
join(AVector second)
Returns a new vector that refers to this vector joined to a second vector
|
abstract int |
length() |
void |
log()
Computes the natural logarithm (in-place) for all array elements
|
void |
logistic() |
double |
magnitude()
Returns the magnitude (Euclidean length) of the vector
|
double |
magnitudeSquared() |
double |
maxAbsElement()
Returns the maximum absolute element of a vector
|
void |
multiply(AVector v) |
void |
multiply(double factor)
Multiplies the vector by a constant factor
|
void |
multiply(double[] data,
int offset) |
void |
multiply(INDArray a)
Multiplies all elements by the equivalent elements in a second array
|
void |
multiplyTo(double[] data,
int offset) |
void |
negate()
Negates all elements in the array
|
long |
nonZeroCount()
Returns the number of non-zero elements in the array.
|
double |
normalise()
Normalises this vector to a magnitude of 1.0
Has no effect on a zero-length vector (i.e.
|
double |
normaliseMaxAbsElement()
Normalises so that the maximum absolute element is 1.0
Returns the previous maximum absolute element.
|
AMatrix |
outerProduct(AVector a) |
INDArray |
outerProduct(INDArray a)
Calculates the outer product of this array with another array.
|
void |
pow(double exponent)
Raises all elements of the array to a specified power
|
void |
projectToPlane(AVector normal,
double distance) |
INDArray |
reshape(int... dimensions)
Returns a new array by rearranging the elements of this array into the desired shape
Truncates or zero-pads the elements as required to fill the new shape
|
void |
scale(AVector v)
Scales the vector by another vector of the same size
|
void |
scaleAdd(double factor,
AVector v) |
void |
scaleAdd(double factor,
double constant)
Scales all elements of the array by a given double value and adds a constant vale
|
double |
scaleToMagnitude(double targetMagnitude)
Scales the vector up to a specific target magnitude
|
void |
set(AVector src)
Sets the vector to equal the value of another vector
|
void |
set(AVector v,
Index indexes)
sets the vector using values indexed from another vector
|
void |
set(AVector src,
int srcOffset)
Set the vector equal to an offset into another vector
|
void |
set(double a)
Sets all elements of an array to a specific double value
|
void |
set(double[] data)
Deprecated.
|
void |
set(INDArray a)
Sets this array to the element values contained in another array
|
void |
set(int[] indexes,
double value) |
abstract void |
set(int i,
double value) |
void |
set(IVector vector) |
void |
setElements(double[] data)
Sets all elements in an array using the given double values
|
void |
setElements(double[] values,
int offset,
int length)
Sets all elements in an array using the given double values
|
void |
setRange(int offset,
double[] data,
int dataOffset,
int length)
Set a subrange of this vector from a double array
|
void |
setValues(double... values) |
void |
signum()
Sets each component of the vector to its sign value (-1, 0 or 1)
|
AScalar |
slice(int position)
Returns the specified major slice of this array as a view (slice along dimension 0)
|
AScalar |
slice(int dimension,
int index)
Returns a slice view of this array along the specified dimension
|
int |
sliceCount()
returns the number of major slices in this array.
|
void |
square()
Squares all elements of the vector
|
void |
sub(AVector v)
Subtracts a vector from this vector
|
void |
sub(double d)
Subtracts a double value from all elements in this array
|
void |
sub(INDArray a)
Subtracts all the elements of another array from this array, in an elementwise order.
|
void |
subMultiple(AVector v,
double factor)
Subtracts a scaled multiple of another vector from this vector
|
AVector |
subVector(int offset,
int length)
Obtains a sub-vector that refers to this vector.
|
void |
tanh() |
double[] |
toDoubleArray()
Copies the elements of this INDArray to a new double array
|
void |
toDoubleBuffer(DoubleBuffer dest)
Copies the elements of this INDArray to the specified double buffer
|
List<Double> |
toList() |
AVector |
toNormal()
Creates a new mutable vector representing the normalised value of this vector
|
String |
toString() |
Vector |
toVector()
Converts the array into a flattened vector
|
double |
unsafeGet(int i) |
void |
unsafeSet(int i,
double value) |
void |
validate()
Validates the internal data structure of the INDArray.
|
long |
zeroCount() |
broadcastCloneLike, ensureMutable, exp, get, getSliceViews, isBoolean, reciprocal, scale, set, set, sqrt, toArrayfinalize, getClass, notify, notifyAll, wait, wait, waitbroadcastCloneLike, ensureMutable, exp, get, getSliceViews, isBoolean, reciprocal, scale, set, set, sqrt, toArraypublic abstract double get(int i)
INDArraypublic abstract void set(int i,
double value)
public void unsafeSet(int i,
double value)
public double unsafeGet(int i)
public final int dimensionality()
INDArraydimensionality in interface INDArraypublic double get(int... indexes)
INDArraypublic double get()
INDArrayget in interface INDArrayget in class AbstractArray<Double>public AScalar slice(int position)
INDArraypublic AScalar slice(int dimension, int index)
INDArraypublic int sliceCount()
INDArraysliceCount in interface INDArraypublic List<Double> getSlices()
INDArraygetSlices in interface INDArraygetSlices in class AbstractArray<Double>public int[] getShape()
INDArraypublic int getShape(int dim)
INDArraygetShape in interface INDArraygetShape in class AbstractArray<Double>public long[] getLongShape()
INDArraygetLongShape in interface INDArraypublic final long elementCount()
INDArrayelementCount in interface INDArraypublic long nonZeroCount()
INDArraynonZeroCount in interface INDArraynonZeroCount in class AbstractArray<Double>public AVector subVector(int offset, int length)
public AVector join(AVector second)
second - public int compareTo(AVector a)
compareTo in interface Comparable<AVector>public boolean equals(Object o)
equals in class AbstractArray<Double>public boolean equals(AVector v)
public boolean equals(INDArray v)
INDArrayequals in interface INDArrayequals in class AbstractArray<Double>public boolean epsilonEquals(INDArray a, double tolerance)
INDArrayepsilonEquals in interface INDArrayepsilonEquals in class AbstractArray<Double>public boolean epsilonEquals(INDArray a)
INDArrayepsilonEquals in interface INDArrayepsilonEquals in class AbstractArray<Double>public boolean epsilonEquals(AVector v)
public boolean epsilonEquals(AVector v, double tolerance)
public int hashCode()
hashCode in class AbstractArray<Double>public void copyTo(double[] arr)
INDArraycopyTo in interface INDArraycopyTo in class AbstractArray<Double>public void copyTo(double[] data,
int offset)
public void copyTo(int offset,
double[] dest,
int destOffset,
int length)
public double[] toDoubleArray()
INDArraytoDoubleArray in interface INDArraytoDoubleArray in class AbstractArray<Double>public double[] asDoubleArray()
INDArrayasDoubleArray in interface INDArrayasDoubleArray in class AbstractArray<Double>public void toDoubleBuffer(DoubleBuffer dest)
INDArraytoDoubleBuffer in interface INDArraytoDoubleBuffer in class AbstractArray<Double>public void copyTo(AVector dest, int destOffset)
public void copyTo(AArrayVector dest, int destOffset)
public void copyTo(int offset,
AVector dest,
int destOffset,
int length)
public void fill(double value)
fill in interface INDArrayfill in class AbstractArray<Double>value - public void fillRange(int offset,
int length,
double value)
public void clamp(double min,
double max)
clamp in interface INDArrayclamp in class AbstractArray<Double>value - public void clampMax(double max)
public void clampMin(double min)
public void multiply(double factor)
public void multiply(INDArray a)
INDArraymultiply in interface INDArraymultiply in class AbstractArray<Double>public void multiply(AVector v)
public void multiply(double[] data,
int offset)
public void multiplyTo(double[] data,
int offset)
public void divide(double factor)
INDArraydivide in interface INDArraydivide in class AbstractArray<Double>public void divide(INDArray a)
INDArraydivide in interface INDArraydivide in class AbstractArray<Double>public void divide(AVector v)
public void divide(double[] data,
int offset)
public void divideTo(double[] data,
int offset)
public void abs()
abs in interface INDArrayabs in class AbstractArray<Double>public void log()
INDArraylog in interface INDArraylog in class AbstractArray<Double>public void signum()
signum in interface INDArraysignum in class AbstractArray<Double>public void square()
square in interface INDArraysquare in class AbstractArray<Double>public void tanh()
public void logistic()
public final void scale(AVector v)
v - public double scaleToMagnitude(double targetMagnitude)
public void scaleAdd(double factor,
AVector v)
public void interpolate(AVector v, double alpha)
public double magnitudeSquared()
public AVector getTranspose()
INDArraygetTranspose in interface INDArraygetTranspose in class AbstractArray<Double>public Vector getTransposeCopy()
INDArraygetTransposeCopy in interface INDArraygetTransposeCopy in class AbstractArray<Double>public final AVector getTransposeView()
INDArraygetTransposeView in interface INDArraygetTransposeView in class AbstractArray<Double>public INDArray outerProduct(INDArray a)
INDArrayouterProduct in interface INDArrayouterProduct in class AbstractArray<Double>public INDArray innerProduct(INDArray a)
INDArrayinnerProduct in interface INDArrayinnerProduct in class AbstractArray<Double>public double dotProduct(AVector v)
public double dotProduct(Vector v)
public double dotProduct(double[] data,
int offset)
data - offset - public void crossProduct(AVector a)
public double magnitude()
public double distanceSquared(AVector v)
public double distance(AVector v)
public double distanceL1(AVector v)
public double distanceLinf(AVector v)
public double maxAbsElement()
public double normaliseMaxAbsElement()
public double elementSum()
elementSum in interface INDArrayelementSum in class AbstractArray<Double>public final double elementSquaredSum()
INDArrayelementSquaredSum in interface INDArrayelementSquaredSum in class AbstractArray<Double>public double angle(AVector v)
public double normalise()
public void negate()
INDArraynegate in interface INDArraynegate in class AbstractArray<Double>public void pow(double exponent)
INDArraypow in interface INDArraypow in class AbstractArray<Double>public void set(AVector src)
public final void set(double a)
INDArrayset in interface INDArrayset in class AbstractArray<Double>@Deprecated public void set(double[] data)
public void setElements(double[] data)
INDArraysetElements in interface INDArraysetElements in class AbstractArray<Double>public void set(INDArray a)
INDArrayset in interface INDArrayset in class AbstractArray<Double>public void setElements(double[] values,
int offset,
int length)
INDArraysetElements in interface INDArraypublic void getElements(double[] dest,
int offset)
INDArraygetElements in interface INDArraygetElements in class AbstractArray<Double>public void set(AVector src, int srcOffset)
src - srcOffset - public void setValues(double... values)
public long zeroCount()
public AVector clone()
clone in interface INDArrayclone in class AbstractArray<Double>public final AVector asVector()
INDArraypublic INDArray reshape(int... dimensions)
INDArrayreshape in interface INDArrayreshape in class AbstractArray<Double>public boolean isView()
public boolean isMutable()
public boolean isElementConstrained()
INDArrayisElementConstrained in interface INDArraypublic boolean isFullyMutable()
isFullyMutable in interface INDArraypublic void add(AVector v)
v - public void add(INDArray a)
INDArrayadd in interface INDArrayadd in class AbstractArray<Double>public void sub(INDArray a)
INDArraysub in interface INDArraysub in class AbstractArray<Double>public void add(AVector src, int srcOffset)
src - public void add(int offset,
AVector a)
offset - a - public void add(int offset,
AVector a,
int aOffset,
int length)
offset - a - public void addMultiple(AVector src, double factor)
src - public void addMultiple(AVector src, int srcOffset, double factor)
public void addMultiple(int offset,
AVector src,
int srcOffset,
int length,
double factor)
public void addMultiple(int offset,
AVector v,
double factor)
public void addWeighted(AVector v, double factor)
v - public void sub(AVector v)
v - public void sub(double d)
INDArraysub in interface INDArraysub in class AbstractArray<Double>public boolean isZero()
isZero in interface INDArrayisZero in class AbstractArray<Double>public boolean isUnitLengthVector()
public boolean isSameShape(INDArray a)
INDArrayisSameShape in interface INDArrayisSameShape in class AbstractArray<Double>public boolean isSameShape(AVector a)
public void projectToPlane(AVector normal, double distance)
public void subMultiple(AVector v, double factor)
v - public String toString()
toString in class AbstractArray<Double>public Vector toVector()
INDArraytoVector in interface INDArraytoVector in class AbstractArray<Double>public AVector toNormal()
public List<Double> asElementList()
INDArrayasElementList in interface INDArrayasElementList in class AbstractArray<Double>public Iterator<Double> elementIterator()
INDArrayelementIterator in interface INDArrayelementIterator in class AbstractArray<Double>public void set(IVector vector)
public void addMultiple(Vector source, Index sourceToDest, double factor)
source - sourceToDest - factor - public void addMultiple(AVector source, Index sourceToDest, double factor)
source - sourceToDest - factor - public void addMultiple(Index destToSource, Vector source, double factor)
source - destToSource - factor - public void addMultiple(Index destToSource, AVector source, double factor)
source - destToSource - factor - public void set(AVector v, Index indexes)
public void addToArray(double[] array,
int offset)
public void addToArray(int offset,
double[] array,
int arrayOffset,
int length)
public void addMultipleToArray(double factor,
int offset,
double[] array,
int arrayOffset,
int length)
public void addProductToArray(double factor,
int offset,
AVector other,
int otherOffset,
double[] array,
int arrayOffset,
int length)
public void addProductToArray(double factor,
int offset,
AArrayVector other,
int otherOffset,
double[] array,
int arrayOffset,
int length)
public void applyOp(IOp op)
INDArraypublic void applyOp(Op op)
INDArraypublic void addAt(int i,
double v)
i - v - public void scaleAdd(double factor,
double constant)
INDArrayscaleAdd in interface INDArrayscaleAdd in class AbstractArray<Double>public void add(double constant)
INDArrayadd in interface INDArrayadd in class AbstractArray<Double>public abstract AVector exactClone()
exactClone in interface INDArraypublic boolean equalsArray(double[] data)
public void setRange(int offset,
double[] data,
int dataOffset,
int length)
public INDArray broadcast(int... targetShape)
INDArraybroadcast in interface INDArraybroadcast in class AbstractArray<Double>public INDArray broadcastLike(INDArray target)
INDArraybroadcastLike in interface INDArraybroadcastLike in class AbstractArray<Double>public void validate()
INDArrayvalidate in interface INDArrayvalidate in class AbstractArray<Double>Copyright © 2013. All Rights Reserved.