コード例 #1
0
ファイル: GenF2w32.java プロジェクト: pervaizkhan/SSJ2.5
 /**
  * Clones the current generator and return its copy.
  *
  * @return A deep copy of the current generator
  */
 public GenF2w32 clone() {
   GenF2w32 retour = null;
   retour = (GenF2w32) super.clone();
   retour.state = new int[R];
   retour.substream = new int[R];
   retour.stream = new int[R];
   for (int i = 0; i < R; i++) {
     retour.state[i] = state[i];
     retour.substream[i] = substream[i];
     retour.stream[i] = stream[i];
   }
   return retour;
 }
コード例 #2
0
ファイル: GenF2w32.java プロジェクト: pervaizkhan/SSJ2.5
  /**
   * This method is only meant to be used during the compilation process. It is used to create the
   * resource file the class need in order to run.
   */
  public static void main(String[] args) {
    if (args.length < 1) {
      System.err.println("Must provide the output file.");
      System.exit(1);
    }

    // computes the state transition matrices

    System.out.println("Creating the GenF2w32 state transition matrices.");

    // the state transition matrices
    BitMatrix STp0, STpw, STpz;

    BitVector[] bv = new BitVector[800];
    GenF2w32 gen;
    int[] vect = new int[R];

    for (int i = 0; i < 800; i++) {
      gen = new GenF2w32(i);

      gen.nextValue();
      for (int j = 0; j < R; j++) vect[j] = gen.state[(j + R - 1) % R];

      bv[i] = new BitVector(vect, 800);
    }

    STp0 = (new BitMatrix(bv)).transpose();

    STpw = STp0.power2e(w);
    STpz = STpw.power2e(v);

    try {
      FileOutputStream fos = new FileOutputStream(args[0]);
      ObjectOutputStream oos = new ObjectOutputStream(fos);
      oos.writeObject(STpw);
      oos.writeObject(STpz);
      oos.close();
    } catch (FileNotFoundException e) {
      System.err.println("Couldn't create " + args[0]);
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }