Пример #1
0
 JSCLVector product(int product[][], JSCLVector vector) {
   JSCLVector v = (JSCLVector) newinstance();
   for (int i = 0; i < n; i++) v.element[i] = JSCLInteger.valueOf(0);
   for (int i = 0; i < n; i++) {
     for (int j = 0; j < n; j++) {
       Generic a = element[i].multiply(vector.element[j]);
       int k = Math.abs(product[i][j]) - 1;
       v.element[k] = v.element[k].add(product[i][j] < 0 ? a.negate() : a);
     }
   }
   return v;
 }
Пример #2
0
 JSCLVector differential(int product[][], Variable variable[]) {
   JSCLVector v = (JSCLVector) newinstance();
   for (int i = 0; i < n; i++) v.element[i] = JSCLInteger.valueOf(0);
   int l = Clifford.log2e(n);
   for (int i = 1; i <= l; i++) {
     for (int j = 0; j < n; j++) {
       Generic a = element[j].derivative(variable[i - 1]);
       int k = Math.abs(product[i][j]) - 1;
       v.element[k] = v.element[k].add(product[i][j] < 0 ? a.negate() : a);
     }
   }
   return v;
 }