Esempio n. 1
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }
            SparseTernaryPolynomial other = (SparseTernaryPolynomial)obj;

            if (N != other.N)
            {
                return(false);
            }
            if (!Array.Equals(NegOnes, other.NegOnes))
            {
                return(false);
            }
            if (!Array.Equals(Ones, other.Ones))
            {
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        public static ProductFormPolynomial GenerateRandom(int N, int df1, int df2, int df3Ones, int df3NegOnes, SecureRandom random)
        {
            SparseTernaryPolynomial f1 = SparseTernaryPolynomial.GenerateRandom(N, df1, df1, random);
            SparseTernaryPolynomial f2 = SparseTernaryPolynomial.GenerateRandom(N, df2, df2, random);
            SparseTernaryPolynomial f3 = SparseTernaryPolynomial.GenerateRandom(N, df3Ones, df3NegOnes, random);

            return(new ProductFormPolynomial(f1, f2, f3));
        }
Esempio n. 3
0
        public static ProductFormPolynomial FromBinary(Stream stream, int N, int df1, int df2, int df3Ones, int df3NegOnes)
        {
            SparseTernaryPolynomial f1;

            f1 = SparseTernaryPolynomial.FromBinary(stream, N, df1, df1);
            SparseTernaryPolynomial f2 = SparseTernaryPolynomial.FromBinary(stream, N, df2, df2);
            SparseTernaryPolynomial f3 = SparseTernaryPolynomial.FromBinary(stream, N, df3Ones, df3NegOnes);

            return(new ProductFormPolynomial(f1, f2, f3));
        }
Esempio n. 4
0
 public ProductFormPolynomial(SparseTernaryPolynomial f1, SparseTernaryPolynomial f2, SparseTernaryPolynomial f3)
 {
     F1 = f1;
     F2 = f2;
     F3 = f3;
 }