MCPcopy Create free account
hub / github.com/creatale/node-dv / evaluateAt

Method evaluateAt

deps/zxing/core/src/zxing/pdf417/decoder/ec/ModulusPoly.cpp:98–118  ·  view source on GitHub ↗

* @return evaluation of this polynomial at a given point */

Source from the content-addressed store, hash-verified

96 * @return evaluation of this polynomial at a given point
97 */
98int ModulusPoly::evaluateAt(int a) {
99 int i;
100 if (a == 0) {
101 // Just return the x^0 coefficient
102 return getCoefficient(0);
103 }
104 int size = coefficients_->size();
105 if (a == 1) {
106 // Just the sum of the coefficients
107 int result = 0;
108 for (i = 0; i < size; i++) {
109 result = field_.add(result, coefficients_[i]);
110 }
111 return result;
112 }
113 int result = coefficients_[0];
114 for (i = 1; i < size; i++) {
115 result = field_.add(field_.multiply(a, result), coefficients_[i]);
116 }
117 return result;
118}
119
120Ref<ModulusPoly> ModulusPoly::add(Ref<ModulusPoly> other) {
121 if (&field_ != &other->field_) {

Callers 3

decodeMethod · 0.45
findErrorLocationsMethod · 0.45
findErrorMagnitudesMethod · 0.45

Calls 3

sizeMethod · 0.45
addMethod · 0.45
multiplyMethod · 0.45

Tested by

no test coverage detected