org.inria.myriads.snoozecommon.util
public final class MathUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
RESOURCE_VECTOR_SIZE
Size of the resource vectors.
|
Modifier and Type | Method and Description |
---|---|
static ArrayList<Double> |
addVectors(List<Double> firstVector,
List<Double> secondVector)
Adds two vectors.
|
static double |
computeEuclidNorm(List<Double> values)
Computes the Euclid norm.
|
static double |
computeL1Norm(List<Double> values)
Computes the L1 norm.
|
static double |
computeMaxNorm(List<Double> values)
Computes the Max norm.
|
static ArrayList<Double> |
createCustomVector(double cpu,
double memory,
NetworkDemand networkDemand)
Creates virtual machine utilization vector.
|
static ArrayList<Double> |
createEmptyVector()
Creates and empty vector.
|
static ArrayList<Double> |
divideVector(List<Double> vector,
int divisor)
Divides all values of a vector by a number.
|
static boolean |
isCorrectDimension(List<Double> firstVector,
List<Double> secondVector)
Verifies the dimensions.
|
static double |
roundDoubleValue(double value)
Rounds a double value to the first two digits.
|
static ArrayList<Double> |
substractVector(List<Double> firstVector,
List<Double> secondVector)
Divides all values of a vector by a number.
|
static boolean |
vectorCompareIsGreater(List<Double> firstVector,
List<Double> secondVector)
Compares two vectors.
|
static boolean |
vectorCompareIsLess(List<Double> firstVector,
List<Double> secondVector)
Compares two vectors.
|
public static final int RESOURCE_VECTOR_SIZE
public static boolean vectorCompareIsLess(List<Double> firstVector, List<Double> secondVector)
firstVector
- The first vectorsecondVector
- The second vectorpublic static double roundDoubleValue(double value)
value
- The original valuepublic static boolean vectorCompareIsGreater(List<Double> firstVector, List<Double> secondVector)
firstVector
- The first vectorsecondVector
- The second vectorpublic static boolean isCorrectDimension(List<Double> firstVector, List<Double> secondVector)
firstVector
- The first vectorsecondVector
- The second vectorpublic static ArrayList<Double> addVectors(List<Double> firstVector, List<Double> secondVector)
firstVector
- The first vectorsecondVector
- The second vectorpublic static ArrayList<Double> divideVector(List<Double> vector, int divisor)
vector
- The vectordivisor
- The divisorpublic static ArrayList<Double> substractVector(List<Double> firstVector, List<Double> secondVector)
firstVector
- The first vectorsecondVector
- The second vectorpublic static double computeL1Norm(List<Double> values)
values
- The datapublic static double computeMaxNorm(List<Double> values)
values
- The datapublic static ArrayList<Double> createCustomVector(double cpu, double memory, NetworkDemand networkDemand)
cpu
- The cpu utilizationmemory
- The memory usagenetworkDemand
- The network demandpublic static ArrayList<Double> createEmptyVector()
Copyright © 2013. All Rights Reserved.