public class VectorMathOperation extends Object
Constructor and Description |
---|
VectorMathOperation() |
Modifier and Type | Method and Description |
---|---|
static Vector |
abs(Vector v)
Computes the absolute values of a vector, element-by-element.
|
DenseVector |
add(Vector v1,
double c)
Adds a constant to a vector, element-by-element.
|
DenseVector |
add(Vector v1,
Vector v2)
Adds two vectors, element-by-element.
|
double |
angle(Vector v1,
Vector v2)
Computes the angle between two vectors.
|
static Vector |
cos(Vector v)
Computes the cosine of a vector, element-by-element.
|
DenseVector |
divide(Vector v1,
Vector v2)
A vector is divided by another vector, element-by-element.
|
static Vector |
exp(Vector v)
Computes the exponential of a vector, element-by-element.
|
double |
innerProduct(Vector v1,
Vector v2)
Computes the inner or dot product of two vectors.
|
static Vector |
log(Vector v)
Computes the log of a vector, element-by-element.
|
DenseVector |
minus(Vector v1,
double c)
Subtracts a constant from a vector, element-by-element.
|
DenseVector |
minus(Vector v1,
Vector v2)
A vector subtracts another vector, element-by-element.
|
DenseVector |
multiply(Vector v1,
Vector v2)
Multiplies two vectors, element-by-element.
|
double |
norm(Vector v1)
Computes the norm of a vector.
|
double |
norm(Vector v1,
double p)
Computes the norm of a vector.
|
DenseVector |
opposite(Vector v1)
Multiples a vector by -1, element-by-element.
|
DenseVector |
pow(Vector v1,
double c)
Takes a power of a vector, element-by-element.
|
static Vector |
rbinom(int n,
int nTrials,
Vector p)
Generates
n random binomial numbers. |
static Vector |
rbinom(int n,
int nTrials,
Vector p,
RandomLongGenerator uniform)
Generates
n random binomial numbers. |
static Vector |
rnorm(int n)
Generates
n random standard Normals. |
static Vector |
rnorm(int n,
RandomStandardNormalGenerator z)
Generates
n random standard Normals. |
DenseVector |
scaled(Vector v1,
double c)
Scales a vector, element-by-element.
|
DenseVector |
scaled(Vector v1,
Real c)
Scales a vector, element-by-element.
|
static Vector |
sin(Vector v)
Computes the sine of a vector, element-by-element.
|
static Vector |
sqrt(Vector v)
Computes the square roots of a vector, element-by-element.
|
static Vector |
squared(Vector v)
Computes the squares of a vector, element-by-element.
|
static double |
sum(Vector v)
Computes the sum of all vector elements.
|
public DenseVector add(Vector v1, Vector v2)
v1
- a vectorv2
- a vectorpublic DenseVector minus(Vector v1, Vector v2)
v1
- a vectorv2
- a vectorpublic DenseVector multiply(Vector v1, Vector v2)
v1
- a vectorv2
- a vectorpublic DenseVector divide(Vector v1, Vector v2)
v1
- a vectorv2
- a vectorpublic double innerProduct(Vector v1, Vector v2)
v1
- a vectorv2
- a vectorpublic DenseVector pow(Vector v1, double c)
v1
- a vectorc
- a constantpublic DenseVector scaled(Vector v1, double c)
v1
- a vectorc
- a constantpublic DenseVector add(Vector v1, double c)
v1
- a vectorc
- a constantpublic DenseVector minus(Vector v1, double c)
v1
- a vectorc
- a constantpublic DenseVector scaled(Vector v1, Real c)
v1
- a vectorc
- a constantpublic DenseVector opposite(Vector v1)
v1
- a vectorpublic double angle(Vector v1, Vector v2)
v1
- a vectorv2
- a vectorv1
and v2
public double norm(Vector v1, double p)
v1
- a vectorp
- the norm degreepublic double norm(Vector v1)
v1
- a vectorpublic static double sum(Vector v)
v
- a vectorpublic static Vector squared(Vector v)
v
- a vectorpublic static Vector sqrt(Vector v)
v
- a vectorpublic static Vector abs(Vector v)
v
- a vectorpublic static Vector sin(Vector v)
v
- a vectorpublic static Vector cos(Vector v)
v
- a vectorpublic static Vector exp(Vector v)
v
- a vectorpublic static Vector log(Vector v)
v
- a vectorpublic static Vector rnorm(int n, RandomStandardNormalGenerator z)
n
random standard Normals.n
- a number or a countz
- a standard random Normal generatorn
random standard Normalspublic static Vector rnorm(int n)
n
random standard Normals.n
- a number or a countn
random standard Normalspublic static Vector rbinom(int n, int nTrials, Vector p, RandomLongGenerator uniform)
n
random binomial numbers.n
- a number or a countnTrials
- the number of trials, a natural numberp
- the success probability in each trial, [0, 1]uniform
- a uniform random number generatorn
random binomial NormalsCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.