How to use the subset function from mathjs
Find comprehensive JavaScript mathjs.subset code examples handpicked from public code repositorys.
145 146 147 148 149 150 151 152 153 154
tmpMat = tmpMat.transpose(); var right = mathjs.subset(tmpMat, mathjs.index(0,[0,3]))._data[0]; right = normalize(right); var up = mathjs.subset(tmpMat, mathjs.index(1,[0,3]))._data[0]; up = normalize(up); var forward = mathjs.subset(tmpMat, mathjs.index(2,[0,3]))._data[0]; forward = normalize(forward);
38
0
2
+ 5 other calls in file
145 146 147 148 149 150 151 152 153 154
// Insert the computed coordinates in the collada template file // ------------------------------------------------------------ // create the coordinate string for collada scaledXYZ = math.transpose(scaledXYZ) let coordString = ""; const dim0 = math.subset(math.size(scaledXYZ), math.index([0])); const dim1 = math.subset(math.size(scaledXYZ), math.index([1])); for (let i = 0; i < dim1; i += 1) { for (let j = 0; j < dim0; j += 1) { const str = math.subset(scaledXYZ, math.index(j, i)).toFixed(1); // XYZCamOff
3
4
0
+ 5 other calls in file
GitHub: coder0987/Taroky
3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624
} this.evaluate = (inputs, output) => { let currentRow = math.add(math.multiply(inputs, this.inputWeights), this.layersBias[0]); for (let i=0; i<20; i++) { currentRow = sigmoidMatrix(math.add(math.multiply(currentRow, math.subset(this.layersWeights, math.index(i)), math.subset(this.layersBias, math.index(i+1))))); } return sigmoid(math.add(math.multiply(currentRow, math.subset(outputWeights, math.index(output))), math.subset(outputBias, math.index(output)))); }; }
1
2
2
+ 5 other calls in file
223 224 225 226 227 228 229 230 231 232
const A = math.subset(matrix, math.index(math.range(0, m), math.range(0, n - 1))); console.log("A", A); const b = math.subset(matrix, math.index(math.range(0, m), n - 1)); console.log("B"); console.log(b);
0
0
0
+ 5 other calls in file
GitHub: Phochara/Numerpro
83 84 85 86 87 88 89 90 91 92
var b = math.matrix(B); for (let i = 0; i < a.size()[0]; i++) { data["x"].push( math.round( math.det( math.subset( a, math.index(math.range(0, a.size()[0]), i), math.subset(b, math.index(math.range(0, a.size()[0]), 0)) )
0
0
0
GitHub: mljs/optimization
10 11 12 13 14 15 16 17 18 19
* @param {Number|BigNumber} number - Maximum of the vector. * @return {Number} index - Index of the first maximum. * * */ getIndexRow : function(vector, number) { var size = math.subset(math.size(vector), math.index(0)); for(var index = 0; index < size; ++index) { var value = math.subset(vector, math.index(index)); if( math.equal(value, number) ) { return index;
0
0
0
GitHub: mljs/optimization
9 10 11 12 13 14 15 16 17 18
* @param {Vector} normalVector - Vector transform. * * */ _toNormalVector : function(vect) { var normalVector = []; var size = math.subset(math.size(vect), math.index(1)); for (var i = 0; i < size; ++i) { normalVector.push(math.subset(vect, math.index(0, i))); } return normalVector;
0
0
0
+ 94 other calls in file
mathjs.evaluate is the most popular function in mathjs (87200 examples)