Here are the examples of the csharp api class ZXing.PDF417.Internal.EC.ModulusPoly.getCoefficient(int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
8 Examples
0
1. Example
View licenseinternal int evaluateAt(int a) { if (a == 0) { // Just return the x^0 coefficient return getCoefficient(0); } int size = coefficients.Length; int result = 0; if (a == 1) { // Just the sum of the coefficients foreach (var coefficient in coefficients) { result = field.add(result, coefficient); } return result; } result = coefficients[0]; for (int i = 1; i < size; i++) { result = field.add(field.multiply(a, result), coefficients[i]); } return result; }
0
2. Example
View licenseoverride public String ToString() { var result = new StringBuilder(8 * Degree); for (int degree = Degree; degree >= 0; degree--) { int coefficient = getCoefficient(degree); if (coefficient != 0) { if (coefficient < 0) { result.Append(" - "); coefficient = -coefficient; } else { if (result.Length > 0) { result.Append(" + "); } } if (degree == 0 || coefficient != 1) { result.Append(coefficient); } if (degree != 0) { if (degree == 1) { result.Append('x'); } else { result.Append("x^"); result.Append(degree); } } } } return result.ToString(); }
0
3. Example
View licenseinternal int evaluateAt(int a) { if (a == 0) { // Just return the x^0 coefficient return getCoefficient(0); } int result = 0; if (a == 1) { // Just the sum of the coefficients foreach (var coefficient in coefficients) { result = field.add(result, coefficient); } return result; } result = coefficients[0]; int size = coefficients.Length; for (int i = 1; i < size; i++) { result = field.add(field.multiply(a, result), coefficients[i]); } return result; }
0
4. Example
View licenseinternal int evaluateAt(int a) { if (a == 0) { // Just return the x^0 coefficient return getCoefficient(0); } int size = coefficients.Length; int result = 0; if (a == 1) { // Just the sum of the coefficients foreach (var coefficient in coefficients) { result = field.add(result, coefficient); } return result; } result = coefficients[0]; for (int i = 1; i < size; i++) { result = field.add(field.multiply(a, result), coefficients[i]); } return result; }
0
5. Example
View licenseinternal ModulusPoly[] divide(ModulusPoly other) { if (!field.Equals(other.field)) { throw new ArgumentException("ModulusPolys do not have same ModulusGF field"); } if (other.isZero) { throw new ArgumentException("Divide by 0"); } ModulusPoly quotient = field.getZero(); ModulusPoly remainder = this; int denominatorLeadingTerm = other.getCoefficient(other.Degree); int inverseDenominatorLeadingTerm = field.inverse(denominatorLeadingTerm); while (remainder.Degree >= other.Degree && !remainder.isZero) { int degreeDifference = remainder.Degree - other.Degree; int scale = field.multiply(remainder.getCoefficient(remainder.Degree), inverseDenominatorLeadingTerm); ModulusPoly term = other.multiplyByMonomial(degreeDifference, scale); ModulusPoly iterationQuotient = field.buildMonomial(degreeDifference, scale); quotient = quotient.add(iterationQuotient); remainder = remainder.subtract(term); } return new ModulusPoly[] { quotient, remainder }; }
0
6. Example
View licenseinternal ModulusPoly[] divide(ModulusPoly other) { if (!field.Equals(other.field)) { throw new ArgumentException("ModulusPolys do not have same ModulusGF field"); } if (other.isZero) { throw new DivideByZeroException(); } ModulusPoly quotient = field.Zero; ModulusPoly remainder = this; int denominatorLeadingTerm = other.getCoefficient(other.Degree); int inverseDenominatorLeadingTerm = field.inverse(denominatorLeadingTerm); while (remainder.Degree >= other.Degree && !remainder.isZero) { int degreeDifference = remainder.Degree - other.Degree; int scale = field.multiply(remainder.getCoefficient(remainder.Degree), inverseDenominatorLeadingTerm); ModulusPoly term = other.multiplyByMonomial(degreeDifference, scale); ModulusPoly iterationQuotient = field.buildMonomial(degreeDifference, scale); quotient = quotient.add(iterationQuotient); remainder = remainder.subtract(term); } return new ModulusPoly[] { quotient, remainder }; }
0
7. Example
View licensepublic override String ToString() { var result = new StringBuilder(8 * Degree); for (int degree = Degree; degree >= 0; degree--) { int coefficient = getCoefficient(degree); if (coefficient != 0) { if (coefficient < 0) { result.Append(" - "); coefficient = -coefficient; } else { if (result.Length > 0) { result.Append(" + "); } } if (degree == 0 || coefficient != 1) { result.Append(coefficient); } if (degree != 0) { if (degree == 1) { result.Append('x'); } else { result.Append("x^"); result.Append(degree); } } } } return result.ToString(); }
0
8. Example
View licensepublic override String ToString() { var result = new StringBuilder(8 * Degree); for (int degree = Degree; degree >= 0; degree--) { int coefficient = getCoefficient(degree); if (coefficient != 0) { if (coefficient < 0) { result.Append(" - "); coefficient = -coefficient; } else { if (result.Length > 0) { result.Append(" + "); } } if (degree == 0 || coefficient != 1) { result.Append(coefficient); } if (degree != 0) { if (degree == 1) { result.Append('x'); } else { result.Append("x^"); result.Append(degree); } } } } return result.ToString(); }