예제 #1
0
 @Override
 public int calc(int input) {
   int ret = 0, tmpa, tmpb;
   for (int i = 0; i != upper; ++i) {
     tmpa = bf.calc(i) == 0 ? 0 : 1;
     tmpb = (toBitValue(input & i) == 0 ? 1 : -1);
     ret += tmpa * tmpb;
   }
   return ret;
 }
예제 #2
0
 public WalshTransform(FunctionType bf) {
   this.bf = bf;
   n = bf.getN();
   upper = 1 << n;
 }