Exemple #1
0
        private long[] Generate(IAtomContainer container, long[] seeds, IStereoEncoder encoder, int[][] graph)
        {
            Suppressed suppressed = suppression.Suppress(container);

            // compute original values then find indices equivalent values
            long[] original      = simple.Generate(seeds, encoder, graph, suppressed);
            var    equivalentSet = finder.Find(original, container, graph);
            var    equivalents   = equivalentSet.ToArray();

            // size of the matrix we need to make
            int n = original.Length;
            int m = equivalents.Length;

            // skip when there are no equivalent atoms
            if (m < 2)
            {
                return(original);
            }

            // matrix of perturbed values and identity values
            long[][] perturbed = Arrays.CreateJagged <long>(n, m + 1);

            // set the original values in the first column
            for (int i = 0; i < n; i++)
            {
                perturbed[i][0] = original[i];
            }

            // systematically perturb equivalent vertex
            for (int i = 0; i < m; i++)
            {
                int equivalentIndex = equivalents[i];

                // perturb the value and reset stereo configuration
                original[equivalentIndex] = Rotate(original[equivalentIndex]);
                encoder.Reset();

                // compute new hash codes and copy the values a column in the matrix
                long[] tmp = simple.Generate(Copy(original), encoder, graph, suppressed);
                for (int j = 0; j < n; j++)
                {
                    perturbed[j][i + 1] = tmp[j];
                }

                // reset value
                original[equivalentIndex] = perturbed[equivalentIndex][0];
            }

            return(Combine(perturbed));
        }
Exemple #2
0
 /// <summary>
 /// reset the left and right encoders
 /// </summary>
 public void Reset()
 {
     left.Reset();
     right.Reset();
 }