3 Commits b251d05c19 ... 31c93cd840

Autore SHA1 Messaggio Data
  Patrick Augusto 31c93cd840 Fixing the stopping condition for the kronecker recursion 3 anni fa
  Patrick Augusto e41b708a4d Introducing the kronecker product 3 anni fa
  Patrick Augusto b251d05c19 Introducing the kronecker product 3 anni fa
1 ha cambiato i file con 6 aggiunte e 6 eliminazioni
  1. 6 6
      Pixel.js

+ 6 - 6
Pixel.js

@@ -1,7 +1,7 @@
-const kronecker = function(target, mold) {
-    const result = [[Math.ceil(target[0] / mold[0]), Math.ceil(target[1] / mold[1])],
-        [((target[0] - 1) % mold[0]) + 1, ((target[1] - 1) % mold[1]) + 1]];
-        
+const kronecker = function(target, mask) {
+    const result = [[Math.ceil(target[0] / mask[0]), Math.ceil(target[1] / mask[1])],
+        [((target[0] - 1) % mask[0]) + 1, ((target[1] - 1) % mask[1]) + 1]];
+
     var quadrant = result[0].join("");
     switch (quadrant) {
         case "11": quadrant = "00"; break;
@@ -10,10 +10,10 @@ const kronecker = function(target, mold) {
         case "22": quadrant = "11"; break;
     }
 
-    if (mold[0] == 2)
+    if (mask[0] == 1)
         return quadrant;
 
-    return (quadrant + kronecker(result[1], [mold[0] / 2, mold[1] / 2]));
+    return (quadrant + kronecker(result[1], [mask[0] / 2, mask[1] / 2]));
 }
 
 const dotProduct = function(U, V) {