How to use the map function from mathjs
Find comprehensive JavaScript mathjs.map code examples handpicked from public code repositorys.
30 31 32 33 34 35 36 37 38
// create a typed-function which check the input types replacements[name] = mathjs.typed(name, { 'number': fnNumber, 'Array | Matrix': function (x) { return mathjs.map(x, fnNumber); } }); });
75
0
0
+ 3 other calls in file
56 57 58 59 60 61 62 63 64 65
//compute adjoint matrix let inv = math.inv(A) let adj = math.multiply(inv, det) //round values to get ints adj = math.map(adj, (value) => { return math.round(value) }) let invMod = math.multiply(adj, modInverse(det, modn)); // to get matrix with only positives invMod = math.map(invMod, (value) => { return ((value % modn) + modn) % modn })
0
0
0
+ 7 other calls in file
GitHub: OrghoN/hillCipher
25 26 27 28 29 30 31 32 33 34
function createEncodingKey(n, max) { var det = 0; var encodingKey while (det === 0) { encodingKey = math.random([n, n], 1, max); encodingKey = math.map(encodingKey, function(val) { return math.round(val); }); det = math.det(encodingKey); }
0
0
0
+ 5 other calls in file
52 53 54 55 56 57 58 59 60 61
this.wi = newMatrix(this.nh, this.ni); this.wo = newMatrix(this.no, this.nh); // set them to random vaules this.wi = math.map(this.wi, (val) => { return rand(-0.2, 0.2); }); this.wo = math.map(this.wo, (val) => { return rand(-2.0, 2.0); }); // last change in weights for momentum this.ci = newMatrix(this.nh, this.ni); this.co = newMatrix(this.no, this.nh);
0
0
0
+ 5 other calls in file
133 134 135 136 137 138 139 140 141
// input activations this.ai.subset(math.index([1, this.ni - 1], 0), inputs); // hidden activations this.ah = math.map(math.multiply(this.wi, this.ai), sigmoid); // output activations this.ao = math.map(math.multiply(this.wo, this.ah), sigmoid);
0
0
0
+ 5 other calls in file
GitHub: mljs/optimization
474 475 476 477 478 479 480 481 482 483
var h = math.subtract(p, p_old); //console.log("hhh "+h); var h_t = math.transpose(h); var hh = math.multiply(h_t,h); var hhh = math.map(h_t,function(value){ return value / hh; }); //J = J + ( y - y_old - J*h )*h' / (h'*h); // Broyden rank-1 update eq'n J = math.add(J, math.multiply(math.subtract(y, math.add(y_old,math.multiply(J,h))),hhh));
0
0
0
+ 5 other calls in file
mathjs.evaluate is the most popular function in mathjs (87200 examples)