Exemplo n.º 1
0
        public PluckerSignMatrixDistribution(long sampleSize, int dimensions)
        {
            Matrix <double> mask = Matrix <double> .Build.Dense(5, 5, 1);

            mask[2, 0] = 0;
            mask[3, 0] = 0;
            mask[3, 1] = 0;
            for (long i = sampleSize; i > 0; i--)
            {
                Ngon          ngon       = Program.generateRandomNgon(dimensions);
                PluckerMatrix plucker    = new PluckerMatrix(ngon);
                SignMatrix    signMatrix = new SignMatrix(plucker, mask);

                SignMatrix fullKey = similarFullMatrix.Keys.FirstOrDefault(m => m.Equals(signMatrix));
                if (fullKey == null)
                {
                    similarFullMatrix.Add(signMatrix, new List <Ngon>());
                    fullKey = signMatrix;
                }
                similarFullMatrix[fullKey].Add(ngon);

                ReducedSignMatrix2 reducedKey = similarReducedMatrix.Keys.FirstOrDefault(m => m.Equals(signMatrix.getReduced2(mask)));
                if (reducedKey == null)
                {
                    similarReducedMatrix.Add(signMatrix.getReduced2(mask), new List <Ngon>());
                    reducedKey = signMatrix.getReduced2(mask);
                }
                similarReducedMatrix[reducedKey].Add(ngon);
                if (i % (sampleSize / 100) == 0)
                {
                    Console.Write("\rCreating sign matrix table: {0}%    ", i / (sampleSize / 100));
                }
            }
        }