private void Verify(SparseTernaryPolynomial poly)
        {
            // make sure ones and negative ones don't share indices
            int[] ones = poly.GetOnes();
            int[] nones = poly.GetNegOnes();

            for (int i = 0; i < ones.Length; i++)
            {
                for (int j = 0; j < nones.Length; j++)
                {
                    if (ones[i] == nones[j])
                        throw new Exception("SparseTernaryPolynomial GenerateRandom test failed!");
                }
            }
        }