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(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[] 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() |
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() |
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) |
abstract double |
get(int i) |
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.
|
List<Double> |
getSlices() |
int |
hashCode() |
AVector |
innerProduct(AMatrix m) |
AScalar |
innerProduct(AVector v) |
INDArray |
innerProduct(INDArray a) |
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 |
multiplyTo(double[] data,
int offset) |
void |
negate() |
double |
normalise() |
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) |
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) |
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) |
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) |
void |
setValues(double... values) |
void |
signum()
Sets each component of the vector to its sign value (-1, 0 or 1)
|
AScalar |
slice(int position) |
int |
sliceCount() |
void |
square() |
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() |
List<Double> |
toList() |
String |
toString() |
void |
validate()
Validates the internal data structure of the INDArray.
|
get, get, scale, set, set, setElementspublic abstract double get(int i)
public abstract void set(int i,
double value)
public int dimensionality()
dimensionality in interface INDArraypublic int sliceCount()
sliceCount in interface INDArraypublic List<Double> getSlices()
getSlices in interface INDArraygetSlices in class AbstractArray<Double>public int[] getShape()
INDArraypublic long[] getLongShape()
INDArraygetLongShape in interface INDArraypublic long elementCount()
elementCount in interface INDArraypublic 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[] data,
int offset)
public void copyTo(int offset,
double[] dest,
int destOffset,
int length)
public double[] toArray()
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(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)
outerProduct in interface INDArrayouterProduct in class AbstractArray<Double>public INDArray innerProduct(INDArray a)
innerProduct 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()
public double angle(AVector v)
public double normalise()
public void negate()
public void set(AVector src)
public void set(double a)
set in interface INDArrayset in class AbstractArray<Double>public void set(INDArray a)
set in interface INDArrayset in class AbstractArray<Double>public void setElements(double[] values,
int offset,
int length)
setElements 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)
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(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)
public void add(double constant)
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.