public final class Util extends Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
bytesFromFloats(float[] fp)
Serialize floats to byte array.
|
static byte[] |
bytesFromShorts(short[] fp)
Serialize shorts to byte array.
|
static double |
euclideanNorm(float[] fp)
Euclidean norm of floats.
|
static float[] |
floatsFromBytes(byte[] serialized,
int length)
Deserialize byte arrays to floats.
|
static String |
floatsToDecimalString(float[] fp)
Create tab sep string from floats.
|
static double |
manhattanNorm(float[] fp)
Manhattan norm of floats.
|
static double |
maximumNorm(float[] fp)
Maximum norm of floats.
|
static float[] |
parseStringToFloats(String decimalString,
int length)
Parse space/tab sep floats string.
|
static short[] |
shortsFromBytes(byte[] serialized,
int length)
Pack bytes to shorts.
|
public static float[] parseStringToFloats(String decimalString, int length)
decimalString
- Input Stringlength
- Expected lengthpublic static String floatsToDecimalString(float[] fp)
fp
- Floatspublic static short[] shortsFromBytes(byte[] serialized, int length)
floatsFromBytes(byte[], int)
.serialized
- bytes representationlength
- Expected fingerprint lengthpublic static float[] floatsFromBytes(byte[] serialized, int length)
bytesFromFloats(float[])
.serialized
- Byte array representationlength
- Expected length of the floats formpublic static byte[] bytesFromFloats(float[] fp)
floatsFromBytes(byte[], int)
fp
- Floatspublic static byte[] bytesFromShorts(short[] fp)
shortsFromBytes(byte[], int)
fp
- Shortspublic static double euclideanNorm(float[] fp)
fp
- Floatspublic static double manhattanNorm(float[] fp)
fp
- Floatspublic static double maximumNorm(float[] fp)
fp
- Floats