Esempio n. 1
0
        public void SearchAutomorphism(sbyte [] vector, string file, int numOfFiles)
        {
            uint           size = (uint)Math.Sqrt(vector.Length);
            HadamardMatrix hMtx = new HadamardMatrix(size, vector);

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

            t.ContinueWith((state) =>
            {
                uint count = hMtx.GetSubstitutionsCount();
                BatchResults.Add(file, count);
                string s = "";
                s        = "AutomorphMatrix Test:"
                           + "\nВсего найдено: " + count;
                //MessageBox.Show(s);
                ResultInfo = s;
                if (BatchResults.Count == numOfFiles)
                {
                    SaveBatchResult(batchProcessDir);
                    MessageBox.Show("BatchProcess Finish");
                }
            }, ts);
        }
Esempio n. 2
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);
        }