Beispiel #1
0
        public void FactorisationPxFx_Test()
        {
            var p     = 3;
            var _GF3  = new ZnRing(p);
            var _ring = new PxFx <long, ZnRing>(
                _GF3, new Polynom <long, ZnRing>(_GF3, new long[] { 2, 2, 1 }));
            var _mod = new Polynom <Polynom <long, ZnRing>, PxFx <long, ZnRing> >(_ring,
                                                                                  new Polynom <long, ZnRing>[] {
                _ring.One, _ring.One, _ring.Zero, _ring.One,
                new Polynom <long, ZnRing>(_GF3, new long[] { 0, 1 })
            });
            var _pfx = new PxFx <Polynom <long, ZnRing>, PxFx <long, ZnRing> >(_ring, _mod);

            foreach (var _pol in _pfx)
            {
                //var _mults = _pol.Factorisation();
                var _mults = Polynom <long, ZnRing> .FactorisationPxFx(_pol);

                var _prod = new Polynom <Polynom <long, ZnRing>, PxFx <long, ZnRing> >(
                    _ring, new Polynom <long, ZnRing>[] { _ring.One });
                foreach (var _mult in _mults)
                {
                    _prod *= _mult;
                }

                if (!_pol.Equals(_prod))
                {
                    Assert.AreEqual(_pol, _prod, String.Format("Input: {0}", _pol.TexString("y", false)));
                }
            }
        }