Exemplo n.º 1
0
        private static void quotiendFieldTest()
        {
            QuotientField <long> qf = new QuotientField <long>(new ZnRing(5));

            // Console.WriteLine(qf.Prod(new Tuple<long, long>(1, 1), new Tuple<long, long>(1, 2)));

            foreach (Tuple <long, long> item1 in qf.GetItems())
            {
                // Console.Write("({0},{1}) ", item1.Item1, item1.Item2);
                foreach (Tuple <long, long> item2 in qf.GetItems())
                {
                    Tuple <long, long> prod = qf.Prod(item1, item2);
                    Console.Write(prod);
                }
                Console.WriteLine();
            }

            ZnRing r = new ZnRing(5);

            foreach (long item1 in r)
            {
                // Console.Write("({0},{1}) ", item1.Item1, item1.Item2);
                foreach (long item2 in r)
                {
                    long prod = r.Prod(item1, item2);
                    Console.Write("{0} ", prod);
                }
                Console.WriteLine();
            }
        }
Exemplo n.º 2
0
        private static string ChequeAx1(int[,] OuterMult)
        {
            var _rowCount = OuterMult.GetLength(0);
            var _colCount = OuterMult.GetLength(1);

            var _GF2 = new ZnRing(_colCount);

            for (var i = 0; i < _rowCount; ++i)
            {
                for (var j = 0; j < _colCount; ++j)
                {
                    for (var k = 0; k < _colCount; ++k)
                    {
                        var _left  = OuterMult[OuterMult[i, j], k];
                        var _right = OuterMult[i, _GF2.Prod(j, k)];
                        if (_left != _right)
                        {
                            return(String.Format("({0}o{1})o{2}={3} != {0}o({1}{2})={4}", i, j, k, _left, _right));
                        }
                    }
                }
            }
            return(null);
        }