You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
5.4 KiB

{"ast":null,"code":"var math = require('./math');\n\nfunction QRPolynomial(num, shift) {\n if (num.length == undefined) {\n throw new Error(num.length + \"/\" + shift);\n }\n\n var offset = 0;\n\n while (offset < num.length && num[offset] == 0) {\n offset++;\n }\n\n this.num = new Array(num.length - offset + shift);\n\n for (var i = 0; i < num.length - offset; i++) {\n this.num[i] = num[i + offset];\n }\n}\n\nQRPolynomial.prototype = {\n get: function (index) {\n return this.num[index];\n },\n getLength: function () {\n return this.num.length;\n },\n multiply: function (e) {\n var num = new Array(this.getLength() + e.getLength() - 1);\n\n for (var i = 0; i < this.getLength(); i++) {\n for (var j = 0; j < e.getLength(); j++) {\n num[i + j] ^= math.gexp(math.glog(this.get(i)) + math.glog(e.get(j)));\n }\n }\n\n return new QRPolynomial(num, 0);\n },\n mod: function (e) {\n if (this.getLength() - e.getLength() < 0) {\n return this;\n }\n\n var ratio = math.glog(this.get(0)) - math.glog(e.get(0));\n var num = new Array(this.getLength());\n\n for (var i = 0; i < this.getLength(); i++) {\n num[i] = this.get(i);\n }\n\n for (var i = 0; i < e.getLength(); i++) {\n num[i] ^= math.gexp(math.glog(e.get(i)) + ratio);\n } // recursive call\n\n\n return new QRPolynomial(num, 0).mod(e);\n }\n};\nmodule.exports = QRPolynomial;","map":{"version":3,"names":["math","require","QRPolynomial","num","shift","length","undefined","Error","offset","Array","i","prototype","get","index","getLength","multiply","e","j","gexp","glog","mod","ratio","module","exports"],"sources":["/Users/mahdi/Documents/work/programming/barnameNegar/arbaeenWebApp/node_modules/qr.js/lib/Polynomial.js"],"sourcesContent":["var math = require('./math');\n\nfunction QRPolynomial(num, shift) {\n\n\tif (num.length == undefined) {\n\t\tthrow new Error(num.length + \"/\" + shift);\n\t}\n\n\tvar offset = 0;\n\n\twhile (offset < num.length && num[offset] == 0) {\n\t\toffset++;\n\t}\n\n\tthis.num = new Array(num.length - offset + shift);\n\tfor (var i = 0; i < num.length - offset; i++) {\n\t\tthis.num[i] = num[i + offset];\n\t}\n}\n\nQRPolynomial.prototype = {\n\n\tget : function(index) {\n\t\treturn this.num[index];\n\t},\n\t\n\tgetLength : function() {\n\t\treturn this.num.length;\n\t},\n\t\n\tmultiply : function(e) {\n\t\n\t\tvar num = new Array(this.getLength() + e.getLength() - 1);\n\t\n\t\tfor (var i = 0; i < this.getLength(); i++) {\n\t\t\tfor (var j = 0; j < e.getLength(); j++) {\n\t\t\t\tnum[i + j] ^= math.gexp(math.glog(this.get(i) ) + math.glog(e.get(j) ) );\n\t\t\t}\n\t\t}\n\t\n\t\treturn new QRPolynomial(num, 0);\n\t},\n\t\n\tmod : function(e) {\n\t\n\t\tif (this.getLength() - e.getLength() < 0) {\n\t\t\treturn this;\n\t\t}\n\t\n\t\tvar ratio = math.glog(this.get(0) ) - math.glog(e.get(0) );\n\t\n\t\tvar num = new Array(this.getLength() );\n\t\t\n\t\tfor (var i = 0; i < this.getLength(); i++) {\n\t\t\tnum[i] = this.get(i);\n\t\t}\n\t\t\n\t\tfor (var i = 0; i < e.getLength(); i++) {\n\t\t\tnum[i] ^= math.gexp(math.glog(e.get(i) ) + ratio);\n\t\t}\n\t\n\t\t// recursive call\n\t\treturn new QRPolynomial(num, 0).mod(e);\n\t}\n};\n\nmodule.exports = QRPolynomial;\n"],"mappings":"AAAA,IAAIA,IAAI,GAAGC,OAAO,CAAC,QAAD,CAAlB;;AAEA,SAASC,YAAT,CAAsBC,GAAtB,EAA2BC,KAA3B,EAAkC;EAEjC,IAAID,GAAG,CAACE,MAAJ,IAAcC,SAAlB,EAA6B;IAC5B,MAAM,IAAIC,KAAJ,CAAUJ,GAAG,CAACE,MAAJ,GAAa,GAAb,GAAmBD,KAA7B,CAAN;EACA;;EAED,IAAII,MAAM,GAAG,CAAb;;EAEA,OAAOA,MAAM,GAAGL,GAAG,CAACE,MAAb,IAAuBF,GAAG,CAACK,MAAD,CAAH,IAAe,CAA7C,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