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); }
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); }
public void InitHadamardMatrix(uint sizeMtx, sbyte[] mtxVector) { mtx = new HadamardMatrix(sizeMtx, mtxVector); }