Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ZXGenericGFPoly.h 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright 2012 ZXing authors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. @class ZXGenericGF, ZXIntArray;
  17. /**
  18. * Represents a polynomial whose coefficients are elements of a GF.
  19. * Instances of this class are immutable.
  20. *
  21. * Much credit is due to William Rucklidge since portions of this code are an indirect
  22. * port of his C++ Reed-Solomon implementation.
  23. */
  24. @interface ZXGenericGFPoly : NSObject
  25. @property (nonatomic, strong, readonly) ZXIntArray *coefficients;
  26. /**
  27. * @param field the {@link GenericGF} instance representing the field to use
  28. * to perform computations
  29. * @param coefficients coefficients as ints representing elements of GF(size), arranged
  30. * from most significant (highest-power term) coefficient to least significant
  31. */
  32. - (id)initWithField:(ZXGenericGF *)field coefficients:(ZXIntArray *)coefficients;
  33. /**
  34. * @return degree of this polynomial
  35. */
  36. - (int)degree;
  37. /**
  38. * @return true iff this polynomial is the monomial "0"
  39. */
  40. - (BOOL)zero;
  41. /**
  42. * @return coefficient of x^degree term in this polynomial
  43. */
  44. - (int)coefficient:(int)degree;
  45. /**
  46. * @return evaluation of this polynomial at a given point
  47. */
  48. - (int)evaluateAt:(int)a;
  49. - (ZXGenericGFPoly *)addOrSubtract:(ZXGenericGFPoly *)other;
  50. - (ZXGenericGFPoly *)multiply:(ZXGenericGFPoly *)other;
  51. - (ZXGenericGFPoly *)multiplyScalar:(int)scalar;
  52. - (ZXGenericGFPoly *)multiplyByMonomial:(int)degree coefficient:(int)coefficient;
  53. - (NSArray *)divide:(ZXGenericGFPoly *)other;
  54. @end