You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ref<GenericGFPoly> GenericGFPoly::addOrSubtract(Ref<zxing::GenericGFPoly> other) {
if (!(field_.object_ == other->field_.object_)) {
throwIllegalArgumentException("GenericGFPolys do not have same GenericGF field");
}
if (isZero()) {
return other;
}
if (other->isZero()) {
return Ref<GenericGFPoly>(this);
}
ArrayRef<int> smallerCoefficients = coefficients_;
ArrayRef<int> largerCoefficients = other->getCoefficients();
if (smallerCoefficients.size() > largerCoefficients.size()) {
ArrayRef<int> temp = smallerCoefficients;
smallerCoefficients = largerCoefficients;
largerCoefficients = temp;
}
ArrayRef<int> sumDiff(new Array<int>(largerCoefficients.size()));
int lengthDiff = largerCoefficients.size() - smallerCoefficients.size();
// Copy high-order terms only found in higher-degree polynomial's coefficientsfor (int i = 0; i < lengthDiff; i++) {
sumDiff[i] = largerCoefficients[i];
}
for (int i = lengthDiff; i < (int)largerCoefficients.size(); i++) {
sumDiff[i] = GenericGF::addOrSubtract(smallerCoefficients[i-lengthDiff],
largerCoefficients[i]);
}
return Ref<GenericGFPoly>(newGenericGFPoly(field_, sumDiff));
}
From the error I guess coefficients_[0] doesnt exist, which gets initialized here, with his constructor
GenericGFPoly::GenericGFPoly(GenericGF &field,
ArrayRef<int> coefficients)
: field_(field) {
if (coefficients->size() == 0) {
throwIllegalArgumentException("need coefficients");
}
int coefficientsLength = coefficients->size();
if (coefficientsLength > 1 && coefficients[0] == 0) {
// Leading term must be non-zero for anything except the constant polynomial "0"int firstNonZero = 1;
while (firstNonZero < coefficientsLength && coefficients[firstNonZero] == 0) {
firstNonZero++;
}
if (firstNonZero == coefficientsLength) {
coefficients_ = field.getZero()->getCoefficients();
} else {
coefficients_ = ArrayRef<int>(new Array<int>(coefficientsLength-firstNonZero));
for (int i = 0; i < (int)coefficients_->size(); i++) {
coefficients_[i] = coefficients[i + firstNonZero];
}
}
} else {
coefficients_ = coefficients;
}
}
So i guess coefficients has to be declared, or it throws an error, which it does not. So then coefficients_ is not intialized. Then what.. Anyone understands this code better than I?
The text was updated successfully, but these errors were encountered:
Yet another baby from my 5 million barcodes test..
So this goes wrong in GenericGFPoly::isZero()
Which is called from
From the error I guess
coefficients_[0]
doesnt exist, which gets initialized here, with his constructorSo i guess
coefficients
has to be declared, or it throws an error, which it does not. So then coefficients_ is not intialized. Then what.. Anyone understands this code better than I?The text was updated successfully, but these errors were encountered: