Beispiel #1
0
        private static void findField()
        {
            int size = 5;

            long[,] addOp  = new long[size, size];
            long[,] multOp = new long[size, size];

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    for (int res = 0; res < size; res++)
                    {
                        for (int i1 = 0; i1 < size; i1++)
                        {
                            for (int j1 = 0; j1 < size; j1++)
                            {
                                for (int res1 = 0; res1 < size; res1++)
                                {
                                    addOp[i, j]    = res;
                                    multOp[i1, j1] = res1;

                                    FiniteRing finitRing = new FiniteRing(addOp, multOp);
                                    if (finitRing.CheckField() == null)
                                    {
                                        System.Console.WriteLine(addOp);
                                        System.Console.WriteLine(multOp);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        //private List<Polynom<long, ZnRing>> BatlerTest(Polynom<long, ZnRing> fx, long p)
        //{
        //    var _res = new List<Polynom<long, ZnRing>>();
        //    var _ring = new ZnRing(p);
        //    var _pring = new Rx<long, ZnRing>(_ring);
        //    var _derivative = fx.Derivative;
        //    var _gcd = Polynom<long, ZnRing>.GetGcd(fx, _derivative);

        //    if (_gcd.Degree > 0)
        //    {
        //        if (_derivative != _pring.Zero)
        //        {
        //            _res.Add(_gcd);
        //            _res.Add(fx.Div(_gcd, null));
        //            return _res;
        //        }
        //        else
        //        {
        //            var c = fx.Degree / p;
        //            var _pol = new Polynom<long, ZnRing>(_ring, (int)c);
        //            var _coeff = new List<long>();
        //            for(var i = 0; i < c; i++)
        //            {

        //            }
        //        }
        //    }

        //    return _res;
        //}

        private static void testCheckField()
        {
            long[,] addOp =
            {
                { 0, 1, 2, 3, 4 },
                { 1, 2, 3, 4, 0 },
                { 2, 3, 4, 0, 1 },
                { 3, 4, 0, 1, 2 },
                { 4, 0, 1, 2, 3 }
            };

            long[,] multOp =
            {
                { 0, 0, 0, 0, 0 },
                { 0, 1, 2, 3, 4 },
                { 0, 2, 4, 1, 3 },
                { 0, 3, 1, 4, 2 },
                { 0, 4, 3, 2, 1 }
            };

            FiniteRing finitRing = new FiniteRing(addOp, multOp);
            String     result    = finitRing.CheckField();

            if (result == null)
            {
                System.Console.WriteLine("Ring is Field!");
            }
            System.Console.WriteLine(result);
        }