コード例 #1
0
 @Override
 public void decode(int[] data, int[] erasedLocation, int[] erasedValue) {
   if (erasedLocation.length == 0) {
     return;
   }
   assert (erasedLocation.length == erasedValue.length);
   for (int i = 0; i < erasedLocation.length; i++) {
     data[erasedLocation[i]] = 0;
   }
   for (int i = 0; i < erasedLocation.length; i++) {
     errSignature[i] = primitivePower[erasedLocation[i]];
     erasedValue[i] = GF.substitute(data, primitivePower[i]);
   }
   GF.solveVandermondeSystem(errSignature, erasedValue, erasedLocation.length);
 }
コード例 #2
0
 /**
  * Given a Vandermonde matrix V[i][j]=x[j]^i and vector y, solve for z such that Vz=y. The output
  * z will be placed in y.
  *
  * @param x the vector which describe the Vandermonde matrix
  * @param y right-hand side of the Vandermonde system equation. will be replaced the output in
  *     this vector
  */
 public void solveVandermondeSystem(int[] x, int[] y) {
   solveVandermondeSystem(x, y, x.length);
 }