How to use the size function from mathjs
Find comprehensive JavaScript mathjs.size code examples handpicked from public code repositorys.
GitHub: adamisntdead/qics
19 20 21 22 23 24 25 26 27 28
// A Square matrix is unitary if its conjugate transpose is // equal to its inverse var givenMatrix = math.matrix(matrix, 'sparse'); // Check if its Square if (math.size(givenMatrix)[0] !== math.size(givenMatrix)[1]) { return false; } var conjugateTranspose = math.transpose(math.conj(givenMatrix));
1
6
3
GitHub: muntashir/3net.js
1 2 3 4 5 6 7 8 9 10
function getDropConnectMatrix(theta, p) { var dropConnectMatrix = math.random([math.size(theta)[0], math.size(theta)[1]], 0, 1); for (var i = 0; i < math.size(theta)[0]; i += 1) { for (var j = 0; j < math.size(theta)[1]; j += 1) { if (dropConnectMatrix[i][j] <= p) { dropConnectMatrix[i][j] = 0; } else { dropConnectMatrix[i][j] = 1;
0
4
2
+ 15 other calls in file
102 103 104 105 106 107 108 109 110 111 112
* across a number of processing nodes (such that they are processed in a queue across a number of nodes) in * order to attempt to meet the deadline. */ function multiplyBlocksDeadlined(mat_a, mat_b, deadline, callback) { let results = {}; let block_size = math.size(mat_a.A).valueOf()[0]; // Get size of individual block // Perform first block multiplication, in order to get the time-taken node_clients[iteration_count % node_clients.length].multiplyMatrices( {
0
1
0
+ 2 other calls in file
50 51 52 53 54 55 56 57 58 59
let N = math.max(math.size(params)); let idxType = [find(forEach(params, ischar())), N + 1]; let L = math.size(idxType) - 1; let S; S[L].type = []; S[L].args = [[]]; S[L].A = [];
0
0
0
77 78 79 80 81 82 83 84 85 86 87
const { values: eigenvalues, vectors: eigenvectors } = eigs(matrix(squaredDistances)); const eigenvalsSorted = MATH.diag(MATH.sort(eigenvalues, 'desc')); console.log(eigenvalues); const N_DIMS = 2; for (var _i = 0; _i < MATH.size(eigenvalues).subset(index(0)); _i++) { if (_i < N_DIMS) { eigenvalsSorted._data[_i][_i] = Math.sqrt(eigenvalsSorted._data[_i][_i]); } else { eigenvalsSorted._data[_i][_i] = 0.0;
0
0
0
+ 3 other calls in file
52 53 54 55 56 57 58 59 60 61
res.status(400).send({'message' : 'Error: No records found.'}); return; } // check if array shape is valid shape = math.size(records); if (JSON.stringify(shape.slice(-2)) != JSON.stringify([2, 1024])) { return res.status(500).send({'message' : 'Error: Data is not in correct format.'}); }
0
0
0
GitHub: OrghoN/hillCipher
59 60 61 62 63 64 65 66 67 68 69 70 71
return key; } function code(key, text) { var block = math.size(key)._data[0]; //filter text for anything that can be coded text = text.toLowerCase().match(/[A-Z .?]/gi); //padding, if required
0
0
0
mathjs.evaluate is the most popular function in mathjs (87200 examples)