Пример #1
0
        public void Solve()
        {
            ColumnWiseMatrix A = GetInvertibleMatrix(128);

            DeviceManager.CheckDeviceSanity();
            var _A = A.GetMatrix <float>();

            ColumnWiseMatrix B = GetInvertibleMatrix(128, 2345);

            DeviceManager.CheckDeviceSanity();
            var _B = B.GetMatrix <float>();

            A.Solve(B);
            DeviceManager.CheckDeviceSanity();
            var _x = B.Get <float>();

            var BSanity  = A.Multiply(B);
            var _BSanity = BSanity.GetMatrix <float>();

            for (int i = 0; i < A.nRows; ++i)
            {
                for (int j = 0; j < A.nCols; ++j)
                {
                    double expected = _B[i, j];
                    Assert.IsTrue(Math.Abs(_BSanity[i, j] - expected) <= 5e-5);
                }
            }
        }