167 lines
4.8 KiB
Java
167 lines
4.8 KiB
Java
|
package o;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class cVU {
|
||
|
public final int[] c;
|
||
|
public final C5057blp d;
|
||
|
|
||
|
public cVU(C5057blp c5057blp, int[] iArr) {
|
||
|
if (iArr.length == 0) {
|
||
|
throw new IllegalArgumentException();
|
||
|
}
|
||
|
this.d = c5057blp;
|
||
|
int length = iArr.length;
|
||
|
int i = 1;
|
||
|
if (length <= 1 || iArr[0] != 0) {
|
||
|
this.c = iArr;
|
||
|
return;
|
||
|
}
|
||
|
while (i < length && iArr[i] == 0) {
|
||
|
i++;
|
||
|
}
|
||
|
if (i == length) {
|
||
|
this.c = new int[]{0};
|
||
|
return;
|
||
|
}
|
||
|
int i2 = length - i;
|
||
|
int[] iArr2 = new int[i2];
|
||
|
this.c = iArr2;
|
||
|
System.arraycopy(iArr, i, iArr2, 0, i2);
|
||
|
}
|
||
|
|
||
|
public final int d(int i) {
|
||
|
if (i == 0) {
|
||
|
int[] iArr = this.c;
|
||
|
return iArr[iArr.length - 1];
|
||
|
}
|
||
|
if (i == 1) {
|
||
|
int i2 = 0;
|
||
|
for (int i3 : this.c) {
|
||
|
i2 = (i2 + i3) % this.d.e;
|
||
|
}
|
||
|
return i2;
|
||
|
}
|
||
|
int[] iArr2 = this.c;
|
||
|
int i4 = iArr2[0];
|
||
|
int length = iArr2.length;
|
||
|
for (int i5 = 1; i5 < length; i5++) {
|
||
|
C5057blp c5057blp = this.d;
|
||
|
i4 = (c5057blp.c(i, i4) + this.c[i5]) % c5057blp.e;
|
||
|
}
|
||
|
return i4;
|
||
|
}
|
||
|
|
||
|
public final cVU b(cVU cvu) {
|
||
|
if (!this.d.equals(cvu.d)) {
|
||
|
throw new IllegalArgumentException("ModulusPolys do not have same ModulusGF field");
|
||
|
}
|
||
|
int[] iArr = this.c;
|
||
|
if (iArr[0] == 0) {
|
||
|
return cvu;
|
||
|
}
|
||
|
int[] iArr2 = cvu.c;
|
||
|
if (iArr2[0] == 0) {
|
||
|
return this;
|
||
|
}
|
||
|
if (iArr.length <= iArr2.length) {
|
||
|
iArr = iArr2;
|
||
|
iArr2 = iArr;
|
||
|
}
|
||
|
int[] iArr3 = new int[iArr.length];
|
||
|
int length = iArr.length - iArr2.length;
|
||
|
System.arraycopy(iArr, 0, iArr3, 0, length);
|
||
|
for (int i = length; i < iArr.length; i++) {
|
||
|
C5057blp c5057blp = this.d;
|
||
|
iArr3[i] = (iArr2[i - length] + iArr[i]) % c5057blp.e;
|
||
|
}
|
||
|
return new cVU(this.d, iArr3);
|
||
|
}
|
||
|
|
||
|
public final cVU a(cVU cvu) {
|
||
|
if (this.d.equals(cvu.d)) {
|
||
|
return cvu.c[0] == 0 ? this : b(cvu.c());
|
||
|
}
|
||
|
throw new IllegalArgumentException("ModulusPolys do not have same ModulusGF field");
|
||
|
}
|
||
|
|
||
|
public final cVU e(cVU cvu) {
|
||
|
if (!this.d.equals(cvu.d)) {
|
||
|
throw new IllegalArgumentException("ModulusPolys do not have same ModulusGF field");
|
||
|
}
|
||
|
int[] iArr = this.c;
|
||
|
if (iArr[0] != 0) {
|
||
|
int[] iArr2 = cvu.c;
|
||
|
if (iArr2[0] != 0) {
|
||
|
int length = iArr.length;
|
||
|
int length2 = iArr2.length;
|
||
|
int[] iArr3 = new int[(length + length2) - 1];
|
||
|
for (int i = 0; i < length; i++) {
|
||
|
int i2 = iArr[i];
|
||
|
for (int i3 = 0; i3 < length2; i3++) {
|
||
|
int i4 = i + i3;
|
||
|
C5057blp c5057blp = this.d;
|
||
|
iArr3[i4] = (iArr3[i4] + c5057blp.c(i2, iArr2[i3])) % c5057blp.e;
|
||
|
}
|
||
|
}
|
||
|
return new cVU(this.d, iArr3);
|
||
|
}
|
||
|
}
|
||
|
return this.d.i;
|
||
|
}
|
||
|
|
||
|
public final cVU c() {
|
||
|
int length = this.c.length;
|
||
|
int[] iArr = new int[length];
|
||
|
for (int i = 0; i < length; i++) {
|
||
|
C5057blp c5057blp = this.d;
|
||
|
int i2 = this.c[i];
|
||
|
int i3 = c5057blp.e;
|
||
|
iArr[i] = (i3 - i2) % i3;
|
||
|
}
|
||
|
return new cVU(this.d, iArr);
|
||
|
}
|
||
|
|
||
|
public final String toString() {
|
||
|
StringBuilder sb = new StringBuilder((this.c.length - 1) << 3);
|
||
|
for (int length = this.c.length - 1; length >= 0; length--) {
|
||
|
int[] iArr = this.c;
|
||
|
int i = iArr[(iArr.length - 1) - length];
|
||
|
if (i != 0) {
|
||
|
if (i < 0) {
|
||
|
sb.append(" - ");
|
||
|
i = -i;
|
||
|
} else if (sb.length() > 0) {
|
||
|
sb.append(" + ");
|
||
|
}
|
||
|
if (length == 0 || i != 1) {
|
||
|
sb.append(i);
|
||
|
}
|
||
|
if (length != 0) {
|
||
|
if (length == 1) {
|
||
|
sb.append('x');
|
||
|
} else {
|
||
|
sb.append("x^");
|
||
|
sb.append(length);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return sb.toString();
|
||
|
}
|
||
|
|
||
|
public final cVU a(int i) {
|
||
|
if (i == 0) {
|
||
|
return this.d.i;
|
||
|
}
|
||
|
if (i == 1) {
|
||
|
return this;
|
||
|
}
|
||
|
int length = this.c.length;
|
||
|
int[] iArr = new int[length];
|
||
|
for (int i2 = 0; i2 < length; i2++) {
|
||
|
iArr[i2] = this.d.c(this.c[i2], i);
|
||
|
}
|
||
|
return new cVU(this.d, iArr);
|
||
|
}
|
||
|
}
|