Exemple #1
0
        public void Convert()
        {
            View <double, TExecutionSpace> view = new("CreateVector", 2);

            view[0] = 1321.258;
            view[1] = 123123.12;

            NdArray viewNdArray = View <double, TExecutionSpace> .RcpConvert(view.Pointer, 1);

            View <double, TExecutionSpace> cachedView = new(new NativePointer(view.Pointer, sizeof(double) * viewNdArray.Extent(0)), viewNdArray);

            double viewValue0 = view[0];
            double viewValue1 = view[1];

            double cachedViewValue0 = cachedView[0];
            double cachedViewValue1 = cachedView[1];

            Assert.IsTrue(Math.Abs(viewValue0 - cachedViewValue0) <= double.Epsilon);

            Assert.IsTrue(Math.Abs(viewValue1 - cachedViewValue1) <= double.Epsilon);
        }