public void Xray(float ndevs) { if (IsComplex || IsHalf) { throw new Exception("Complex and half are not supported."); } for (int i = 0; i < Dims.Z; i++) { GPU.Xray(new IntPtr((long)GetDevice(Intent.Read) + DimsEffective.ElementsSlice() * i * sizeof(float)), new IntPtr((long)GetDevice(Intent.Write) + DimsEffective.ElementsSlice() * i * sizeof(float)), ndevs, new int2(DimsEffective), 1); } }
public void UpdateHostWithComplex(float2[][] complexData) { if (complexData.Length != Dims.Z || complexData[0].Length != DimsEffective.ElementsSlice()) { throw new DimensionMismatchException(); } float[][] Data = GetHost(Intent.Write); for (int z = 0; z < Dims.Z; z++) { float[] Slice = Data[z]; float2[] ComplexSlice = complexData[z]; for (int i = 0; i < ComplexSlice.Length; i++) { Slice[i * 2] = ComplexSlice[i].X; Slice[i * 2 + 1] = ComplexSlice[i].Y; } } }
public float2[][] GetHostComplexCopy() { if (!IsComplex) { throw new Exception("Data must be of complex type."); } float[][] Data = GetHost(Intent.Read); float2[][] ComplexData = new float2[Dims.Z][]; for (int z = 0; z < Dims.Z; z++) { float[] Slice = Data[z]; float2[] ComplexSlice = new float2[DimsEffective.ElementsSlice()]; for (int i = 0; i < ComplexSlice.Length; i++) { ComplexSlice[i] = new float2(Slice[i * 2], Slice[i * 2 + 1]); } ComplexData[z] = ComplexSlice; } return(ComplexData); }