All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pdfjet.Polynomial Maven / Gradle / Ivy

/*    */ package com.pdfjet;
/*    */ 
/*    */ class Polynomial
/*    */ {
/*    */   private final int[] num;
/*    */ 
/*    */   public Polynomial(int[] paramArrayOfInt)
/*    */   {
/* 28 */     this(paramArrayOfInt, 0);
/*    */   }
/*    */ 
/*    */   public Polynomial(int[] paramArrayOfInt, int paramInt) {
/* 32 */     int i = 0;
/*    */ 
/* 34 */     while ((i < paramArrayOfInt.length) && (paramArrayOfInt[i] == 0)) {
/* 35 */       i++;
/*    */     }
/*    */ 
/* 38 */     this.num = new int[paramArrayOfInt.length - i + paramInt];
/* 39 */     System.arraycopy(paramArrayOfInt, i, this.num, 0, paramArrayOfInt.length - i);
/*    */   }
/*    */ 
/*    */   public int get(int paramInt) {
/* 43 */     return this.num[paramInt];
/*    */   }
/*    */ 
/*    */   public int getLength() {
/* 47 */     return this.num.length;
/*    */   }
/*    */ 
/*    */   public Polynomial multiply(Polynomial paramPolynomial) {
/* 51 */     int[] arrayOfInt = new int[getLength() + paramPolynomial.getLength() - 1];
/*    */ 
/* 53 */     for (int i = 0; i < getLength(); i++) {
/* 54 */       for (int j = 0; j < paramPolynomial.getLength(); j++) {
/* 55 */         arrayOfInt[(i + j)] ^= QRMath.gexp(QRMath.glog(get(i)) + QRMath.glog(paramPolynomial.get(j)));
/*    */       }
/*    */     }
/*    */ 
/* 59 */     return new Polynomial(arrayOfInt);
/*    */   }
/*    */ 
/*    */   public Polynomial mod(Polynomial paramPolynomial) {
/* 63 */     if (getLength() - paramPolynomial.getLength() < 0) {
/* 64 */       return this;
/*    */     }
/*    */ 
/* 67 */     int i = QRMath.glog(get(0)) - QRMath.glog(paramPolynomial.get(0));
/* 68 */     int[] arrayOfInt = new int[getLength()];
/* 69 */     for (int j = 0; j < getLength(); j++) {
/* 70 */       arrayOfInt[j] = get(j);
/*    */     }
/*    */ 
/* 73 */     for (j = 0; j < paramPolynomial.getLength(); j++) {
/* 74 */       arrayOfInt[j] ^= QRMath.gexp(QRMath.glog(paramPolynomial.get(j)) + i);
/*    */     }
/*    */ 
/* 77 */     return new Polynomial(arrayOfInt).mod(paramPolynomial);
/*    */   }
/*    */ }

/* Location:           E:\EGGWIFI\Customer\trunk\src\Workspace\Customer\Customer Maven Webapp\src\main\webapp\WEB-INF\lib\PDFjet.jar
 * Qualified Name:     com.pdfjet.Polynomial
 * JD-Core Version:    0.6.2
 */




© 2015 - 2024 Weber Informatics LLC | Privacy Policy