public class Vectorz extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN_SPARSE_LENGTH
Specified the minimum length at which it is worthwhile creating sparse vectors rather than
dense vectors.
|
static double |
TEST_EPSILON
Constant tolerance used for testing double values
|
| Constructor and Description |
|---|
Vectorz() |
| Modifier and Type | Method and Description |
|---|---|
static double |
averageSquaredDifference(AVector a,
AVector b)
Deprecated.
|
static double |
averageValue(AVector v)
Deprecated.
|
static AVector |
axisVector(int axisIndex,
int dimensions) |
static AVector |
create(AVector vector)
Creates a mutable clone of a given vector
|
static AVector |
create(double... data)
Creates a vector using the given double data, using the most efficient dense representation.
|
static AVector |
create(DoubleBuffer d)
Create a vector from a DoubleBuffer
Note: consumes all doubles from the buffer
|
static AVector |
create(Iterable<Object> d)
Create a vector from an arbitrary iterable object
|
static AVector |
create(IVector vector)
Creates a mutable clone of a given vector
|
static AVector |
create(List<Object> d)
Create a vector from a list of numerical values (objects should be java.lang.Number instances)
|
static AVector |
create(Object o) |
static AVector |
createMutableRange(int length)
Create a mutable vector contain the sequence of integers from 0 to length-1
|
static AVector |
createMutableVector(AVector v)
Deprecated.
|
static AVector |
createRange(int length)
Create an immutable vector contain the sequence of integers from 0 to length-1
|
static AVector |
createRepeatedElement(int length,
double value)
Create an immutable vector containing a single repeated value.
|
static AVector |
createSameSize(AVector v)
Creates a new zero-filled vector of the same size as the given Vector.
|
static Scalar |
createScalar(double value) |
static AVector |
createSparse(AVector v)
Creates a sparse vector from the data in the given vector.
|
static AVector |
createSparse(Object... values)
Creates a sparse vector from an array of Object values
|
static AVector |
createSparse(Object data)
Creates a sparse vector from an array of Object values
|
static AVector |
createSparseMutable(AVector v) |
static AVector |
createSparseMutable(int length)
Creates a mutable sparse vector from the data in the given vector.
|
static AVector |
createUniformRandomVector(int dimensions) |
static AVector |
createZeroVector(long l)
Creates an immutable zero vector of the specified length.
|
static void |
fillBinaryRandom(AVector v) |
static void |
fillBinaryRandom(AVector v,
double prob) |
static void |
fillGaussian(AVector v) |
static void |
fillGaussian(AVector v,
double mean,
double sd) |
static void |
fillGaussian(AVector v,
double mean,
double sd,
Random r) |
static void |
fillGaussian(AVector v,
Random r) |
static void |
fillIndexes(AVector v)
Fills a vector with index values
|
static void |
fillNormal(AVector v,
long seed)
Fills a mutable vector with random normally distributed values
|
static void |
fillNormal(AVector v,
Random random)
Fills a mutable vector with random normally distributed values
|
static void |
fillRandom(AVector v)
Fills a vector with uniform random numbers in the range [0..1)
|
static void |
fillRandom(AVector v,
long seed)
Fills a mutable vector with random double values in the range [0..1)
|
static void |
fillRandom(AVector v,
Random random)
Fills a mutable vector with random double values in the range [0..1)
|
static AVector |
immutableZeroVector(int dimensions)
Returns an immutable vector of zeros
|
static int |
indexOfMaxValue(AVector v)
Deprecated.
|
static int |
indexOfMinValue(AVector v)
Deprecated.
|
static void |
invSqrt(AVector v) |
static void |
invSqrt(Vector v) |
static boolean |
isUncountable(double value)
utility function to test whether a value is uncountable
|
static AVector |
join(AVector... vectors)
Join one or more vectors into a single concatenated vector
|
static AVector |
join(AVector first,
AVector second)
Creates a joined vector that refers to the two underlying vectors
|
static AVector |
join(List<AVector> vectors)
Join a list of vectors into a single concatenated vector
|
static double |
maxValue(AVector v)
Deprecated.
|
static double |
minValue(AVector v)
Deprecated.
|
static AVector |
newVector(int length)
Returns a new mutable vector filled with zeros of the specified length.
|
static AVector |
parse(String ednString)
Parse a vector in edn format
|
static double |
rmsDifference(AVector a,
AVector b) |
static int |
safeLongToInt(long value)
Cast a long to an int value, and throws an exception if the result does not fit in an int
|
static void |
swap(AVector a,
AVector b)
Swaps two vectors, mutating both.
|
static double |
totalValue(AVector v)
Deprecated.
|
static AVector |
toVector(Object o)
Coerce to AVector.
|
static Vector |
wrap(double... data)
Wraps a double array as a Vector instance.
|
static AVector |
wrap(double[][] data) |
static ADenseArrayVector |
wrap(double[] data,
int offset,
int length) |
static AStridedVector |
wrapStrided(double[] data,
int offset,
int length,
int stride) |
public static final double TEST_EPSILON
public static final int MIN_SPARSE_LENGTH
public static AVector create(double... data)
data - public static AVector join(AVector first, AVector second)
first - second - public static AVector join(AVector... vectors)
vectors - public static AVector join(List<AVector> vectors)
vectors - public static AVector createZeroVector(long l)
l - public static Vector wrap(double... data)
data - public static AVector wrap(double[][] data)
public static ADenseArrayVector wrap(double[] data, int offset, int length)
public static AStridedVector wrapStrided(double[] data, int offset, int length, int stride)
public static AVector newVector(int length)
length - public static AVector createSparse(AVector v)
v - Vector containing sparse element datapublic static AVector createSparse(Object... values)
values - public static AVector createSparse(Object data)
values - public static AVector createSparseMutable(int length)
v - Vector containing sparse element datapublic static AVector createSameSize(AVector v)
v - public static AVector create(AVector vector)
vector - public static AVector create(IVector vector)
vector - public static Scalar createScalar(double value)
public static AVector createUniformRandomVector(int dimensions)
@Deprecated public static AVector createMutableVector(AVector v)
public static AVector immutableZeroVector(int dimensions)
dimensions - public static AVector parse(String ednString)
ednString - public static AVector create(List<Object> d)
public static AVector create(DoubleBuffer d)
public static AVector create(Iterable<Object> d)
d - @Deprecated public static double minValue(AVector v)
v - @Deprecated public static int indexOfMinValue(AVector v)
v - @Deprecated public static double maxValue(AVector v)
@Deprecated public static int indexOfMaxValue(AVector v)
public static void invSqrt(AVector v)
public static void swap(AVector a, AVector b)
a - b - public static void invSqrt(Vector v)
@Deprecated public static double totalValue(AVector v)
@Deprecated public static double averageValue(AVector v)
@Deprecated public static double averageSquaredDifference(AVector a, AVector b)
public static void fillRandom(AVector v)
v - public static void fillIndexes(AVector v)
v - public static void fillGaussian(AVector v)
public static void fillGaussian(AVector v, double mean, double sd)
public static void fillBinaryRandom(AVector v)
public static AVector axisVector(int axisIndex, int dimensions)
public static void fillBinaryRandom(AVector v, double prob)
public static AVector toVector(Object o)
o - public static AVector createMutableRange(int length)
length - The length of vector to createpublic static AVector createRange(int length)
length - The length of vector to createpublic static AVector createRepeatedElement(int length, double value)
length - value - public static int safeLongToInt(long value)
value - A long valueIllegalArgumentException - if the long value is out of range for an intpublic static void fillRandom(AVector v, long seed)
public static void fillRandom(AVector v, Random random)
public static void fillNormal(AVector v, long seed)
public static void fillNormal(AVector v, Random random)
public static boolean isUncountable(double value)
value - Copyright © 2016. All rights reserved.