ZXing.PDF417.Internal.EC.ModulusPoly.add(ZXing.PDF417.Internal.EC.ModulusPoly)

Here are the examples of the csharp api class ZXing.PDF417.Internal.EC.ModulusPoly.add(ZXing.PDF417.Internal.EC.ModulusPoly) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

5 Examples 7

1. Example

Project: dp2
Source File: ModulusPoly.cs
View license
internal ModulusPoly subtract(ModulusPoly other)
      {
         if (!field.Equals(other.field))
         {
            throw new ArgumentException("ModulusPolys do not have same ModulusGF field");
         }
         if (other.isZero)
         {
            return this;
         }
         return add(other.negative());
      }

2. Example

Project: ZXing.Net
Source File: ModulusPoly.cs
View license
internal ModulusPoly subtract(ModulusPoly other)
      {
         if (!field.Equals(other.field))
         {
            throw new ArgumentException("ModulusPolys do not have same ModulusGF field");
         }
         if (other.isZero)
         {
            return this;
         }
         return add(other.getNegative());
      }

3. Example

Project: zxing-core
Source File: ModulusPoly.cs
View license
internal ModulusPoly subtract(ModulusPoly other)
      {
         if (!field.Equals(other.field))
         {
            throw new ArgumentException("ModulusPolys do not have same ModulusGF field");
         }
         if (other.isZero)
         {
            return this;
         }
         return add(other.getNegative());
      }

4. Example

Project: dp2
Source File: ModulusPoly.cs
View license
internal 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 };
      }

5. Example

Project: zxing-core
Source File: ModulusPoly.cs
View license
internal 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 };
      }