ILNumerics Computing Engine supports the most common numeric data types out of the box: double, float, complex, fcomplex, byte, short, int, long, ulong
If you need to convert from, let’s say ushort to float, you will not find any prepared conversion function in ILMath. Luckily, it is very easy to write your own:
Here comes a method which implements the conversion from ushort -> float. A straight forward version first:
/// <summary> /// Convert ushort data to ILArray<float> /// </summary> /// <param name="A">Input Array</param> /// <returns>Array of the same size as A, single precision float elements</returns> public static ILRetArray<float> UShort2Single(ILInArray<ushort> A) { using (ILScope.Enter(A)) { ILArray<float> ret = ILMath.zeros<float>(A.S); var retArr = ret.GetArrayForWrite(); var AArr = A.GetArrayForRead(); int c = 0; foreach (ushort a in A) { retArr[c++] = a; } return ret; } }