de.flexiprovider.common.math.polynomials
Class ProductFormConvolutionPolynomial

java.lang.Object
  |
  +--de.flexiprovider.common.math.polynomials.ProductFormConvolutionPolynomial
All Implemented Interfaces:
ConvolutionPolynomial

public class ProductFormConvolutionPolynomial
extends java.lang.Object
implements ConvolutionPolynomial

This class represents product form polynomials in Z(X)/(X^N-1), i.e. polynomials of the form f1*f2+f3, where f1, f2, and f3 are sparse binary polynomials.

The fields have package visibility so that they can be accessed by ModQConvolutionPolynomial.

Author:
Martin Döring
See Also:
SparseBinaryConvolutionPolynomial

Field Summary
(package private)  SparseBinaryConvolutionPolynomial f1
          The three sparse binary polynomials
(package private)  SparseBinaryConvolutionPolynomial f2
          The three sparse binary polynomials
(package private)  SparseBinaryConvolutionPolynomial f3
          The three sparse binary polynomials
(package private)  int N
          The degree of the reduction polynomial
 
Constructor Summary
ProductFormConvolutionPolynomial(int N, int d1, int d2, int d3, SecureRandom sr)
          Construct a random product form polynomial.
ProductFormConvolutionPolynomial(ProductFormConvolutionPolynomial other)
          Copy constructor.
ProductFormConvolutionPolynomial(SparseBinaryConvolutionPolynomial f1, SparseBinaryConvolutionPolynomial f2, SparseBinaryConvolutionPolynomial f3)
          Construct a product form polynomial out of the three given sparse binary polynomials.
 
Method Summary
 boolean equals(java.lang.Object other)
          Compare this polynomial with the given object.
 int hashCode()
           
static ProductFormConvolutionPolynomial OS2REP(int N, int q, int d1, int d2, int d3, byte[] encoded)
          Decode a byte array into a product form polynomial.
 byte[] RE2OSP(int N)
          Encode this polynomial as a byte array.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

N

int N
The degree of the reduction polynomial

f1

SparseBinaryConvolutionPolynomial f1
The three sparse binary polynomials

f2

SparseBinaryConvolutionPolynomial f2
The three sparse binary polynomials

f3

SparseBinaryConvolutionPolynomial f3
The three sparse binary polynomials
Constructor Detail

ProductFormConvolutionPolynomial

public ProductFormConvolutionPolynomial(int N,
                                        int d1,
                                        int d2,
                                        int d3,
                                        SecureRandom sr)
Construct a random product form polynomial.
Parameters:
N - the degree of the reduction polynomial
d1 - the number of non-zero coefficients of the first sparse binary polynomial
d2 - the number of non-zero coefficients of the second sparse binary polynomial
d3 - the number of non-zero coefficients of the third sparse binary polynomial
sr - the source of randomness used for creating the sparse binary polynomial

ProductFormConvolutionPolynomial

public ProductFormConvolutionPolynomial(SparseBinaryConvolutionPolynomial f1,
                                        SparseBinaryConvolutionPolynomial f2,
                                        SparseBinaryConvolutionPolynomial f3)
                                 throws java.lang.ArithmeticException
Construct a product form polynomial out of the three given sparse binary polynomials.
Parameters:
f1 - the first sparse binary polynomial
f2 - the second sparse binary polynomial
f3 - the third sparse binary polynomial
Throws:
java.lang.ArithmeticException - if the sparse binary polynomials are not elements of the same ring

ProductFormConvolutionPolynomial

public ProductFormConvolutionPolynomial(ProductFormConvolutionPolynomial other)
Copy constructor.
Parameters:
other - another ModQPolynomialProductForm
Method Detail

RE2OSP

public byte[] RE2OSP(int N)
              throws java.lang.ArithmeticException
Encode this polynomial as a byte array.
Parameters:
N - the degree of the reduction polynomial
Returns:
the encoded polynomial
Throws:
java.lang.ArithmeticException - if this polynomial is not a binary element of Z(X)/(X^N-1).

OS2REP

public static ProductFormConvolutionPolynomial OS2REP(int N,
                                                      int q,
                                                      int d1,
                                                      int d2,
                                                      int d3,
                                                      byte[] encoded)
                                               throws java.lang.IllegalArgumentException
Decode a byte array into a product form polynomial.
Parameters:
N - - the degree of the reduction polynomial
q - - the modulus
d1 - - the number of non-zero coefficients of the first sparse binary polynomial
d2 - - the number of non-zero coefficients of the second sparse binary polynomial
d3 - - the number of non-zero coefficients of the third sparse binary polynomial
encoded - - the encoded polynomial
Returns:
the decoded polynomial
Throws:
java.lang.IllegalArgumentException - if the encoded polynomial has wrong length.

equals

public boolean equals(java.lang.Object other)
Compare this polynomial with the given object.
Overrides:
equals in class java.lang.Object
Parameters:
other - the other object
Returns:
the result of the comparison

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code of this polynomial

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a human readable form of this polynomial