How to use the range function from mathjs
Find comprehensive JavaScript mathjs.range code examples handpicked from public code repositorys.
54 55 56 57 58 59 60 61 62 63
var clusters = []; var n = A.size()[0]; for (var i = 0; i < n; i++) { if (A.subset(math.index(i, i)) > 0.0001) { var rowMatrix = A.subset(math.index(i, math.range(0, n))); var cluster = this.rowMatrixToArray(rowMatrix).map(function (x, index) { return x > 0.001 ? index : -1; }); cluster = cluster.filter(function (x) {
2
6
2
52 53 54 55 56 57 58 59 60 61
const clusters = []; const n = A.size()[0]; for (let i = 0; i < n; i++) { if (A.subset(math.index(i, i)) > 0.0001) { const rowMatrix = A.subset(math.index(i, math.range(0, n))); let cluster = this.rowMatrixToArray(rowMatrix).map( (x, index) => {return (x > 0.001) ? index : -1;}); cluster = cluster.filter((x) => x >= 0); clusters.push(cluster);
2
6
2
106 107 108 109 110 111 112 113 114 115
let coords = math.matrix([[-W2, W2, W2, -W2], [H2, H2, -H2, -H2]]) let res = math.multiply(rot, coords); let X = res.subset(math.index(0, math.range(0, 4))); let Y = res.subset(math.index(1, math.range(0, 4))); return { w: Math.round(math.max(X) - math.min(X)), h: Math.round(math.max(Y) - math.min(Y))
0
3
1
+ 27 other calls in file
284 285 286 287 288 289 290 291 292 293
Math.pow(start.j - end.j, 2) + Math.pow(start.k - end.k, 2))) + 1; // 构造轨迹的坐标路径 let xList = mathjs.range(start.i, end.i, (end.i - start.i) / inter)._data; let yList = mathjs.range(start.j, end.j, (end.j - start.j) / inter)._data; let zList = mathjs.range(start.k, end.k, (end.k - start.k) / inter)._data; if (!xList.length) { xList = Array.apply(undefined, Array(inter)).map(item => start.i);
0
0
1
+ 14 other calls in file
mathjs.evaluate is the most popular function in mathjs (87200 examples)