Exemple #1
0
        public void SearchAutomorphism()
        {
            SubsCollection.Clear();
            SubsCollection.IterationStats.Clear();

            uint[] t1substitution = new uint[Mtx.SizeMtx];
            for (int i = 0; i < t1substitution.Length; ++i)
            {
                t1substitution[i] = (uint)i;
            }
            TaskScheduler ts = TaskScheduler.FromCurrentSynchronizationContext();
            Task          t  = mtx.SearchAutomorph(1, t1substitution);

            t.ContinueWith((state) =>
            {
                uint count = mtx.GetSubstitutionsCount();
                string s   = "";
                for (uint i = 0; i < count; i++)
                {
                    Substitution sub = new Substitution((int)mtx.SizeMtx);
                    sub.Position     = mtx.GetSubstitutions(i);
                    sub.Partitions   = (int)mtx.GetSubstitutionsParts(i);
                    sub.Sign         = mtx.GetSigns(i);
                    subsCollection.Add(sub);
                }
                uint cnt = 0;
                foreach (var elem in subsCollection)
                {
                    cnt += (uint)elem.Partitions;
                }
                uint[] a = mtx.GetSubstitutions(0);
                for (uint i = 0; i < Mtx.SizeMtx; i++)
                {
                    SubsCollection.IterationStats.Add(Mtx.GetIterationDepthValue(i));
                }
                s += String.Join(",", a) + "\n";
                s  = "AutomorphMatrix Test:"
                     + GetInfo()
                     + "\nВсего найдено: " + count
                     + "\nВсего перебрано: " + cnt;
                // + "\nПервый Вектор: " + s;
                MessageBox.Show(s);
                ResultInfo = s;
            }, ts);
        }
Exemple #2
0
        public void GenerateExtMatrix()
        {
            SubsCollection.Clear();

            int size = (int)Mtx.SizeMtx * 2;

            sbyte[] vector = new sbyte[size * size];

            for (int i = 0; i < (int)Mtx.SizeMtx; i++)
            {
                vector[i + i * size] = 2;
            }
            for (int i = (int)Mtx.SizeMtx; i < size; i++)
            {
                for (int j = 0; j < (int)Mtx.SizeMtx; j++)
                {
                    vector[i + j * size] = Mtx[i - (int)Mtx.SizeMtx, j];
                }
            }

            Mtx = new HadamardMatrix((uint)size, vector);
        }