## de.aitools.iv.mds.util Class VectorOperation

```java.lang.Object
de.aitools.iv.mds.util.VectorOperation
```

`public class VectorOperationextends java.lang.Object`

Author:
Anita

Constructor Summary
`VectorOperation()`

Method Summary
`static double[]` ```add(double[] v1, double[] v2)```
`static double` `lengthOf(double[] v)`
Length of input vector.
`static double` ```scalarProduct(double[] v1, double[] v2)```
Scalar product of input vectors.
`static double[]` ```scale(double[] v, double factor)```
Scales vector with input factor.
`static double[]` ```sub(double[] v1, double[] v2)```
Substraction.
`static double[]` `unitVector(double[] v)`
Calculates unit vector of input vector.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### VectorOperation

`public VectorOperation()`
Method Detail

### sub

```public static final double[] sub(double[] v1,
double[] v2)```
Substraction.

Returns:
array = v1 - v2

```public static final double[] add(double[] v1,
double[] v2)```

Returns:
array = v1 + v2

### scalarProduct

```public static final double scalarProduct(double[] v1,
double[] v2)```
Scalar product of input vectors.

Returns:
double = sum_i=0..v1.length ( v1[i] * v2[i] )

### lengthOf

`public static final double lengthOf(double[] v)`
Length of input vector.

Returns:
length of vector

### scale

```public static final double[] scale(double[] v,
double factor)```
Scales vector with input factor.

Returns:
array = v * factor

### unitVector

`public static final double[] unitVector(double[] v)`
Calculates unit vector of input vector.

Returns:
array = v / |v|