public class Mathematics extends Object
Constructor and Description |
---|
Mathematics() |
Modifier and Type | Method and Description |
---|---|
static double |
factorial(double n)
This method computes the factorial!
|
static int |
min(int x,
int y,
int z)
This just computes the minimum of three integer values.
|
static void |
scale(double scale,
double[] vec)
Scales a vector with the given scalar.
|
static void |
svMult(double s,
double[] v,
double[] res)
Multiplies (scales) every element of the array v with s in place.
|
static void |
svvAddAndScale(double s,
double[] v,
double[] w,
double[] res)
Add vectors scaled: res[i] = s*(v[i] + w[i])
|
static void |
svvAddScaled(double s,
double[] v,
double[] w,
double[] res)
Add vectors scaled: res[i] = s*v[i] + w[i]
|
static void |
swap(double a,
double b)
Swaps a and b if a is greater then b.
|
static void |
vvAdd(double[] v1,
double[] v2,
double[] res)
Add vectors in place setting res = v1 + v2.
|
static void |
vvAddOffs(double[] v1,
int v1Offs,
double[] v2,
int v2Offs,
double[] res,
int resOffs,
int len)
Add vectors in place setting with an offset within the target vector, meaning that
res[resOffs+i]=v1[v1Offs+i]+v2[v2Offs+i] for i in length. |
static double[] |
vvSub(double[] a,
double[] b)
Subtract vectors returning a new vector c = a - b.
|
static void |
vvSub(double[] a,
double[] b,
double[] res)
Subtract vectors returning a new vector c = a - b.
|
public static final double factorial(double n)
n
- public static final void swap(double a, double b)
a
- b
- public static int min(int x, int y, int z)
x
- y
- z
- public static void scale(double scale, double[] vec)
scale
- vec
- public static void svMult(double s, double[] v, double[] res)
s
- a scalarv
- an array to be multiplied with s.public static void svvAddAndScale(double s, double[] v, double[] w, double[] res)
s
- v
- w
- public static void svvAddScaled(double s, double[] v, double[] w, double[] res)
s
- v
- w
- public static void vvAdd(double[] v1, double[] v2, double[] res)
v1
- v2
- public static void vvAddOffs(double[] v1, int v1Offs, double[] v2, int v2Offs, double[] res, int resOffs, int len)
res[resOffs+i]=v1[v1Offs+i]+v2[v2Offs+i]
for i in length.v1
- v2
- public static double[] vvSub(double[] a, double[] b)
a
- b
- public static void vvSub(double[] a, double[] b, double[] res)
a
- b
- Copyright © 2007–2021. All rights reserved.