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) |
void |
add(INDArray a) |
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) |
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,
ArrayVector 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)
|
List<Double> |
asElementList() |
AVector |
asVector()
Creates a view of the array as a single vector in row-major order.
|
INDArray |
broadcast(int... targetShape) |
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(ArrayVector 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) |
int |
countZeros() |
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) |
void |
divide(double[] data,
int offset) |
void |
divideTo(double[] data,
int offset) |
double |
dotProduct(AVector v) |
double |
dotProduct(AVector v,
Index ix) |
long |
elementCount()
Returns the total number of 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 |
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(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.
|
int |
hashCode() |
AVector |
innerProduct(AMatrix m) |
AScalar |
innerProduct(AVector v) |
INDArray |
innerProduct(INDArray a)
Calculates the inner product of this array with another array.
|
void |
interpolate(AVector a,
AVector b,
double alpha) |
void |
interpolate(AVector v,
double alpha) |
boolean |
isElementConstrained()
Returns true if the IND has additional 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 |
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 |
isZeroVector()
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() |
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() |
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 |
projectToPlane(AVector normal,
double distance) |
INDArray |
reshape(int... dimensions) |
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) |
void |
set(INDArray a) |
void |
set(int[] indexes,
double value) |
abstract void |
set(int i,
double value) |
void |
set(int offset,
double[] data,
int dataOffset,
int length)
Set part of this vector from a double array
|
void |
set(IVector vector) |
void |
setElements(double[] values,
int offset,
int length)
Sets all elements in an array using the given double values
|
void |
setValues(double... values) |
void |
signum()
Sets each component of the vector to its sign value (-1, 0 or 1)
|
AScalar |
slice(int position) |
AScalar |
slice(int dimension,
int index) |
int |
sliceCount() |
void |
square()
Squares all elements of the vector
|
void |
sub(AVector v)
Subtracts a vector from this vector
|
void |
sub(double d) |
void |
sub(INDArray a) |
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.
|
double[] |
toArray() |
void |
toDoubleBuffer(DoubleBuffer dest)
Copies the elements of this INDArray to the specified double buffer
|
List<Double> |
toList() |
String |
toString() |
void |
validate()
Validates the internal data structure of the INDArray.
|
get, get, getSliceViews, scale, set, set, setElements, toVectorfinalize, getClass, notify, notifyAll, wait, wait, waitget, get, getSliceViews, scale, set, set, setElements, toVectorpublic abstract double get(int i)
INDArraypublic abstract void set(int i,
double value)
public int dimensionality()
INDArraydimensionality in interface INDArraypublic double get(int... indexes)
INDArraypublic int sliceCount()
sliceCount 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 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)
INDArraypublic 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[] toArray()
public void toDoubleBuffer(DoubleBuffer dest)
INDArraytoDoubleBuffer in interface INDArraytoDoubleBuffer in class AbstractArray<Double>public void copyTo(AVector dest, int destOffset)
public void copyTo(ArrayVector dest, int destOffset)
public void copyTo(int offset,
AVector dest,
int destOffset,
int length)
public void fill(double value)
value - public void fillRange(int offset,
int length,
double value)
public void clamp(double min,
double max)
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)
public void divide(AVector v)
public void divide(double[] data,
int offset)
public void divideTo(double[] data,
int offset)
public void abs()
public void signum()
public void square()
square in class AbstractArray<Double>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 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 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()
negate in interface INDArraynegate in class AbstractArray<Double>public void set(AVector src)
public void set(double a)
INDArrayset in interface INDArrayset in class AbstractArray<Double>public void set(double[] data)
public void set(INDArray a)
set 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 int countZeros()
public AVector clone()
clone in interface INDArrayclone in class AbstractArray<Double>public AVector asVector()
INDArraypublic INDArray reshape(int... dimensions)
reshape 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)
add in interface INDArrayadd in class AbstractArray<Double>public void sub(INDArray a)
sub 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)
sub in interface INDArraysub in class AbstractArray<Double>public boolean isZeroVector()
public boolean isUnitLengthVector()
public void projectToPlane(AVector normal, double distance)
public void subMultiple(AVector v, double factor)
v - public String toString()
toString 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,
ArrayVector 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)
public void scaleAdd(double factor,
double constant)
INDArrayscaleAdd in interface INDArrayscaleAdd in class AbstractArray<Double>public void add(double constant)
add in interface INDArrayadd in class AbstractArray<Double>public abstract AVector exactClone()
exactClone in interface INDArraypublic boolean equalsArray(double[] data)
public void set(int offset,
double[] data,
int dataOffset,
int length)
public INDArray broadcast(int... targetShape)
broadcast in interface INDArraybroadcast in class AbstractArray<Double>public void validate()
INDArrayvalidate in interface INDArrayvalidate in class AbstractArray<Double>Copyright © 2013. All Rights Reserved.