public class DTypeUtils extends Object
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
logger |
Constructor and Description |
---|
DTypeUtils() |
Modifier and Type | Method and Description |
---|---|
static Object |
fromDoublesToBiggestPrimitives(double[] x,
int dtype) |
static Number |
fromDoubleToBiggestNumber(double x,
int dtype) |
static int |
getBestDType(int atype,
int btype)
Find dataset type that best fits given types The best type takes into account complex and array datasets
|
static int |
getBestFloatDType(Class<? extends Object> cls)
Find floating point dataset type that best fits given class The best type takes into account complex and array
datasets
|
static int |
getBestFloatDType(int otype)
Find floating point dataset type that best fits given types.
|
static int |
getDType(Class<? extends Dataset> clazz) |
static int |
getDType(ILazyDataset d)
Get dataset type from given dataset
|
static int |
getDTypeFromClass(Class<? extends Object> cls)
Get dataset type from an element class
|
static int |
getDTypeFromClass(Class<? extends Object> cls,
int isize)
Get dataset type from an element class
|
static int |
getDTypeFromObject(Object obj)
Get dataset type from an object.
|
static String |
getDTypeName(Dataset a) |
static String |
getDTypeName(ILazyDataset a) |
static String |
getDTypeName(int dtype,
int itemSize) |
static int |
getElementalDType(int otype) |
static Class<?> |
getElementClass(int dtype) |
static int |
getElementsPerItem(int dtype) |
static int |
getItemBytes(int dtype) |
static int |
getItemBytes(int dtype,
int isize) |
static int |
getLargestDType(int otype)
The largest dataset type suitable for a summation of around a few thousand items without changing from the "kind"
of dataset
|
static int |
getLength(Object b) |
static boolean |
isClassSupportedAsElement(Class<? extends Object> comp) |
static boolean |
isDTypeComplex(int dtype) |
static boolean |
isDTypeElemental(int dtype) |
static boolean |
isDTypeFloating(int dtype) |
static boolean |
isDTypeInteger(int dtype) |
static boolean |
isDTypeNumerical(int dtype) |
static boolean |
toBoolean(Object b) |
static byte[] |
toByteArray(Object b,
int itemSize) |
static double[] |
toDoubleArray(Object b,
int itemSize) |
static float[] |
toFloatArray(Object b,
int itemSize) |
static double |
toImag(Object b) |
static int[] |
toIntegerArray(Object b,
int itemSize) |
static long |
toLong(double d) |
static long |
toLong(float d) |
static long |
toLong(Object b) |
static long[] |
toLongArray(Object b,
int itemSize) |
static double |
toReal(Object b) |
static short[] |
toShortArray(Object b,
int itemSize) |
protected static final org.slf4j.Logger logger
public DTypeUtils()
public static String getDTypeName(Dataset a)
a
- public static String getDTypeName(ILazyDataset a)
a
- public static String getDTypeName(int dtype, int itemSize)
dtype
- itemSize
- public static int getDType(Class<? extends Dataset> clazz)
clazz
- dataset classpublic static boolean isDTypeElemental(int dtype)
public static boolean isDTypeInteger(int dtype)
public static boolean isDTypeFloating(int dtype)
public static boolean isDTypeComplex(int dtype)
public static boolean isDTypeNumerical(int dtype)
dtype
- public static int getBestDType(int atype, int btype)
atype
- first dataset typebtype
- second dataset typepublic static int getBestFloatDType(int otype)
otype
- old dataset typepublic static int getBestFloatDType(Class<? extends Object> cls)
cls
- of an item or elementpublic static int getDTypeFromClass(Class<? extends Object> cls)
cls
- element classpublic static int getDTypeFromClass(Class<? extends Object> cls, int isize)
cls
- element classpublic static int getDTypeFromObject(Object obj)
obj
- public static int getDType(ILazyDataset d)
d
- public static int getLargestDType(int otype)
otype
- public static int getElementalDType(int otype)
otype
- public static boolean isClassSupportedAsElement(Class<? extends Object> comp)
comp
- public static int getElementsPerItem(int dtype)
dtype
- public static int getItemBytes(int dtype)
dtype
- public static int getItemBytes(int dtype, int isize)
dtype
- isize
- number of elements in an itempublic static final long toLong(double d)
d
- public static final long toLong(float d)
d
- public static double[] toDoubleArray(Object b, int itemSize)
public static float[] toFloatArray(Object b, int itemSize)
public static long[] toLongArray(Object b, int itemSize)
public static int[] toIntegerArray(Object b, int itemSize)
public static short[] toShortArray(Object b, int itemSize)
public static byte[] toByteArray(Object b, int itemSize)
public static Object fromDoublesToBiggestPrimitives(double[] x, int dtype)
public static Number fromDoubleToBiggestNumber(double x, int dtype)
x
- dtype
- public static Class<?> getElementClass(int dtype)
dtype
- Copyright © 2014–2018 Eclipse Foundation. All rights reserved.