repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
repetere/modelscript
build/modelscript.umd.js
max
function max(input) { if (!Array.isArray(input)) { throw new Error('input must be an array'); } if (input.length === 0) { throw new Error('input must not be empty'); } var max = input[0]; ...
javascript
function max(input) { if (!Array.isArray(input)) { throw new Error('input must be an array'); } if (input.length === 0) { throw new Error('input must not be empty'); } var max = input[0]; ...
[ "function", "max", "(", "input", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "input", ")", ")", "{", "throw", "new", "Error", "(", "'input must be an array'", ")", ";", "}", "if", "(", "input", ".", "length", "===", "0", ")", "{", "thro...
Computes the maximum of the given values @param {Array<number>} input @return {number}
[ "Computes", "the", "maximum", "of", "the", "given", "values" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L28466-L28480
train
repetere/modelscript
build/modelscript.umd.js
min
function min(input) { if (!Array.isArray(input)) { throw new Error('input must be an array'); } if (input.length === 0) { throw new Error('input must not be empty'); } var min = input[0]; ...
javascript
function min(input) { if (!Array.isArray(input)) { throw new Error('input must be an array'); } if (input.length === 0) { throw new Error('input must not be empty'); } var min = input[0]; ...
[ "function", "min", "(", "input", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "input", ")", ")", "{", "throw", "new", "Error", "(", "'input must be an array'", ")", ";", "}", "if", "(", "input", ".", "length", "===", "0", ")", "{", "thro...
Computes the minimum of the given values @param {Array<number>} input @return {number}
[ "Computes", "the", "minimum", "of", "the", "given", "values" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L28487-L28501
train
repetere/modelscript
build/modelscript.umd.js
embed
function embed(mat, rows, cols) { var r = mat.rows; var c = mat.columns; if ((r === rows) && (c === cols)) { return mat; } else { var resultat =...
javascript
function embed(mat, rows, cols) { var r = mat.rows; var c = mat.columns; if ((r === rows) && (c === cols)) { return mat; } else { var resultat =...
[ "function", "embed", "(", "mat", ",", "rows", ",", "cols", ")", "{", "var", "r", "=", "mat", ".", "rows", ";", "var", "c", "=", "mat", ".", "columns", ";", "if", "(", "(", "r", "===", "rows", ")", "&&", "(", "c", "===", "cols", ")", ")", "{...
Put a matrix into the top left of a matrix of zeros. `rows` and `cols` are the dimensions of the output matrix.
[ "Put", "a", "matrix", "into", "the", "top", "left", "of", "a", "matrix", "of", "zeros", ".", "rows", "and", "cols", "are", "the", "dimensions", "of", "the", "output", "matrix", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L29971-L29981
train
repetere/modelscript
build/modelscript.umd.js
mean
function mean(input) { if (!Array.isArray(input)) { throw new Error('input must be an array'); } if (input.length === 0) { throw new Error('input must not be empty'); } var sum = 0; ...
javascript
function mean(input) { if (!Array.isArray(input)) { throw new Error('input must be an array'); } if (input.length === 0) { throw new Error('input must not be empty'); } var sum = 0; ...
[ "function", "mean", "(", "input", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "input", ")", ")", "{", "throw", "new", "Error", "(", "'input must be an array'", ")", ";", "}", "if", "(", "input", ".", "length", "===", "0", ")", "{", "thr...
Computes the mean of the given values @param {Array<number>} input @return {number}
[ "Computes", "the", "mean", "of", "the", "given", "values" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L30898-L30912
train
repetere/modelscript
build/modelscript.umd.js
examplesBaggingWithReplacement
function examplesBaggingWithReplacement(trainingSet, trainingValue, seed) { var engine = random.engines.mt19937(); var distribution = random.integer(0, trainingSet.rows - 1); if (seed === undefined) { engine = engine.autoSeed(); } else if (Number.i...
javascript
function examplesBaggingWithReplacement(trainingSet, trainingValue, seed) { var engine = random.engines.mt19937(); var distribution = random.integer(0, trainingSet.rows - 1); if (seed === undefined) { engine = engine.autoSeed(); } else if (Number.i...
[ "function", "examplesBaggingWithReplacement", "(", "trainingSet", ",", "trainingValue", ",", "seed", ")", "{", "var", "engine", "=", "random", ".", "engines", ".", "mt19937", "(", ")", ";", "var", "distribution", "=", "random", ".", "integer", "(", "0", ",",...
Select n with replacement elements on the training set and values, where n is the size of the training set. @ignore @param {Matrix} trainingSet @param {Array} trainingValue @param {number} seed - seed for the random selection, must be a 32-bit integer. @return {object} with new X and y.
[ "Select", "n", "with", "replacement", "elements", "on", "the", "training", "set", "and", "values", "where", "n", "is", "the", "size", "of", "the", "training", "set", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L36609-L36633
train
repetere/modelscript
build/modelscript.umd.js
featureBagging
function featureBagging(trainingSet, n, replacement, seed) { if (trainingSet.columns < n) { throw new RangeError('N should be less or equal to the number of columns of X'); } var distribution = random.integer(0, trainingSet.columns - 1); var engin...
javascript
function featureBagging(trainingSet, n, replacement, seed) { if (trainingSet.columns < n) { throw new RangeError('N should be less or equal to the number of columns of X'); } var distribution = random.integer(0, trainingSet.columns - 1); var engin...
[ "function", "featureBagging", "(", "trainingSet", ",", "n", ",", "replacement", ",", "seed", ")", "{", "if", "(", "trainingSet", ".", "columns", "<", "n", ")", "{", "throw", "new", "RangeError", "(", "'N should be less or equal to the number of columns of X'", ")"...
selects n features from the training set with or without replacement, returns the new training set and the indexes used. @ignore @param {Matrix} trainingSet @param {number} n - features. @param {boolean} replacement @param {number} seed - seed for the random selection, must be a 32-bit integer. @return {object}
[ "selects", "n", "features", "from", "the", "training", "set", "with", "or", "without", "replacement", "returns", "the", "new", "training", "set", "and", "the", "indexes", "used", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L36644-L36685
train
repetere/modelscript
build/modelscript.umd.js
mode
function mode(arr) { return arr.sort((a, b) => arr.filter((v) => v === a).length - arr.filter((v) => v === b).length ).pop(); }
javascript
function mode(arr) { return arr.sort((a, b) => arr.filter((v) => v === a).length - arr.filter((v) => v === b).length ).pop(); }
[ "function", "mode", "(", "arr", ")", "{", "return", "arr", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "arr", ".", "filter", "(", "(", "v", ")", "=>", "v", "===", "a", ")", ".", "length", "-", "arr", ".", "filter", "(", "(", "v", ")", ...
Return the most repeated element on the array. @param {Array} arr @return {number} mode
[ "Return", "the", "most", "repeated", "element", "on", "the", "array", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L36909-L36914
train
repetere/modelscript
build/modelscript.umd.js
median
function median(input) { if (!Array.isArray(input)) { throw new Error('input must be an array'); } if (input.length === 0) { throw new Error('input must not be empty'); } return medianQuickselect_mi...
javascript
function median(input) { if (!Array.isArray(input)) { throw new Error('input must be an array'); } if (input.length === 0) { throw new Error('input must not be empty'); } return medianQuickselect_mi...
[ "function", "median", "(", "input", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "input", ")", ")", "{", "throw", "new", "Error", "(", "'input must be an array'", ")", ";", "}", "if", "(", "input", ".", "length", "===", "0", ")", "{", "t...
Computes the median of the given values @param {Array<number>} input @return {number}
[ "Computes", "the", "median", "of", "the", "given", "values" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L36925-L36935
train
repetere/modelscript
build/modelscript.umd.js
nearestVector
function nearestVector(listVectors, vector, options) { options = options || defaultOptions$7; const distanceFunction = options.distanceFunction || defaultOptions$7.distanceFunction; const similarityFunction = options.similarityFunction || defaultOptions$7.similarityFuncti...
javascript
function nearestVector(listVectors, vector, options) { options = options || defaultOptions$7; const distanceFunction = options.distanceFunction || defaultOptions$7.distanceFunction; const similarityFunction = options.similarityFunction || defaultOptions$7.similarityFuncti...
[ "function", "nearestVector", "(", "listVectors", ",", "vector", ",", "options", ")", "{", "options", "=", "options", "||", "defaultOptions$7", ";", "const", "distanceFunction", "=", "options", ".", "distanceFunction", "||", "defaultOptions$7", ".", "distanceFunction...
Find the nearest vector in a list to a sample vector @param {Array<Array<number>>} listVectors - List of vectors with same dimensions @param {Array<number>} vector - Reference vector to "classify" @param {object} [options] - Options object @param {function} [options.distanceFunction = squaredDistance] - Function that r...
[ "Find", "the", "nearest", "vector", "in", "a", "list", "to", "a", "sample", "vector" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L43753-L43791
train
repetere/modelscript
build/modelscript.umd.js
calculateDistanceMatrix
function calculateDistanceMatrix(data, distance) { var distanceMatrix = new Array(data.length); for (var i = 0; i < data.length; ++i) { for (var j = i; j < data.length; ++j) { if (!distanceMatrix[i]) { distanceMatrix...
javascript
function calculateDistanceMatrix(data, distance) { var distanceMatrix = new Array(data.length); for (var i = 0; i < data.length; ++i) { for (var j = i; j < data.length; ++j) { if (!distanceMatrix[i]) { distanceMatrix...
[ "function", "calculateDistanceMatrix", "(", "data", ",", "distance", ")", "{", "var", "distanceMatrix", "=", "new", "Array", "(", "data", ".", "length", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "data", ".", "length", ";", "++", "i",...
Calculates the distance matrix for a given array of points @ignore @param {Array<Array<Number>>} data - the [x,y,z,...] points to cluster @param {Function} distance - Distance function to use between the points @return {Array<Array<Number>>} - matrix with the distance values
[ "Calculates", "the", "distance", "matrix", "for", "a", "given", "array", "of", "points" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L43802-L43818
train
repetere/modelscript
build/modelscript.umd.js
updateClusterID
function updateClusterID(data, centers, clusterID, distance) { for (var i = 0; i < data.length; i++) { clusterID[i] = src$5(centers, data[i], {distanceFunction: distance}); } return clusterID; }
javascript
function updateClusterID(data, centers, clusterID, distance) { for (var i = 0; i < data.length; i++) { clusterID[i] = src$5(centers, data[i], {distanceFunction: distance}); } return clusterID; }
[ "function", "updateClusterID", "(", "data", ",", "centers", ",", "clusterID", ",", "distance", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "data", ".", "length", ";", "i", "++", ")", "{", "clusterID", "[", "i", "]", "=", "src$5", "...
Updates the cluster identifier based in the new data @ignore @param {Array<Array<Number>>} data - the [x,y,z,...] points to cluster @param {Array<Array<Number>>} centers - the K centers in format [x,y,z,...] @param {Array <Number>} clusterID - the cluster identifier for each data dot @param {Function} distance - Distan...
[ "Updates", "the", "cluster", "identifier", "based", "in", "the", "new", "data" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L43829-L43834
train
repetere/modelscript
build/modelscript.umd.js
updateCenters
function updateCenters(data, clusterID, K) { const nDim = data[0].length; // creates empty centers with 0 size var centers = new Array(K); var centersLen = new Array(K); for (var i = 0; i < K; i++) { centers[i] = new Ar...
javascript
function updateCenters(data, clusterID, K) { const nDim = data[0].length; // creates empty centers with 0 size var centers = new Array(K); var centersLen = new Array(K); for (var i = 0; i < K; i++) { centers[i] = new Ar...
[ "function", "updateCenters", "(", "data", ",", "clusterID", ",", "K", ")", "{", "const", "nDim", "=", "data", "[", "0", "]", ".", "length", ";", "// creates empty centers with 0 size", "var", "centers", "=", "new", "Array", "(", "K", ")", ";", "var", "ce...
Update the center values based in the new configurations of the clusters @ignore @param {Array <Array <Number>>} data - the [x,y,z,...] points to cluster @param {Array <Number>} clusterID - the cluster identifier for each data dot @param {Number} K - Number of clusters @returns {Array} he K centers in format [x,y,z,......
[ "Update", "the", "center", "values", "based", "in", "the", "new", "configurations", "of", "the", "clusters" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L43844-L43873
train
repetere/modelscript
build/modelscript.umd.js
converged
function converged(centers, oldCenters, distanceFunction, tolerance) { for (var i = 0; i < centers.length; i++) { if (distanceFunction(centers[i], oldCenters[i]) > tolerance) { return false; } } return true; ...
javascript
function converged(centers, oldCenters, distanceFunction, tolerance) { for (var i = 0; i < centers.length; i++) { if (distanceFunction(centers[i], oldCenters[i]) > tolerance) { return false; } } return true; ...
[ "function", "converged", "(", "centers", ",", "oldCenters", ",", "distanceFunction", ",", "tolerance", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "centers", ".", "length", ";", "i", "++", ")", "{", "if", "(", "distanceFunction", "(", ...
The centers have moved more than the tolerance value? @ignore @param {Array<Array<Number>>} centers - the K centers in format [x,y,z,...] @param {Array<Array<Number>>} oldCenters - the K old centers in format [x,y,z,...] @param {Function} distanceFunction - Distance function to use between the points @param {Number} to...
[ "The", "centers", "have", "moved", "more", "than", "the", "tolerance", "value?" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L43884-L43891
train
repetere/modelscript
build/modelscript.umd.js
clone
function clone(arr) { var newArr = []; for (var i=0; i<arr.length; i++) { newArr.push(arr[i]); } return newArr; }
javascript
function clone(arr) { var newArr = []; for (var i=0; i<arr.length; i++) { newArr.push(arr[i]); } return newArr; }
[ "function", "clone", "(", "arr", ")", "{", "var", "newArr", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "{", "newArr", ".", "push", "(", "arr", "[", "i", "]", ")", ";", "...
Gets a shallow copy of the given array.
[ "Gets", "a", "shallow", "copy", "of", "the", "given", "array", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L43930-L43936
train
repetere/modelscript
build/modelscript.umd.js
pick
function pick() { if (this._remainingOptions.length === 0) { this._remainingOptions = clone(this._originalOptions); } var index = Math.floor(Math.random() * this._remainingOptions.length); return this._remainingOptions.splice(index...
javascript
function pick() { if (this._remainingOptions.length === 0) { this._remainingOptions = clone(this._originalOptions); } var index = Math.floor(Math.random() * this._remainingOptions.length); return this._remainingOptions.splice(index...
[ "function", "pick", "(", ")", "{", "if", "(", "this", ".", "_remainingOptions", ".", "length", "===", "0", ")", "{", "this", ".", "_remainingOptions", "=", "clone", "(", "this", ".", "_originalOptions", ")", ";", "}", "var", "index", "=", "Math", ".", ...
Gets a random option until all options have been returns. Then cycles again.
[ "Gets", "a", "random", "option", "until", "all", "options", "have", "been", "returns", ".", "Then", "cycles", "again", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L43939-L43946
train
repetere/modelscript
build/modelscript.umd.js
random$1
function random$1(data, K) { const rand = new Picker$1(data); var ans = new Array(K); for (var i = 0; i < K; ++i) { ans[i] = rand.pick(); } return ans; }
javascript
function random$1(data, K) { const rand = new Picker$1(data); var ans = new Array(K); for (var i = 0; i < K; ++i) { ans[i] = rand.pick(); } return ans; }
[ "function", "random$1", "(", "data", ",", "K", ")", "{", "const", "rand", "=", "new", "Picker$1", "(", "data", ")", ";", "var", "ans", "=", "new", "Array", "(", "K", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "K", ";", "++", ...
Choose K different random points from the original data @ignore @param {Array<Array<Number>>} data - Points in the format to cluster [x,y,z,...] @param {Number} K - Number of clusters @return {Array<Array<Number>>} - Initial random points
[ "Choose", "K", "different", "random", "points", "from", "the", "original", "data" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L43970-L43978
train
repetere/modelscript
build/modelscript.umd.js
KMeansResult
function KMeansResult(clusters, centroids, converged, iterations, distance) { this.clusters = clusters; this.centroids = centroids; this.converged = converged; this.iterations = iterations; this[distanceSymbol] = distance; }
javascript
function KMeansResult(clusters, centroids, converged, iterations, distance) { this.clusters = clusters; this.centroids = centroids; this.converged = converged; this.iterations = iterations; this[distanceSymbol] = distance; }
[ "function", "KMeansResult", "(", "clusters", ",", "centroids", ",", "converged", ",", "iterations", ",", "distance", ")", "{", "this", ".", "clusters", "=", "clusters", ";", "this", ".", "centroids", "=", "centroids", ";", "this", ".", "converged", "=", "c...
Result of the kmeans algorithm @param {Array<Number>} clusters - the cluster identifier for each data dot @param {Array<Array<Object>>} centroids - the K centers in format [x,y,z,...], the error and size of the cluster @param {Boolean} converged - Converge criteria satisfied @param {Number} iterations - Current number ...
[ "Result", "of", "the", "kmeans", "algorithm" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L44054-L44060
train
repetere/modelscript
build/modelscript.umd.js
errorCalculation
function errorCalculation( data, parameters, parameterizedFunction ) { var error = 0; const func = parameterizedFunction(parameters); for (var i = 0; i < data.x.length; i++) { error += Math.abs(data.y[i] - f...
javascript
function errorCalculation( data, parameters, parameterizedFunction ) { var error = 0; const func = parameterizedFunction(parameters); for (var i = 0; i < data.x.length; i++) { error += Math.abs(data.y[i] - f...
[ "function", "errorCalculation", "(", "data", ",", "parameters", ",", "parameterizedFunction", ")", "{", "var", "error", "=", "0", ";", "const", "func", "=", "parameterizedFunction", "(", "parameters", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", ...
Calculate current error @ignore @param {{x:Array<number>, y:Array<number>}} data - Array of points to fit in the format [x1, x2, ... ], [y1, y2, ... ] @param {Array<number>} parameters - Array of current parameter values @param {function} parameterizedFunction - The parameters and returns a function with the independen...
[ "Calculate", "current", "error" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L52110-L52123
train
repetere/modelscript
build/modelscript.umd.js
gradientFunction
function gradientFunction( data, evaluatedData, params, gradientDifference, paramFunction ) { const n = params.length; const m = data.x.length; var ans = new Array(n); for (var par...
javascript
function gradientFunction( data, evaluatedData, params, gradientDifference, paramFunction ) { const n = params.length; const m = data.x.length; var ans = new Array(n); for (var par...
[ "function", "gradientFunction", "(", "data", ",", "evaluatedData", ",", "params", ",", "gradientDifference", ",", "paramFunction", ")", "{", "const", "n", "=", "params", ".", "length", ";", "const", "m", "=", "data", ".", "x", ".", "length", ";", "var", ...
Difference of the matrix function over the parameters @ignore @param {{x:Array<number>, y:Array<number>}} data - Array of points to fit in the format [x1, x2, ... ], [y1, y2, ... ] @param {Array<number>} evaluatedData - Array of previous evaluated function values @param {Array<number>} params - Array of previous parame...
[ "Difference", "of", "the", "matrix", "function", "over", "the", "parameters" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L52135-L52158
train
repetere/modelscript
build/modelscript.umd.js
step$1
function step$1( data, params, damping, gradientDifference, parameterizedFunction ) { var identity = require$$0$2.Matrix.eye(params.length).mul( damping * gradientDifference * gradientDifference ...
javascript
function step$1( data, params, damping, gradientDifference, parameterizedFunction ) { var identity = require$$0$2.Matrix.eye(params.length).mul( damping * gradientDifference * gradientDifference ...
[ "function", "step$1", "(", "data", ",", "params", ",", "damping", ",", "gradientDifference", ",", "parameterizedFunction", ")", "{", "var", "identity", "=", "require$$0$2", ".", "Matrix", ".", "eye", "(", "params", ".", "length", ")", ".", "mul", "(", "dam...
Iteration for Levenberg-Marquardt @ignore @param {{x:Array<number>, y:Array<number>}} data - Array of points to fit in the format [x1, x2, ... ], [y1, y2, ... ] @param {Array<number>} params - Array of previous parameter values @param {number} damping - Levenberg-Marquardt parameter @param {number} gradientDifference -...
[ "Iteration", "for", "Levenberg", "-", "Marquardt" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L52189-L52227
train
repetere/modelscript
build/modelscript.umd.js
levenbergMarquardt
function levenbergMarquardt( data, parameterizedFunction, options = {} ) { let { maxIterations = 100, gradientDifference = 10e-2, damping = 0, errorTolerance = 10e-3, initi...
javascript
function levenbergMarquardt( data, parameterizedFunction, options = {} ) { let { maxIterations = 100, gradientDifference = 10e-2, damping = 0, errorTolerance = 10e-3, initi...
[ "function", "levenbergMarquardt", "(", "data", ",", "parameterizedFunction", ",", "options", "=", "{", "}", ")", "{", "let", "{", "maxIterations", "=", "100", ",", "gradientDifference", "=", "10e-2", ",", "damping", "=", "0", ",", "errorTolerance", "=", "10e...
Curve fitting algorithm @param {{x:Array<number>, y:Array<number>}} data - Array of points to fit in the format [x1, x2, ... ], [y1, y2, ... ] @param {function} parameterizedFunction - The parameters and returns a function with the independent variable as a parameter @param {object} [options] - Options object @param {n...
[ "Curve", "fitting", "algorithm" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L52241-L52306
train
repetere/modelscript
build/modelscript.umd.js
createTree
function createTree (X, Y, from, to, minWindow, threshold) { minWindow = minWindow || 0.16; threshold = threshold || 0.01; if ((to - from) < minWindow) return undefined; var sum = 0; for (var i = 0; X[i] < to; i++) { ...
javascript
function createTree (X, Y, from, to, minWindow, threshold) { minWindow = minWindow || 0.16; threshold = threshold || 0.01; if ((to - from) < minWindow) return undefined; var sum = 0; for (var i = 0; X[i] < to; i++) { ...
[ "function", "createTree", "(", "X", ",", "Y", ",", "from", ",", "to", ",", "minWindow", ",", "threshold", ")", "{", "minWindow", "=", "minWindow", "||", "0.16", ";", "threshold", "=", "threshold", "||", "0.01", ";", "if", "(", "(", "to", "-", "from",...
Function that creates the tree @param {Array <number>} X - chemical shifts of the signal @param {Array <number>} Y - intensity of the signal @param {number} from - the low limit of x @param {number} to - the top limit of x @param {number} minWindow - smallest range to accept in x @param {number} threshold - smallest ra...
[ "Function", "that", "creates", "the", "tree" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L53571-L53607
train
repetere/modelscript
build/modelscript.umd.js
S
function S(a, b, alpha, beta, gamma) { if (a === undefined || b === undefined) { return 0; } else { var C = (alpha*Math.min(a.sum, b.sum)/Math.max(a.sum, b.sum)+ (1-alpha)*Math.exp(-gamma*Math.abs(a.center - b.center))); ...
javascript
function S(a, b, alpha, beta, gamma) { if (a === undefined || b === undefined) { return 0; } else { var C = (alpha*Math.min(a.sum, b.sum)/Math.max(a.sum, b.sum)+ (1-alpha)*Math.exp(-gamma*Math.abs(a.center - b.center))); ...
[ "function", "S", "(", "a", ",", "b", ",", "alpha", ",", "beta", ",", "gamma", ")", "{", "if", "(", "a", "===", "undefined", "||", "b", "===", "undefined", ")", "{", "return", "0", ";", "}", "else", "{", "var", "C", "=", "(", "alpha", "*", "Ma...
Similarity between two nodes @param {{sum: number, center: number, left: {json}, right: {json}}} a - tree A node @param {{sum: number, center: number, left: {json}, right: {json}}} b - tree B node @param {number} alpha - weights the relative importance of intensity vs. shift match @param {number} beta - weights the rel...
[ "Similarity", "between", "two", "nodes" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L53618-L53626
train
repetere/modelscript
build/modelscript.umd.js
tree
function tree(A, B, from, to, options) { options = options || {}; for (var o in defaultOptions$n) if (!options.hasOwnProperty(o)) { options[o] = defaultOptions$n[o]; } var Atree, Btree; if (A....
javascript
function tree(A, B, from, to, options) { options = options || {}; for (var o in defaultOptions$n) if (!options.hasOwnProperty(o)) { options[o] = defaultOptions$n[o]; } var Atree, Btree; if (A....
[ "function", "tree", "(", "A", ",", "B", ",", "from", ",", "to", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "for", "(", "var", "o", "in", "defaultOptions$n", ")", "if", "(", "!", "options", ".", "hasOwnProperty", "(", ...
Builds a tree based in the spectra and compares this trees @param {{x: Array<number>, y: Array<number>}} A - first spectra to be compared @param {{x: Array<number>, y: Array<number>}} B - second spectra to be compared @param {number} from - the low limit of x @param {number} to - the top limit of x @param {{minWindow: ...
[ "Builds", "a", "tree", "based", "in", "the", "spectra", "and", "compares", "this", "trees" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L53652-L53668
train
repetere/modelscript
build/modelscript.umd.js
matrixCase
function matrixCase(data, options) { var row = data.length; var col = data[0].length; if (options.size[0] === undefined) options.size = [options.size, options.size, options.size, options.size]; throw new Error('matrix not supported yet,...
javascript
function matrixCase(data, options) { var row = data.length; var col = data[0].length; if (options.size[0] === undefined) options.size = [options.size, options.size, options.size, options.size]; throw new Error('matrix not supported yet,...
[ "function", "matrixCase", "(", "data", ",", "options", ")", "{", "var", "row", "=", "data", ".", "length", ";", "var", "col", "=", "data", "[", "0", "]", ".", "length", ";", "if", "(", "options", ".", "size", "[", "0", "]", "===", "undefined", ")...
Case when the entry is a matrix @param data @param options @returns {Array}
[ "Case", "when", "the", "entry", "is", "a", "matrix" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L54520-L54526
train
repetere/modelscript
build/modelscript.umd.js
padArray
function padArray (data, options) { options = extend({}, defaultOptions$o, options); if (Array.isArray(data)) { if (Array.isArray(data[0])) return matrixCase(data, options); else return arrayCase(dat...
javascript
function padArray (data, options) { options = extend({}, defaultOptions$o, options); if (Array.isArray(data)) { if (Array.isArray(data[0])) return matrixCase(data, options); else return arrayCase(dat...
[ "function", "padArray", "(", "data", ",", "options", ")", "{", "options", "=", "extend", "(", "{", "}", ",", "defaultOptions$o", ",", "options", ")", ";", "if", "(", "Array", ".", "isArray", "(", "data", ")", ")", "{", "if", "(", "Array", ".", "isA...
Pads and array @param {Array <number>} data @param {object} options
[ "Pads", "and", "array" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L54533-L54544
train
repetere/modelscript
build/modelscript.umd.js
and
function and(arr1, arr2) { var ans = new Array(arr1.length); for (var i = 0; i < arr1.length; i++) ans[i] = arr1[i] & arr2[i]; return ans; }
javascript
function and(arr1, arr2) { var ans = new Array(arr1.length); for (var i = 0; i < arr1.length; i++) ans[i] = arr1[i] & arr2[i]; return ans; }
[ "function", "and", "(", "arr1", ",", "arr2", ")", "{", "var", "ans", "=", "new", "Array", "(", "arr1", ".", "length", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arr1", ".", "length", ";", "i", "++", ")", "ans", "[", "i", "]...
Logical AND operation @param {Array} arr1 @param {Array} arr2 @return {Array}
[ "Logical", "AND", "operation" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L54831-L54836
train
repetere/modelscript
build/modelscript.umd.js
or
function or(arr1, arr2) { var ans = new Array(arr1.length); for (var i = 0; i < arr1.length; i++) ans[i] = arr1[i] | arr2[i]; return ans; }
javascript
function or(arr1, arr2) { var ans = new Array(arr1.length); for (var i = 0; i < arr1.length; i++) ans[i] = arr1[i] | arr2[i]; return ans; }
[ "function", "or", "(", "arr1", ",", "arr2", ")", "{", "var", "ans", "=", "new", "Array", "(", "arr1", ".", "length", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arr1", ".", "length", ";", "i", "++", ")", "ans", "[", "i", "]"...
Logical OR operation @param {Array} arr1 @param {Array} arr2 @return {Array}
[ "Logical", "OR", "operation" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L54844-L54849
train
repetere/modelscript
build/modelscript.umd.js
xor
function xor(arr1, arr2) { var ans = new Array(arr1.length); for (var i = 0; i < arr1.length; i++) ans[i] = arr1[i] ^ arr2[i]; return ans; }
javascript
function xor(arr1, arr2) { var ans = new Array(arr1.length); for (var i = 0; i < arr1.length; i++) ans[i] = arr1[i] ^ arr2[i]; return ans; }
[ "function", "xor", "(", "arr1", ",", "arr2", ")", "{", "var", "ans", "=", "new", "Array", "(", "arr1", ".", "length", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arr1", ".", "length", ";", "i", "++", ")", "ans", "[", "i", "]...
Logical XOR operation @param {Array} arr1 @param {Array} arr2 @return {Array}
[ "Logical", "XOR", "operation" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L54857-L54862
train
repetere/modelscript
build/modelscript.umd.js
not
function not(arr) { var ans = new Array(arr.length); for (var i = 0; i < ans.length; i++) ans[i] = ~arr[i]; return ans; }
javascript
function not(arr) { var ans = new Array(arr.length); for (var i = 0; i < ans.length; i++) ans[i] = ~arr[i]; return ans; }
[ "function", "not", "(", "arr", ")", "{", "var", "ans", "=", "new", "Array", "(", "arr", ".", "length", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "ans", ".", "length", ";", "i", "++", ")", "ans", "[", "i", "]", "=", "~", "...
Logical NOT operation @param {Array} arr @return {Array}
[ "Logical", "NOT", "operation" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L54869-L54874
train
repetere/modelscript
build/modelscript.umd.js
getBit
function getBit(arr, n) { var index = n >> 5; // Same as Math.floor(n/32) var mask = 1 << (31 - n % 32); return Boolean(arr[index] & mask); }
javascript
function getBit(arr, n) { var index = n >> 5; // Same as Math.floor(n/32) var mask = 1 << (31 - n % 32); return Boolean(arr[index] & mask); }
[ "function", "getBit", "(", "arr", ",", "n", ")", "{", "var", "index", "=", "n", ">>", "5", ";", "// Same as Math.floor(n/32)", "var", "mask", "=", "1", "<<", "(", "31", "-", "n", "%", "32", ")", ";", "return", "Boolean", "(", "arr", "[", "index", ...
Gets the n value of array arr @param {Array} arr @param {number} n @return {boolean}
[ "Gets", "the", "n", "value", "of", "array", "arr" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L54882-L54886
train
repetere/modelscript
build/modelscript.umd.js
setBit
function setBit(arr, n, val) { var index = n >> 5; // Same as Math.floor(n/32) var mask = 1 << (31 - n % 32); if (val) arr[index] = mask | arr[index]; else arr[index] = ~mask & arr[index]; return arr;...
javascript
function setBit(arr, n, val) { var index = n >> 5; // Same as Math.floor(n/32) var mask = 1 << (31 - n % 32); if (val) arr[index] = mask | arr[index]; else arr[index] = ~mask & arr[index]; return arr;...
[ "function", "setBit", "(", "arr", ",", "n", ",", "val", ")", "{", "var", "index", "=", "n", ">>", "5", ";", "// Same as Math.floor(n/32)", "var", "mask", "=", "1", "<<", "(", "31", "-", "n", "%", "32", ")", ";", "if", "(", "val", ")", "arr", "[...
Sets the n value of array arr to the value val @param {Array} arr @param {number} n @param {boolean} val @return {Array}
[ "Sets", "the", "n", "value", "of", "array", "arr", "to", "the", "value", "val" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L54895-L54903
train
repetere/modelscript
build/modelscript.umd.js
toBinaryString
function toBinaryString(arr) { var str = ''; for (var i = 0; i < arr.length; i++) { var obj = (arr[i] >>> 0).toString(2); str += '00000000000000000000000000000000'.substr(obj.length) + obj; } return str; ...
javascript
function toBinaryString(arr) { var str = ''; for (var i = 0; i < arr.length; i++) { var obj = (arr[i] >>> 0).toString(2); str += '00000000000000000000000000000000'.substr(obj.length) + obj; } return str; ...
[ "function", "toBinaryString", "(", "arr", ")", "{", "var", "str", "=", "''", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "{", "var", "obj", "=", "(", "arr", "[", "i", "]", ">>>", "0", ")"...
Translates an array of numbers to a string of bits @param {Array} arr @returns {string}
[ "Translates", "an", "array", "of", "numbers", "to", "a", "string", "of", "bits" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L54910-L54917
train
repetere/modelscript
build/modelscript.umd.js
parseBinaryString
function parseBinaryString(str) { var len = str.length / 32; var ans = new Array(len); for (var i = 0; i < len; i++) { ans[i] = parseInt(str.substr(i*32, 32), 2) | 0; } return ans; }
javascript
function parseBinaryString(str) { var len = str.length / 32; var ans = new Array(len); for (var i = 0; i < len; i++) { ans[i] = parseInt(str.substr(i*32, 32), 2) | 0; } return ans; }
[ "function", "parseBinaryString", "(", "str", ")", "{", "var", "len", "=", "str", ".", "length", "/", "32", ";", "var", "ans", "=", "new", "Array", "(", "len", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", "...
Creates an array of numbers based on a string of bits @param {string} str @returns {Array}
[ "Creates", "an", "array", "of", "numbers", "based", "on", "a", "string", "of", "bits" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L54924-L54931
train
repetere/modelscript
build/modelscript.umd.js
toHexString
function toHexString(arr) { var str = ''; for (var i = 0; i < arr.length; i++) { var obj = (arr[i] >>> 0).toString(16); str += '00000000'.substr(obj.length) + obj; } return str; }
javascript
function toHexString(arr) { var str = ''; for (var i = 0; i < arr.length; i++) { var obj = (arr[i] >>> 0).toString(16); str += '00000000'.substr(obj.length) + obj; } return str; }
[ "function", "toHexString", "(", "arr", ")", "{", "var", "str", "=", "''", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "{", "var", "obj", "=", "(", "arr", "[", "i", "]", ">>>", "0", ")", ...
Translates an array of numbers to a hex string @param {Array} arr @returns {string}
[ "Translates", "an", "array", "of", "numbers", "to", "a", "hex", "string" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L54938-L54945
train
repetere/modelscript
build/modelscript.umd.js
toDebug
function toDebug(arr) { var binary = toBinaryString(arr); var str = ''; for (var i = 0; i < arr.length; i++) { str += '0000'.substr((i * 32).toString(16).length) + (i * 32).toString(16) + ':'; for (var j = 0; j < 32; j += 4) { ...
javascript
function toDebug(arr) { var binary = toBinaryString(arr); var str = ''; for (var i = 0; i < arr.length; i++) { str += '0000'.substr((i * 32).toString(16).length) + (i * 32).toString(16) + ':'; for (var j = 0; j < 32; j += 4) { ...
[ "function", "toDebug", "(", "arr", ")", "{", "var", "binary", "=", "toBinaryString", "(", "arr", ")", ";", "var", "str", "=", "''", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "{", "str", "...
Creates a human readable string of the array @param {Array} arr @returns {string}
[ "Creates", "a", "human", "readable", "string", "of", "the", "array" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L54966-L54977
train
repetere/modelscript
build/modelscript.umd.js
transpose
function transpose(matrix) { var resultMatrix = new Array(matrix[0].length); for (var i = 0; i < resultMatrix.length; ++i) { resultMatrix[i] = new Array(matrix.length); } for (i = 0; i < matrix.length; ++i) { for (v...
javascript
function transpose(matrix) { var resultMatrix = new Array(matrix[0].length); for (var i = 0; i < resultMatrix.length; ++i) { resultMatrix[i] = new Array(matrix.length); } for (i = 0; i < matrix.length; ++i) { for (v...
[ "function", "transpose", "(", "matrix", ")", "{", "var", "resultMatrix", "=", "new", "Array", "(", "matrix", "[", "0", "]", ".", "length", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "resultMatrix", ".", "length", ";", "++", "i", "...
Tranpose a matrix, this method is for coordMatrixToPoints and pointsToCoordMatrix, that because only transposing the matrix you can change your representation. @param matrix @returns {Array}
[ "Tranpose", "a", "matrix", "this", "method", "is", "for", "coordMatrixToPoints", "and", "pointsToCoordMatrix", "that", "because", "only", "transposing", "the", "matrix", "you", "can", "change", "your", "representation", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L55092-L55105
train
repetere/modelscript
build/modelscript.umd.js
applyDotProduct
function applyDotProduct(firstVector, secondVector) { var largestVector, smallestVector; if (firstVector.length <= secondVector.length) { smallestVector = firstVector; largestVector = secondVector; } else { small...
javascript
function applyDotProduct(firstVector, secondVector) { var largestVector, smallestVector; if (firstVector.length <= secondVector.length) { smallestVector = firstVector; largestVector = secondVector; } else { small...
[ "function", "applyDotProduct", "(", "firstVector", ",", "secondVector", ")", "{", "var", "largestVector", ",", "smallestVector", ";", "if", "(", "firstVector", ".", "length", "<=", "secondVector", ".", "length", ")", "{", "smallestVector", "=", "firstVector", ";...
Apply the dot product between the smaller vector and a subsets of the largest one. @param firstVector @param secondVector @returns {Array} each dot product of size of the difference between the larger and the smallest one.
[ "Apply", "the", "dot", "product", "between", "the", "smaller", "vector", "and", "a", "subsets", "of", "the", "largest", "one", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L55137-L55159
train
repetere/modelscript
build/modelscript.umd.js
getEquallySpacedSmooth
function getEquallySpacedSmooth(x, y, from, to, numberOfPoints) { var xLength = x.length; var step = (to - from) / (numberOfPoints - 1); var halfStep = step / 2; var output = new Array(numberOfPoints); var initialOriginalStep = x[1] - x[...
javascript
function getEquallySpacedSmooth(x, y, from, to, numberOfPoints) { var xLength = x.length; var step = (to - from) / (numberOfPoints - 1); var halfStep = step / 2; var output = new Array(numberOfPoints); var initialOriginalStep = x[1] - x[...
[ "function", "getEquallySpacedSmooth", "(", "x", ",", "y", ",", "from", ",", "to", ",", "numberOfPoints", ")", "{", "var", "xLength", "=", "x", ".", "length", ";", "var", "step", "=", "(", "to", "-", "from", ")", "/", "(", "numberOfPoints", "-", "1", ...
function that retrieves the getEquallySpacedData with the variant "smooth" @param x @param y @param from - Initial point @param to - Final point @param numberOfPoints @returns {Array} - Array of y's equally spaced with the variant "smooth"
[ "function", "that", "retrieves", "the", "getEquallySpacedData", "with", "the", "variant", "smooth" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L55294-L55369
train
repetere/modelscript
build/modelscript.umd.js
getEquallySpacedSlot
function getEquallySpacedSlot(x, y, from, to, numberOfPoints) { var xLength = x.length; var step = (to - from) / (numberOfPoints - 1); var halfStep = step / 2; var lastStep = x[x.length - 1] - x[x.length - 2]; var start = from - halfStep;...
javascript
function getEquallySpacedSlot(x, y, from, to, numberOfPoints) { var xLength = x.length; var step = (to - from) / (numberOfPoints - 1); var halfStep = step / 2; var lastStep = x[x.length - 1] - x[x.length - 2]; var start = from - halfStep;...
[ "function", "getEquallySpacedSlot", "(", "x", ",", "y", ",", "from", ",", "to", ",", "numberOfPoints", ")", "{", "var", "xLength", "=", "x", ".", "length", ";", "var", "step", "=", "(", "to", "-", "from", ")", "/", "(", "numberOfPoints", "-", "1", ...
function that retrieves the getEquallySpacedData with the variant "slot" @param x @param y @param from - Initial point @param to - Final point @param numberOfPoints @returns {Array} - Array of y's equally spaced with the variant "slot"
[ "function", "that", "retrieves", "the", "getEquallySpacedData", "with", "the", "variant", "slot" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L55381-L55456
train
repetere/modelscript
build/modelscript.umd.js
integral
function integral(x0, x1, slope, intercept) { return (0.5 * slope * x1 * x1 + intercept * x1) - (0.5 * slope * x0 * x0 + intercept * x0); }
javascript
function integral(x0, x1, slope, intercept) { return (0.5 * slope * x1 * x1 + intercept * x1) - (0.5 * slope * x0 * x0 + intercept * x0); }
[ "function", "integral", "(", "x0", ",", "x1", ",", "slope", ",", "intercept", ")", "{", "return", "(", "0.5", "*", "slope", "*", "x1", "*", "x1", "+", "intercept", "*", "x1", ")", "-", "(", "0.5", "*", "slope", "*", "x0", "*", "x0", "+", "inter...
Function that calculates the integral of the line between two x-coordinates, given the slope and intercept of the line. @param x0 @param x1 @param slope @param intercept @returns {number} integral value.
[ "Function", "that", "calculates", "the", "integral", "of", "the", "line", "between", "two", "x", "-", "coordinates", "given", "the", "slope", "and", "intercept", "of", "the", "line", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L55466-L55468
train
repetere/modelscript
build/modelscript.umd.js
baseRange$1
function baseRange$1(start, end, step, fromRight) { var index = -1, length = nativeMax$1(nativeCeil$1((end - start) / (step || 1)), 0), result = Array(length); while (length--) { result[fromRight ? length : ++index] = start; ...
javascript
function baseRange$1(start, end, step, fromRight) { var index = -1, length = nativeMax$1(nativeCeil$1((end - start) / (step || 1)), 0), result = Array(length); while (length--) { result[fromRight ? length : ++index] = start; ...
[ "function", "baseRange$1", "(", "start", ",", "end", ",", "step", ",", "fromRight", ")", "{", "var", "index", "=", "-", "1", ",", "length", "=", "nativeMax$1", "(", "nativeCeil$1", "(", "(", "end", "-", "start", ")", "/", "(", "step", "||", "1", ")...
The base implementation of `_.range` and `_.rangeRight` which doesn't coerce arguments. @private @param {number} start The start of the range. @param {number} end The end of the range. @param {number} step The value to increment or decrement by. @param {boolean} [fromRight] Specify iterating from right to left. @retur...
[ "The", "base", "implementation", "of", "_", ".", "range", "and", "_", ".", "rangeRight", "which", "doesn", "t", "coerce", "arguments", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L56120-L56130
train
repetere/modelscript
build/modelscript.umd.js
coefficientOfCorrelation
function coefficientOfCorrelation(actuals = [], estimates = []) { if (actuals.length !== estimates.length) throw new RangeError('arrays must have the same length'); const sumX = sum(actuals); const sumY = sum(estimates); const sumProdXY = actuals.reduce((resul...
javascript
function coefficientOfCorrelation(actuals = [], estimates = []) { if (actuals.length !== estimates.length) throw new RangeError('arrays must have the same length'); const sumX = sum(actuals); const sumY = sum(estimates); const sumProdXY = actuals.reduce((resul...
[ "function", "coefficientOfCorrelation", "(", "actuals", "=", "[", "]", ",", "estimates", "=", "[", "]", ")", "{", "if", "(", "actuals", ".", "length", "!==", "estimates", ".", "length", ")", "throw", "new", "RangeError", "(", "'arrays must have the same length...
The coefficent of Correlation is given by R decides how well the given data fits a line or a curve. @example const actuals = [ 39, 42, 67, 76, ]; const estimates = [ 44, 40, 60, 84, ]; const R = ms.util.coefficientOfCorrelation(actuals, estimates); R.toFixed(4) // => 0.9408 @memberOf util @see {@link https://calculator...
[ "The", "coefficent", "of", "Correlation", "is", "given", "by", "R", "decides", "how", "well", "the", "given", "data", "fits", "a", "line", "or", "a", "curve", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L56661-L56685
train
repetere/modelscript
build/modelscript.umd.js
pivotVector
function pivotVector(vectors=[]) { return vectors.reduce((result, val, index/*, arr*/) => { val.forEach((vecVal, i) => { (index === 0) ? (result.push([vecVal, ])) : (result[ i ].push(vecVal)); }); ...
javascript
function pivotVector(vectors=[]) { return vectors.reduce((result, val, index/*, arr*/) => { val.forEach((vecVal, i) => { (index === 0) ? (result.push([vecVal, ])) : (result[ i ].push(vecVal)); }); ...
[ "function", "pivotVector", "(", "vectors", "=", "[", "]", ")", "{", "return", "vectors", ".", "reduce", "(", "(", "result", ",", "val", ",", "index", "/*, arr*/", ")", "=>", "{", "val", ".", "forEach", "(", "(", "vecVal", ",", "i", ")", "=>", "{", ...
returns an array of vectors as an array of arrays @example const vectors = [ [1,2,3], [1,2,3], [3,3,4], [3,3,3] ]; const arrays = pivotVector(vectors); // => [ [1,2,3,3], [2,2,3,3], [3,3,4,3] ]; @memberOf util @param {Array[]} vectors @returns {Array[]}
[ "returns", "an", "array", "of", "vectors", "as", "an", "array", "of", "arrays" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L56707-L56716
train
repetere/modelscript
build/modelscript.umd.js
pivotArrays
function pivotArrays(arrays = []) { return (arrays.length) ? arrays[ 0 ].map((vectorItem, index) => { const returnArray = []; arrays.forEach((v, i) => { returnArray.push(arrays[ i ][ index ]); }); ...
javascript
function pivotArrays(arrays = []) { return (arrays.length) ? arrays[ 0 ].map((vectorItem, index) => { const returnArray = []; arrays.forEach((v, i) => { returnArray.push(arrays[ i ][ index ]); }); ...
[ "function", "pivotArrays", "(", "arrays", "=", "[", "]", ")", "{", "return", "(", "arrays", ".", "length", ")", "?", "arrays", "[", "0", "]", ".", "map", "(", "(", "vectorItem", ",", "index", ")", "=>", "{", "const", "returnArray", "=", "[", "]", ...
returns a matrix of values by combining arrays into a matrix @memberOf util @example const arrays = [ [ 1, 1, 3, 3 ], [ 2, 2, 3, 3 ], [ 3, 3, 4, 3 ], ]; pivotArrays(arrays); //=> [ [1, 2, 3,], [1, 2, 3,], [3, 3, 4,], [3, 3, 3,], ]; @param {Array} [vectors=[]] - array of arguments for columnArray to merge columns into a...
[ "returns", "a", "matrix", "of", "values", "by", "combining", "arrays", "into", "a", "matrix" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L56737-L56747
train
repetere/modelscript
build/modelscript.umd.js
MinMaxScalerTransforms
function MinMaxScalerTransforms(vector = [], nan_value = -1, return_nan=false) { const average = avg$2(vector); const standard_dev = sd(vector); const maximum = max$1(vector); const minimum = min$1(vector); const scale = (z) => { ...
javascript
function MinMaxScalerTransforms(vector = [], nan_value = -1, return_nan=false) { const average = avg$2(vector); const standard_dev = sd(vector); const maximum = max$1(vector); const minimum = min$1(vector); const scale = (z) => { ...
[ "function", "MinMaxScalerTransforms", "(", "vector", "=", "[", "]", ",", "nan_value", "=", "-", "1", ",", "return_nan", "=", "false", ")", "{", "const", "average", "=", "avg$2", "(", "vector", ")", ";", "const", "standard_dev", "=", "sd", "(", "vector", ...
This function returns two functions that can mix max scale new inputs and reverse scale new outputs @param {Number[]} values - array of numbers @returns {Object} - {scale[ Function ], descale[ Function ]}
[ "This", "function", "returns", "two", "functions", "that", "can", "mix", "max", "scale", "new", "inputs", "and", "reverse", "scale", "new", "outputs" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L56814-L56847
train
repetere/modelscript
build/modelscript.umd.js
approximateZPercentile
function approximateZPercentile(z, alpha=true) { // If z is greater than 6.5 standard deviations from the mean // the number of significant digits will be outside of a reasonable // range. if (z < -6.5) return 0.0; if (z > 6....
javascript
function approximateZPercentile(z, alpha=true) { // If z is greater than 6.5 standard deviations from the mean // the number of significant digits will be outside of a reasonable // range. if (z < -6.5) return 0.0; if (z > 6....
[ "function", "approximateZPercentile", "(", "z", ",", "alpha", "=", "true", ")", "{", "// If z is greater than 6.5 standard deviations from the mean\r", "// the number of significant digits will be outside of a reasonable \r", "// range.\r", "if", "(", "z", "<", "-", "6.5", ")",...
Converts z-score into the probability @memberOf util @see {@link https://stackoverflow.com/questions/36575743/how-do-i-convert-probability-into-z-score} @param {number} z - Number of standard deviations from the mean. @returns {number} p - p-value
[ "Converts", "z", "-", "score", "into", "the", "probability" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L56856-L56883
train
repetere/modelscript
build/modelscript.umd.js
trackingSignal
function trackingSignal(actuals, estimates) { const runningSumOfForecastErrors = sum(forecastErrors(actuals, estimates)); const MAD = meanAbsoluteDeviation(actuals, estimates); return runningSumOfForecastErrors / MAD; }
javascript
function trackingSignal(actuals, estimates) { const runningSumOfForecastErrors = sum(forecastErrors(actuals, estimates)); const MAD = meanAbsoluteDeviation(actuals, estimates); return runningSumOfForecastErrors / MAD; }
[ "function", "trackingSignal", "(", "actuals", ",", "estimates", ")", "{", "const", "runningSumOfForecastErrors", "=", "sum", "(", "forecastErrors", "(", "actuals", ",", "estimates", ")", ")", ";", "const", "MAD", "=", "meanAbsoluteDeviation", "(", "actuals", ","...
Tracking Signal - Used to pinpoint forecasting models that need adjustment @memberOf util @see {@link https://scm.ncsu.edu/scm-articles/article/measuring-forecast-accuracy-approaches-to-forecasting-a-tutorial} @example const actuals = [ 45, 38, 43, 39 ]; const estimates = [ 41, 43, 41, 42 ]; const trackingSignal = ms.u...
[ "Tracking", "Signal", "-", "Used", "to", "pinpoint", "forecasting", "models", "that", "need", "adjustment" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L56957-L56961
train
repetere/modelscript
build/modelscript.umd.js
FPNode
function FPNode(item, parent) { if (item === void 0) { item = null; } if (parent === void 0) { parent = null; } this.item = item; this.parent = parent; /** * Support of the FPNode. (a.k.a. "count" as...
javascript
function FPNode(item, parent) { if (item === void 0) { item = null; } if (parent === void 0) { parent = null; } this.item = item; this.parent = parent; /** * Support of the FPNode. (a.k.a. "count" as...
[ "function", "FPNode", "(", "item", ",", "parent", ")", "{", "if", "(", "item", "===", "void", "0", ")", "{", "item", "=", "null", ";", "}", "if", "(", "parent", "===", "void", "0", ")", "{", "parent", "=", "null", ";", "}", "this", ".", "item",...
FPNode composes an FPTree and represents a given item a item-prefix subtree. It keeps track of its parent if it has any, and lists his children FPNodes. @param {T} item The item it represents. @param {FPNode<T>} parent His parent, if it has any.
[ "FPNode", "composes", "an", "FPTree", "and", "represents", "a", "given", "item", "a", "item", "-", "prefix", "subtree", ".", "It", "keeps", "track", "of", "its", "parent", "if", "it", "has", "any", "and", "lists", "his", "children", "FPNodes", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L57078-L57097
train
repetere/modelscript
build/modelscript.umd.js
FPTree
function FPTree(supports, _support) { this.supports = supports; this._support = _support; /** * Whether or not the tree has been built */ this._isInit = false; /** ...
javascript
function FPTree(supports, _support) { this.supports = supports; this._support = _support; /** * Whether or not the tree has been built */ this._isInit = false; /** ...
[ "function", "FPTree", "(", "supports", ",", "_support", ")", "{", "this", ".", "supports", "=", "supports", ";", "this", ".", "_support", "=", "_support", ";", "/**\n * Whether or not the tree has been built\n */", "this", ".", "_...
FPTree is a frequent-pattern tree implementation. It consists in a compact data structure that stores quantitative information about frequent patterns in a set of transactions. @param {ItemsCount} supports The support count of each unique items to be inserted the FPTree. @param {number} support The mini...
[ "FPTree", "is", "a", "frequent", "-", "pattern", "tree", "implementation", ".", "It", "consists", "in", "a", "compact", "data", "structure", "that", "stores", "quantitative", "information", "about", "frequent", "patterns", "in", "a", "set", "of", "transactions",...
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L57159-L57178
train
repetere/modelscript
build/modelscript.umd.js
function(len) { if(len === undefined) len=16; var entropy = fs.randomBytes(len); var result = 0; for(var i=0; i<len; i++) { result = result + Number(entropy[i])/Math.pow(256,(i+1)); } ...
javascript
function(len) { if(len === undefined) len=16; var entropy = fs.randomBytes(len); var result = 0; for(var i=0; i<len; i++) { result = result + Number(entropy[i])/Math.pow(256,(i+1)); } ...
[ "function", "(", "len", ")", "{", "if", "(", "len", "===", "undefined", ")", "len", "=", "16", ";", "var", "entropy", "=", "fs", ".", "randomBytes", "(", "len", ")", ";", "var", "result", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", ...
This is the core function for generating entropy @param len number of bytes of entropy to create @returns {number} A pseduo random number between 0 and 1
[ "This", "is", "the", "core", "function", "for", "generating", "entropy" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L57731-L57741
train
repetere/modelscript
build/modelscript.umd.js
function(n, loc, scale) { n = this._v(n, "n"); loc = this._v(loc, "r", 0); scale = this._v(scale, "nn", 1); var toReturn = []; for(var i=0; i<n; i++) { var core = this.sample([-1,1])[0] * ln(thi...
javascript
function(n, loc, scale) { n = this._v(n, "n"); loc = this._v(loc, "r", 0); scale = this._v(scale, "nn", 1); var toReturn = []; for(var i=0; i<n; i++) { var core = this.sample([-1,1])[0] * ln(thi...
[ "function", "(", "n", ",", "loc", ",", "scale", ")", "{", "n", "=", "this", ".", "_v", "(", "n", ",", "\"n\"", ")", ";", "loc", "=", "this", ".", "_v", "(", "loc", ",", "\"r\"", ",", "0", ")", ";", "scale", "=", "this", ".", "_v", "(", "s...
Syntax as in R library VGAM @param n The number of random variates to create. Must be a positive integer @param loc Mean @param scale Scale parameter @returns {Array} Random variates array
[ "Syntax", "as", "in", "R", "library", "VGAM" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L58026-L58042
train
repetere/modelscript
build/modelscript.umd.js
function(x, min, max) { x = this._v(x, "r"); min = this._v(min, "r", 0); max = this._v(max, "r", 1); if(min > max) throw new Error("Minimum value cannot be greater than maximum value"); if(x < min || x > max) return 0; ...
javascript
function(x, min, max) { x = this._v(x, "r"); min = this._v(min, "r", 0); max = this._v(max, "r", 1); if(min > max) throw new Error("Minimum value cannot be greater than maximum value"); if(x < min || x > max) return 0; ...
[ "function", "(", "x", ",", "min", ",", "max", ")", "{", "x", "=", "this", ".", "_v", "(", "x", ",", "\"r\"", ")", ";", "min", "=", "this", ".", "_v", "(", "min", ",", "\"r\"", ",", "0", ")", ";", "max", "=", "this", ".", "_v", "(", "max",...
Density function for uniform distribution @param x Location to get density for @param min {number} Minimum value @param max {number} Maximum value @returns {number} Density of the function given the location and parameters
[ "Density", "function", "for", "uniform", "distribution" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L58244-L58255
train
repetere/modelscript
build/modelscript.umd.js
function(len, alphabet) { len = this._v(len, "n"); alphabet = this._v(alphabet, "str", "abcdefghijklmnopqrstuvwxyz"); var lib = alphabet.split(""); var arr = this.sample(lib, len, true); return arr.join(""); ...
javascript
function(len, alphabet) { len = this._v(len, "n"); alphabet = this._v(alphabet, "str", "abcdefghijklmnopqrstuvwxyz"); var lib = alphabet.split(""); var arr = this.sample(lib, len, true); return arr.join(""); ...
[ "function", "(", "len", ",", "alphabet", ")", "{", "len", "=", "this", ".", "_v", "(", "len", ",", "\"n\"", ")", ";", "alphabet", "=", "this", ".", "_v", "(", "alphabet", ",", "\"str\"", ",", "\"abcdefghijklmnopqrstuvwxyz\"", ")", ";", "var", "lib", ...
Generate a random word of specified length using library of characters. Uses English alphabet if no library is specified @param len Number of letters in this word @param {string} alphabet to use @returns {string} String of randomly selected characters from the alphabet
[ "Generate", "a", "random", "word", "of", "specified", "length", "using", "library", "of", "characters", ".", "Uses", "English", "alphabet", "if", "no", "library", "is", "specified" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L58287-L58295
train
repetere/modelscript
build/modelscript.umd.js
flip
function flip(obj) { var newObj = Object.create(null), key; for (key in obj) { newObj[obj[key]] = key; } return newObj; }
javascript
function flip(obj) { var newObj = Object.create(null), key; for (key in obj) { newObj[obj[key]] = key; } return newObj; }
[ "function", "flip", "(", "obj", ")", "{", "var", "newObj", "=", "Object", ".", "create", "(", "null", ")", ",", "key", ";", "for", "(", "key", "in", "obj", ")", "{", "newObj", "[", "obj", "[", "key", "]", "]", "=", "key", ";", "}", "return", ...
Exchanges all keys with their associated values in an object. @param {Object.<string, string>} obj An object of strings. @return {Object.<string, string>} An object of strings.
[ "Exchanges", "all", "keys", "with", "their", "associated", "values", "in", "an", "object", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L68192-L68201
train
repetere/modelscript
build/modelscript.umd.js
merge
function merge(var_args) { var args = [].slice.call(arguments), newObj = Object.create(null), id = 0, key; while (args[id]) { for (key in args[id]) { newObj[key] = args[id][key]; } ...
javascript
function merge(var_args) { var args = [].slice.call(arguments), newObj = Object.create(null), id = 0, key; while (args[id]) { for (key in args[id]) { newObj[key] = args[id][key]; } ...
[ "function", "merge", "(", "var_args", ")", "{", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ")", ",", "newObj", "=", "Object", ".", "create", "(", "null", ")", ",", "id", "=", "0", ",", "key", ";", "while", "(", "...
Merge several objects. Properties from earlier objects are overwritten by laters's in case of conflict. @param {...Object.<string, string>} var_args One or more objects of strings. @return {!Object.<string, string>} An object of strings.
[ "Merge", "several", "objects", ".", "Properties", "from", "earlier", "objects", "are", "overwritten", "by", "laters", "s", "in", "case", "of", "conflict", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L68211-L68225
train
repetere/modelscript
build/modelscript.umd.js
stemmingProcess
function stemmingProcess(){ if(find(current_word)) return // Confix Stripping // Try to remove prefixes first before suffixes if the specification is met if(precedenceAdjustmentSpecification(original_word)){ ...
javascript
function stemmingProcess(){ if(find(current_word)) return // Confix Stripping // Try to remove prefixes first before suffixes if the specification is met if(precedenceAdjustmentSpecification(original_word)){ ...
[ "function", "stemmingProcess", "(", ")", "{", "if", "(", "find", "(", "current_word", ")", ")", "return", "// Confix Stripping", "// Try to remove prefixes first before suffixes if the specification is met", "if", "(", "precedenceAdjustmentSpecification", "(", "original_word", ...
Stemming from step 2-5
[ "Stemming", "from", "step", "2", "-", "5" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L70896-L70933
train
repetere/modelscript
build/modelscript.umd.js
createPredicateIndexFinder
function createPredicateIndexFinder(dir) { return function(array, predicate, context) { predicate = cb(predicate, context); var length = getLength(array); var index = dir > 0 ? 0 : length - 1; for (; index >= 0 && index < length; in...
javascript
function createPredicateIndexFinder(dir) { return function(array, predicate, context) { predicate = cb(predicate, context); var length = getLength(array); var index = dir > 0 ? 0 : length - 1; for (; index >= 0 && index < length; in...
[ "function", "createPredicateIndexFinder", "(", "dir", ")", "{", "return", "function", "(", "array", ",", "predicate", ",", "context", ")", "{", "predicate", "=", "cb", "(", "predicate", ",", "context", ")", ";", "var", "length", "=", "getLength", "(", "arr...
Generator function to create the findIndex and findLastIndex functions
[ "Generator", "function", "to", "create", "the", "findIndex", "and", "findLastIndex", "functions" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L71768-L71778
train
repetere/modelscript
build/modelscript.umd.js
function(sourceFunc, boundFunc, context, callingContext, args) { if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); var self = baseCreate(sourceFunc.prototype); var result = sourceFunc.apply(self, args); if (_.isObject(resu...
javascript
function(sourceFunc, boundFunc, context, callingContext, args) { if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); var self = baseCreate(sourceFunc.prototype); var result = sourceFunc.apply(self, args); if (_.isObject(resu...
[ "function", "(", "sourceFunc", ",", "boundFunc", ",", "context", ",", "callingContext", ",", "args", ")", "{", "if", "(", "!", "(", "callingContext", "instanceof", "boundFunc", ")", ")", "return", "sourceFunc", ".", "apply", "(", "context", ",", "args", ")...
Determines whether to execute a function as a constructor or a normal function with the provided arguments
[ "Determines", "whether", "to", "execute", "a", "function", "as", "a", "constructor", "or", "a", "normal", "function", "with", "the", "provided", "arguments" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L71854-L71860
train
repetere/modelscript
build/modelscript.umd.js
svdJs
function svdJs() { var A = this; var V = Matrix$b.I(A.rows()); var S = A.transpose(); var U = Matrix$b.I(A.cols()); var err = Number.MAX_VALUE; var i = 0; var maxLoop = 100; while(err > 2.273...
javascript
function svdJs() { var A = this; var V = Matrix$b.I(A.rows()); var S = A.transpose(); var U = Matrix$b.I(A.cols()); var err = Number.MAX_VALUE; var i = 0; var maxLoop = 100; while(err > 2.273...
[ "function", "svdJs", "(", ")", "{", "var", "A", "=", "this", ";", "var", "V", "=", "Matrix$b", ".", "I", "(", "A", ".", "rows", "(", ")", ")", ";", "var", "S", "=", "A", ".", "transpose", "(", ")", ";", "var", "U", "=", "Matrix$b", ".", "I"...
singular value decomposition in pure javascript
[ "singular", "value", "decomposition", "in", "pure", "javascript" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74021-L74064
train
repetere/modelscript
build/modelscript.umd.js
svdPack
function svdPack() { var result = lapack$1.sgesvd('A', 'A', this.elements); return { U: $M(result.U), S: $M(result.S).column(1).toDiagonalMatrix(), V: $M(result.VT).transpose() }; }
javascript
function svdPack() { var result = lapack$1.sgesvd('A', 'A', this.elements); return { U: $M(result.U), S: $M(result.S).column(1).toDiagonalMatrix(), V: $M(result.VT).transpose() }; }
[ "function", "svdPack", "(", ")", "{", "var", "result", "=", "lapack$1", ".", "sgesvd", "(", "'A'", ",", "'A'", ",", "this", ".", "elements", ")", ";", "return", "{", "U", ":", "$M", "(", "result", ".", "U", ")", ",", "S", ":", "$M", "(", "resul...
singular value decomposition using LAPACK
[ "singular", "value", "decomposition", "using", "LAPACK" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74067-L74075
train
repetere/modelscript
build/modelscript.umd.js
qrJs
function qrJs() { var m = this.rows(); var n = this.cols(); var Q = Matrix$b.I(m); var A = this; for(var k = 1; k < Math.min(m, n); k++) { var ak = A.slice(k, 0, k, k).col(1); var oneZero = [1]; ...
javascript
function qrJs() { var m = this.rows(); var n = this.cols(); var Q = Matrix$b.I(m); var A = this; for(var k = 1; k < Math.min(m, n); k++) { var ak = A.slice(k, 0, k, k).col(1); var oneZero = [1]; ...
[ "function", "qrJs", "(", ")", "{", "var", "m", "=", "this", ".", "rows", "(", ")", ";", "var", "n", "=", "this", ".", "cols", "(", ")", ";", "var", "Q", "=", "Matrix$b", ".", "I", "(", "m", ")", ";", "var", "A", "=", "this", ";", "for", "...
QR decomposition in pure javascript
[ "QR", "decomposition", "in", "pure", "javascript" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74078-L74102
train
repetere/modelscript
build/modelscript.umd.js
qrPack
function qrPack() { var qr = lapack$1.qr(this.elements); return { Q: $M(qr.Q), R: $M(qr.R) }; }
javascript
function qrPack() { var qr = lapack$1.qr(this.elements); return { Q: $M(qr.Q), R: $M(qr.R) }; }
[ "function", "qrPack", "(", ")", "{", "var", "qr", "=", "lapack$1", ".", "qr", "(", "this", ".", "elements", ")", ";", "return", "{", "Q", ":", "$M", "(", "qr", ".", "Q", ")", ",", "R", ":", "$M", "(", "qr", ".", "R", ")", "}", ";", "}" ]
QR decomposition using LAPACK
[ "QR", "decomposition", "using", "LAPACK" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74105-L74112
train
repetere/modelscript
build/modelscript.umd.js
function(k, U) { var U = U || pca$1(this).U; var Ureduce= U.slice(1, U.rows(), 1, k); return {Z: this.x(Ureduce), U: U}; }
javascript
function(k, U) { var U = U || pca$1(this).U; var Ureduce= U.slice(1, U.rows(), 1, k); return {Z: this.x(Ureduce), U: U}; }
[ "function", "(", "k", ",", "U", ")", "{", "var", "U", "=", "U", "||", "pca$1", "(", "this", ")", ".", "U", ";", "var", "Ureduce", "=", "U", ".", "slice", "(", "1", ",", "U", ".", "rows", "(", ")", ",", "1", ",", "k", ")", ";", "return", ...
project a matrix onto a lower dim
[ "project", "a", "matrix", "onto", "a", "lower", "dim" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74127-L74131
train
repetere/modelscript
build/modelscript.umd.js
function(U) { var k = this.cols(); var Ureduce = U.slice(1, U.rows(), 1, k); return this.x(Ureduce.transpose()); }
javascript
function(U) { var k = this.cols(); var Ureduce = U.slice(1, U.rows(), 1, k); return this.x(Ureduce.transpose()); }
[ "function", "(", "U", ")", "{", "var", "k", "=", "this", ".", "cols", "(", ")", ";", "var", "Ureduce", "=", "U", ".", "slice", "(", "1", ",", "U", ".", "rows", "(", ")", ",", "1", ",", "k", ")", ";", "return", "this", ".", "x", "(", "Ured...
recover a matrix to a higher dimension
[ "recover", "a", "matrix", "to", "a", "higher", "dimension" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74134-L74138
train
repetere/modelscript
build/modelscript.umd.js
function(k) { if(!k) k = 0; return this.map(function(x, i, j) { return j - i >= k ? x : 0; }); }
javascript
function(k) { if(!k) k = 0; return this.map(function(x, i, j) { return j - i >= k ? x : 0; }); }
[ "function", "(", "k", ")", "{", "if", "(", "!", "k", ")", "k", "=", "0", ";", "return", "this", ".", "map", "(", "function", "(", "x", ",", "i", ",", "j", ")", "{", "return", "j", "-", "i", ">=", "k", "?", "x", ":", "0", ";", "}", ")", ...
grab the upper triangular part of the matrix
[ "grab", "the", "upper", "triangular", "part", "of", "the", "matrix" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74141-L74148
train
repetere/modelscript
build/modelscript.umd.js
function() { var v = []; for(var i = 1; i <= this.cols(); i++) { for(var j = 1; j <= this.rows(); j++) { v.push(this.e(j, i)); } } return $V(v); }
javascript
function() { var v = []; for(var i = 1; i <= this.cols(); i++) { for(var j = 1; j <= this.rows(); j++) { v.push(this.e(j, i)); } } return $V(v); }
[ "function", "(", ")", "{", "var", "v", "=", "[", "]", ";", "for", "(", "var", "i", "=", "1", ";", "i", "<=", "this", ".", "cols", "(", ")", ";", "i", "++", ")", "{", "for", "(", "var", "j", "=", "1", ";", "j", "<=", "this", ".", "rows",...
unroll a matrix into a vector
[ "unroll", "a", "matrix", "into", "a", "vector" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74151-L74161
train
repetere/modelscript
build/modelscript.umd.js
function(startRow, endRow, startCol, endCol) { var x = []; if(endRow == 0) endRow = this.rows(); if(endCol == 0) endCol = this.cols(); for(i = startRow; i <= endRow; i++) { var row = []; ...
javascript
function(startRow, endRow, startCol, endCol) { var x = []; if(endRow == 0) endRow = this.rows(); if(endCol == 0) endCol = this.cols(); for(i = startRow; i <= endRow; i++) { var row = []; ...
[ "function", "(", "startRow", ",", "endRow", ",", "startCol", ",", "endCol", ")", "{", "var", "x", "=", "[", "]", ";", "if", "(", "endRow", "==", "0", ")", "endRow", "=", "this", ".", "rows", "(", ")", ";", "if", "(", "endCol", "==", "0", ")", ...
return a sub-block of the matrix
[ "return", "a", "sub", "-", "block", "of", "the", "matrix" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74164-L74184
train
repetere/modelscript
build/modelscript.umd.js
function(matrix) { if(typeof(matrix) == 'number') { return this.map(function(x, i, j) { return x + matrix}); } else { var M = matrix.elements || matrix; if (typeof(M[0][0]) == 'undefined') { M = Matrix$b.create(M).elements; } ...
javascript
function(matrix) { if(typeof(matrix) == 'number') { return this.map(function(x, i, j) { return x + matrix}); } else { var M = matrix.elements || matrix; if (typeof(M[0][0]) == 'undefined') { M = Matrix$b.create(M).elements; } ...
[ "function", "(", "matrix", ")", "{", "if", "(", "typeof", "(", "matrix", ")", "==", "'number'", ")", "{", "return", "this", ".", "map", "(", "function", "(", "x", ",", "i", ",", "j", ")", "{", "return", "x", "+", "matrix", "}", ")", ";", "}", ...
Returns the result of adding the argument to the matrix
[ "Returns", "the", "result", "of", "adding", "the", "argument", "to", "the", "matrix" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74268-L74277
train
repetere/modelscript
build/modelscript.umd.js
function() { var dim = this.dimensions(); var r = []; for (var i = 1; i <= dim.cols; i++) { r.push(this.col(i).sum() / dim.rows); } return $V(r); }
javascript
function() { var dim = this.dimensions(); var r = []; for (var i = 1; i <= dim.cols; i++) { r.push(this.col(i).sum() / dim.rows); } return $V(r); }
[ "function", "(", ")", "{", "var", "dim", "=", "this", ".", "dimensions", "(", ")", ";", "var", "r", "=", "[", "]", ";", "for", "(", "var", "i", "=", "1", ";", "i", "<=", "dim", ".", "cols", ";", "i", "++", ")", "{", "r", ".", "push", "(",...
Returns a Vector of each colum averaged.
[ "Returns", "a", "Vector", "of", "each", "colum", "averaged", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74374-L74381
train
repetere/modelscript
build/modelscript.umd.js
function() { var matrix_rows = []; var n = this.elements.length; for (var i = 0; i < n; i++) { matrix_rows.push(this.elements[i]); } return matrix_rows; }
javascript
function() { var matrix_rows = []; var n = this.elements.length; for (var i = 0; i < n; i++) { matrix_rows.push(this.elements[i]); } return matrix_rows; }
[ "function", "(", ")", "{", "var", "matrix_rows", "=", "[", "]", ";", "var", "n", "=", "this", ".", "elements", ".", "length", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "matrix_rows", ".", "push", "("...
Returns a array representation of the matrix
[ "Returns", "a", "array", "representation", "of", "the", "matrix" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74625-L74632
train
repetere/modelscript
build/modelscript.umd.js
function() { var maxes = []; for(var i = 1; i <= this.rows(); i++) { var max = null; var maxIndex = -1; for(var j = 1; j <= this.cols(); j++) { if(max === null || this.e(i, j) > max) { max = this.e(i, j); ...
javascript
function() { var maxes = []; for(var i = 1; i <= this.rows(); i++) { var max = null; var maxIndex = -1; for(var j = 1; j <= this.cols(); j++) { if(max === null || this.e(i, j) > max) { max = this.e(i, j); ...
[ "function", "(", ")", "{", "var", "maxes", "=", "[", "]", ";", "for", "(", "var", "i", "=", "1", ";", "i", "<=", "this", ".", "rows", "(", ")", ";", "i", "++", ")", "{", "var", "max", "=", "null", ";", "var", "maxIndex", "=", "-", "1", ";...
return the indexes of the columns with the largest value for each row
[ "return", "the", "indexes", "of", "the", "columns", "with", "the", "largest", "value", "for", "each", "row" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74661-L74679
train
repetere/modelscript
build/modelscript.umd.js
function() { var mins = []; for(var i = 1; i <= this.rows(); i++) { var min = null; var minIndex = -1; for(var j = 1; j <= this.cols(); j++) { if(min === null || this.e(i, j) < min) { min = this.e(i, j); ...
javascript
function() { var mins = []; for(var i = 1; i <= this.rows(); i++) { var min = null; var minIndex = -1; for(var j = 1; j <= this.cols(); j++) { if(min === null || this.e(i, j) < min) { min = this.e(i, j); ...
[ "function", "(", ")", "{", "var", "mins", "=", "[", "]", ";", "for", "(", "var", "i", "=", "1", ";", "i", "<=", "this", ".", "rows", "(", ")", ";", "i", "++", ")", "{", "var", "min", "=", "null", ";", "var", "minIndex", "=", "-", "1", ";"...
return the indexes of the columns with the smallest values for each row
[ "return", "the", "indexes", "of", "the", "columns", "with", "the", "smallest", "values", "for", "each", "row" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74702-L74720
train
repetere/modelscript
build/modelscript.umd.js
function(k, j, P, A, L) { var maxIndex = 0; var maxValue = 0; for(var i = k; i <= A.rows(); i++) { if(Math.abs(A.e(i, j)) > maxValue) { maxValue = Math.abs(A.e(k, j)); maxIndex = i; } } if(ma...
javascript
function(k, j, P, A, L) { var maxIndex = 0; var maxValue = 0; for(var i = k; i <= A.rows(); i++) { if(Math.abs(A.e(i, j)) > maxValue) { maxValue = Math.abs(A.e(k, j)); maxIndex = i; } } if(ma...
[ "function", "(", "k", ",", "j", ",", "P", ",", "A", ",", "L", ")", "{", "var", "maxIndex", "=", "0", ";", "var", "maxValue", "=", "0", ";", "for", "(", "var", "i", "=", "k", ";", "i", "<=", "A", ".", "rows", "(", ")", ";", "i", "++", ")...
perorm a partial pivot on the matrix. essentially move the largest row below-or-including the pivot and replace the pivot's row with it. a pivot matrix is returned so multiplication can perform the transform.
[ "perorm", "a", "partial", "pivot", "on", "the", "matrix", ".", "essentially", "move", "the", "largest", "row", "below", "-", "or", "-", "including", "the", "pivot", "and", "replace", "the", "pivot", "s", "row", "with", "it", ".", "a", "pivot", "matrix", ...
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74744-L74767
train
repetere/modelscript
build/modelscript.umd.js
luPack
function luPack() { var lu = lapack$1.lu(this.elements); return { L: $M(lu.L), U: $M(lu.U), P: $M(lu.P) // don't pass back IPIV }; }
javascript
function luPack() { var lu = lapack$1.lu(this.elements); return { L: $M(lu.L), U: $M(lu.U), P: $M(lu.P) // don't pass back IPIV }; }
[ "function", "luPack", "(", ")", "{", "var", "lu", "=", "lapack$1", ".", "lu", "(", "this", ".", "elements", ")", ";", "return", "{", "L", ":", "$M", "(", "lu", ".", "L", ")", ",", "U", ":", "$M", "(", "lu", ".", "U", ")", ",", "P", ":", "...
LU factorization from LAPACK
[ "LU", "factorization", "from", "LAPACK" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74812-L74820
train
repetere/modelscript
build/modelscript.umd.js
luJs
function luJs() { var A = this.dup(); var L = Matrix$b.I(A.rows()); var P = Matrix$b.I(A.rows()); var U = Matrix$b.Zeros(A.rows(), A.cols()); var p = 1; for(var k = 1; k <= Math.min(A.cols(), A.rows()); k++) { ...
javascript
function luJs() { var A = this.dup(); var L = Matrix$b.I(A.rows()); var P = Matrix$b.I(A.rows()); var U = Matrix$b.Zeros(A.rows(), A.cols()); var p = 1; for(var k = 1; k <= Math.min(A.cols(), A.rows()); k++) { ...
[ "function", "luJs", "(", ")", "{", "var", "A", "=", "this", ".", "dup", "(", ")", ";", "var", "L", "=", "Matrix$b", ".", "I", "(", "A", ".", "rows", "(", ")", ")", ";", "var", "P", "=", "Matrix$b", ".", "I", "(", "A", ".", "rows", "(", ")...
pure Javascript LU factorization
[ "pure", "Javascript", "LU", "factorization" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L74823-L74851
train
repetere/modelscript
build/modelscript.umd.js
function(fn) { var elements = []; this.each(function(x, i) { elements.push(fn(x, i)); }); return Vector.create(elements); }
javascript
function(fn) { var elements = []; this.each(function(x, i) { elements.push(fn(x, i)); }); return Vector.create(elements); }
[ "function", "(", "fn", ")", "{", "var", "elements", "=", "[", "]", ";", "this", ".", "each", "(", "function", "(", "x", ",", "i", ")", "{", "elements", ".", "push", "(", "fn", "(", "x", ",", "i", ")", ")", ";", "}", ")", ";", "return", "Vec...
Maps the vector to another vector according to the given function
[ "Maps", "the", "vector", "to", "another", "vector", "according", "to", "the", "given", "function" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75083-L75089
train
repetere/modelscript
build/modelscript.umd.js
function(vector) { var angle = this.angleFrom(vector); return (angle === null) ? null : (Math.abs(angle - Math.PI) <= sylvester.precision); }
javascript
function(vector) { var angle = this.angleFrom(vector); return (angle === null) ? null : (Math.abs(angle - Math.PI) <= sylvester.precision); }
[ "function", "(", "vector", ")", "{", "var", "angle", "=", "this", ".", "angleFrom", "(", "vector", ")", ";", "return", "(", "angle", "===", "null", ")", "?", "null", ":", "(", "Math", ".", "abs", "(", "angle", "-", "Math", ".", "PI", ")", "<=", ...
Returns true iff the vector is antiparallel to the argument
[ "Returns", "true", "iff", "the", "vector", "is", "antiparallel", "to", "the", "argument" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75133-L75136
train
repetere/modelscript
build/modelscript.umd.js
function(v) { if (typeof(v) == 'number') return this.map(function(k) { return k - v; }); var V = v.elements || v; if (this.elements.length != V.length) { return null; } return this.map(function(x, i) { return x - V[i - 1]; }); }
javascript
function(v) { if (typeof(v) == 'number') return this.map(function(k) { return k - v; }); var V = v.elements || v; if (this.elements.length != V.length) { return null; } return this.map(function(x, i) { return x - V[i - 1]; }); }
[ "function", "(", "v", ")", "{", "if", "(", "typeof", "(", "v", ")", "==", "'number'", ")", "return", "this", ".", "map", "(", "function", "(", "k", ")", "{", "return", "k", "-", "v", ";", "}", ")", ";", "var", "V", "=", "v", ".", "elements", ...
Returns the result of subtracting the argument from the vector
[ "Returns", "the", "result", "of", "subtracting", "the", "argument", "from", "the", "vector" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75155-L75162
train
repetere/modelscript
build/modelscript.umd.js
function(vector) { var B = vector.elements || vector; if (this.elements.length != 3 || B.length != 3) { return null; } var A = this.elements; return Vector.create([ (A[1] * B[2]) - (A[2] * B[1]), (A[2] * B[0]) - (A[0] * B[2]), ...
javascript
function(vector) { var B = vector.elements || vector; if (this.elements.length != 3 || B.length != 3) { return null; } var A = this.elements; return Vector.create([ (A[1] * B[2]) - (A[2] * B[1]), (A[2] * B[0]) - (A[0] * B[2]), ...
[ "function", "(", "vector", ")", "{", "var", "B", "=", "vector", ".", "elements", "||", "vector", ";", "if", "(", "this", ".", "elements", ".", "length", "!=", "3", "||", "B", ".", "length", "!=", "3", ")", "{", "return", "null", ";", "}", "var", ...
Returns the vector product of the vector with the argument Both vectors must have dimensionality 3
[ "Returns", "the", "vector", "product", "of", "the", "vector", "with", "the", "argument", "Both", "vectors", "must", "have", "dimensionality", "3" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75245-L75254
train
repetere/modelscript
build/modelscript.umd.js
function(x) { var index = null, n = this.elements.length; for (var i = 0; i < n; i++) { if (index === null && this.elements[i] == x) { index = i + 1; } } return index; }
javascript
function(x) { var index = null, n = this.elements.length; for (var i = 0; i < n; i++) { if (index === null && this.elements[i] == x) { index = i + 1; } } return index; }
[ "function", "(", "x", ")", "{", "var", "index", "=", "null", ",", "n", "=", "this", ".", "elements", ".", "length", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "if", "(", "index", "===", "null", "&&"...
Returns the index of the first match found
[ "Returns", "the", "index", "of", "the", "first", "match", "found" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75282-L75290
train
repetere/modelscript
build/modelscript.umd.js
function() { var rows = this.elements.length; var elements = []; for (var i = 0; i < rows; i++) { elements.push([this.elements[i]]); } return matrix$2.create(elements); }
javascript
function() { var rows = this.elements.length; var elements = []; for (var i = 0; i < rows; i++) { elements.push([this.elements[i]]); } return matrix$2.create(elements); }
[ "function", "(", ")", "{", "var", "rows", "=", "this", ".", "elements", ".", "length", ";", "var", "elements", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "rows", ";", "i", "++", ")", "{", "elements", ".", "push", "("...
Transpose a Vector, return a 1xn Matrix
[ "Transpose", "a", "Vector", "return", "a", "1xn", "Matrix" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75303-L75311
train
repetere/modelscript
build/modelscript.umd.js
function(t, obj) { var V, R = null, x, y, z; if (t.determinant) { R = t.elements; } switch (this.elements.length) { case 2: V = obj.elements || obj; if (V.length != 2) { return null; } if (!R) { R...
javascript
function(t, obj) { var V, R = null, x, y, z; if (t.determinant) { R = t.elements; } switch (this.elements.length) { case 2: V = obj.elements || obj; if (V.length != 2) { return null; } if (!R) { R...
[ "function", "(", "t", ",", "obj", ")", "{", "var", "V", ",", "R", "=", "null", ",", "x", ",", "y", ",", "z", ";", "if", "(", "t", ".", "determinant", ")", "{", "R", "=", "t", ".", "elements", ";", "}", "switch", "(", "this", ".", "elements"...
Rotates the vector about the given object. The object should be a point if the vector is 2D, and a line if it is 3D. Be careful with line directions!
[ "Rotates", "the", "vector", "about", "the", "given", "object", ".", "The", "object", "should", "be", "a", "point", "if", "the", "vector", "is", "2D", "and", "a", "line", "if", "it", "is", "3D", ".", "Be", "careful", "with", "line", "directions!" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75346-L75377
train
repetere/modelscript
build/modelscript.umd.js
function() { var V = this.dup(); switch (V.elements.length) { case 3: break; case 2: V.elements.push(0); break; default: return null; } return V; }
javascript
function() { var V = this.dup(); switch (V.elements.length) { case 3: break; case 2: V.elements.push(0); break; default: return null; } return V; }
[ "function", "(", ")", "{", "var", "V", "=", "this", ".", "dup", "(", ")", ";", "switch", "(", "V", ".", "elements", ".", "length", ")", "{", "case", "3", ":", "break", ";", "case", "2", ":", "V", ".", "elements", ".", "push", "(", "0", ")", ...
Utility to make sure vectors are 3D. If they are 2D, a zero z-component is added
[ "Utility", "to", "make", "sure", "vectors", "are", "3D", ".", "If", "they", "are", "2D", "a", "zero", "z", "-", "component", "is", "added" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75395-L75403
train
repetere/modelscript
build/modelscript.umd.js
function(obj) { var theta; if (obj.normal) { // obj is a plane theta = this.normal.angleFrom(obj.normal); return (Math.abs(theta) <= sylvester.precision || Math.abs(Math.PI - theta) <= sylvester.precision); } else if (...
javascript
function(obj) { var theta; if (obj.normal) { // obj is a plane theta = this.normal.angleFrom(obj.normal); return (Math.abs(theta) <= sylvester.precision || Math.abs(Math.PI - theta) <= sylvester.precision); } else if (...
[ "function", "(", "obj", ")", "{", "var", "theta", ";", "if", "(", "obj", ".", "normal", ")", "{", "// obj is a plane", "theta", "=", "this", ".", "normal", ".", "angleFrom", "(", "obj", ".", "normal", ")", ";", "return", "(", "Math", ".", "abs", "(...
Returns true iff the plane is parallel to the argument. Will return true if the planes are equal, or if you give a line and it lies in the plane.
[ "Returns", "true", "iff", "the", "plane", "is", "parallel", "to", "the", "argument", ".", "Will", "return", "true", "if", "the", "planes", "are", "equal", "or", "if", "you", "give", "a", "line", "and", "it", "lies", "in", "the", "plane", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75491-L75502
train
repetere/modelscript
build/modelscript.umd.js
function(plane) { var theta = this.normal.angleFrom(plane.normal); return (Math.abs(Math.PI/2 - theta) <= sylvester.precision); }
javascript
function(plane) { var theta = this.normal.angleFrom(plane.normal); return (Math.abs(Math.PI/2 - theta) <= sylvester.precision); }
[ "function", "(", "plane", ")", "{", "var", "theta", "=", "this", ".", "normal", ".", "angleFrom", "(", "plane", ".", "normal", ")", ";", "return", "(", "Math", ".", "abs", "(", "Math", ".", "PI", "/", "2", "-", "theta", ")", "<=", "sylvester", "....
Returns true iff the receiver is perpendicular to the argument
[ "Returns", "true", "iff", "the", "receiver", "is", "perpendicular", "to", "the", "argument" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75505-L75508
train
repetere/modelscript
build/modelscript.umd.js
function(obj) { if (obj.normal) { return null; } if (obj.direction) { return (this.contains(obj.anchor) && this.contains(obj.anchor.add(obj.direction))); } else { var P = obj.elements || obj; var A = this.anchor.elemen...
javascript
function(obj) { if (obj.normal) { return null; } if (obj.direction) { return (this.contains(obj.anchor) && this.contains(obj.anchor.add(obj.direction))); } else { var P = obj.elements || obj; var A = this.anchor.elemen...
[ "function", "(", "obj", ")", "{", "if", "(", "obj", ".", "normal", ")", "{", "return", "null", ";", "}", "if", "(", "obj", ".", "direction", ")", "{", "return", "(", "this", ".", "contains", "(", "obj", ".", "anchor", ")", "&&", "this", ".", "c...
Returns true iff the plane contains the given point or line
[ "Returns", "true", "iff", "the", "plane", "contains", "the", "given", "point", "or", "line" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75526-L75536
train
repetere/modelscript
build/modelscript.umd.js
function(point) { var P = point.elements || point; var A = this.anchor.elements, N = this.normal.elements; var dot = (A[0] - P[0]) * N[0] + (A[1] - P[1]) * N[1] + (A[2] - (P[2] || 0)) * N[2]; return vector.create([P[0] + N[0] * dot, P[1] + N[1] * dot, (P[2...
javascript
function(point) { var P = point.elements || point; var A = this.anchor.elements, N = this.normal.elements; var dot = (A[0] - P[0]) * N[0] + (A[1] - P[1]) * N[1] + (A[2] - (P[2] || 0)) * N[2]; return vector.create([P[0] + N[0] * dot, P[1] + N[1] * dot, (P[2...
[ "function", "(", "point", ")", "{", "var", "P", "=", "point", ".", "elements", "||", "point", ";", "var", "A", "=", "this", ".", "anchor", ".", "elements", ",", "N", "=", "this", ".", "normal", ".", "elements", ";", "var", "dot", "=", "(", "A", ...
Returns the point in the plane closest to the given point
[ "Returns", "the", "point", "in", "the", "plane", "closest", "to", "the", "given", "point" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75588-L75593
train
repetere/modelscript
build/modelscript.umd.js
function(obj) { if (obj.normal) { // obj is a plane var A = this.anchor.elements, N = this.normal.elements; var A1 = A[0], A2 = A[1], A3 = A[2], N1 = N[0], N2 = N[1], N3 = N[2]; var newA = this.anchor.reflectionIn(obj).elements; ...
javascript
function(obj) { if (obj.normal) { // obj is a plane var A = this.anchor.elements, N = this.normal.elements; var A1 = A[0], A2 = A[1], A3 = A[2], N1 = N[0], N2 = N[1], N3 = N[2]; var newA = this.anchor.reflectionIn(obj).elements; ...
[ "function", "(", "obj", ")", "{", "if", "(", "obj", ".", "normal", ")", "{", "// obj is a plane", "var", "A", "=", "this", ".", "anchor", ".", "elements", ",", "N", "=", "this", ".", "normal", ".", "elements", ";", "var", "A1", "=", "A", "[", "0"...
Returns the reflection of the plane in the given point, line or plane.
[ "Returns", "the", "reflection", "of", "the", "plane", "in", "the", "given", "point", "line", "or", "plane", "." ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75615-L75634
train
repetere/modelscript
build/modelscript.umd.js
function(anchor, v1, v2) { anchor = vector.create(anchor); anchor = anchor.to3D(); if (anchor === null) { return null; } v1 = vector.create(v1); v1 = v1.to3D(); if (v1 === null) { return null; } if (typeof(v2) == 'undefined') { ...
javascript
function(anchor, v1, v2) { anchor = vector.create(anchor); anchor = anchor.to3D(); if (anchor === null) { return null; } v1 = vector.create(v1); v1 = v1.to3D(); if (v1 === null) { return null; } if (typeof(v2) == 'undefined') { ...
[ "function", "(", "anchor", ",", "v1", ",", "v2", ")", "{", "anchor", "=", "vector", ".", "create", "(", "anchor", ")", ";", "anchor", "=", "anchor", ".", "to3D", "(", ")", ";", "if", "(", "anchor", "===", "null", ")", "{", "return", "null", ";", ...
Sets the anchor point and normal to the plane. If three arguments are specified, the normal is calculated by assuming the three points should lie in the same plane. If only two are sepcified, the second is taken to be the normal. Normal vector is normalised before storage.
[ "Sets", "the", "anchor", "point", "and", "normal", "to", "the", "plane", ".", "If", "three", "arguments", "are", "specified", "the", "normal", "is", "calculated", "by", "assuming", "the", "three", "points", "should", "lie", "in", "the", "same", "plane", "....
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75640-L75672
train
repetere/modelscript
build/modelscript.umd.js
function(obj) { if (obj.start && obj.end) { return this.contains(obj.start) && this.contains(obj.end); } var dist = this.distanceFrom(obj); return (dist !== null && dist <= sylvester.precision); }
javascript
function(obj) { if (obj.start && obj.end) { return this.contains(obj.start) && this.contains(obj.end); } var dist = this.distanceFrom(obj); return (dist !== null && dist <= sylvester.precision); }
[ "function", "(", "obj", ")", "{", "if", "(", "obj", ".", "start", "&&", "obj", ".", "end", ")", "{", "return", "this", ".", "contains", "(", "obj", ".", "start", ")", "&&", "this", ".", "contains", "(", "obj", ".", "end", ")", ";", "}", "var", ...
Returns true iff the argument is a point on the line, or if the argument is a line segment lying within the receiver
[ "Returns", "true", "iff", "the", "argument", "is", "a", "point", "on", "the", "line", "or", "if", "the", "argument", "is", "a", "line", "segment", "lying", "within", "the", "receiver" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75800-L75804
train
repetere/modelscript
build/modelscript.umd.js
function(point) { if (!this.contains(point)) { return null; } var P = point.elements || point; var A = this.anchor.elements, D = this.direction.elements; return (P[0] - A[0]) * D[0] + (P[1] - A[1]) * D[1] + ((P[2] || 0) - A[2]) * D[2]; }
javascript
function(point) { if (!this.contains(point)) { return null; } var P = point.elements || point; var A = this.anchor.elements, D = this.direction.elements; return (P[0] - A[0]) * D[0] + (P[1] - A[1]) * D[1] + ((P[2] || 0) - A[2]) * D[2]; }
[ "function", "(", "point", ")", "{", "if", "(", "!", "this", ".", "contains", "(", "point", ")", ")", "{", "return", "null", ";", "}", "var", "P", "=", "point", ".", "elements", "||", "point", ";", "var", "A", "=", "this", ".", "anchor", ".", "e...
Returns the distance from the anchor of the given point. Negative values are returned for points that are in the opposite direction to the line's direction from the line's anchor point.
[ "Returns", "the", "distance", "from", "the", "anchor", "of", "the", "given", "point", ".", "Negative", "values", "are", "returned", "for", "points", "that", "are", "in", "the", "opposite", "direction", "to", "the", "line", "s", "direction", "from", "the", ...
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75809-L75814
train
repetere/modelscript
build/modelscript.umd.js
function(obj) { if (obj.normal || (obj.start && obj.end)) { return obj.intersectionWith(this); } if (!this.intersects(obj)) { return null; } var P = this.anchor.elements, X = this.direction.elements, Q = obj.anchor.elements, Y = obj.direction.elements;...
javascript
function(obj) { if (obj.normal || (obj.start && obj.end)) { return obj.intersectionWith(this); } if (!this.intersects(obj)) { return null; } var P = this.anchor.elements, X = this.direction.elements, Q = obj.anchor.elements, Y = obj.direction.elements;...
[ "function", "(", "obj", ")", "{", "if", "(", "obj", ".", "normal", "||", "(", "obj", ".", "start", "&&", "obj", ".", "end", ")", ")", "{", "return", "obj", ".", "intersectionWith", "(", "this", ")", ";", "}", "if", "(", "!", "this", ".", "inter...
Returns the unique intersection point with the argument, if one exists
[ "Returns", "the", "unique", "intersection", "point", "with", "the", "argument", "if", "one", "exists" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75828-L75842
train
repetere/modelscript
build/modelscript.umd.js
function(segment) { return (this.start.eql(segment.start) && this.end.eql(segment.end)) || (this.start.eql(segment.end) && this.end.eql(segment.start)); }
javascript
function(segment) { return (this.start.eql(segment.start) && this.end.eql(segment.end)) || (this.start.eql(segment.end) && this.end.eql(segment.start)); }
[ "function", "(", "segment", ")", "{", "return", "(", "this", ".", "start", ".", "eql", "(", "segment", ".", "start", ")", "&&", "this", ".", "end", ".", "eql", "(", "segment", ".", "end", ")", ")", "||", "(", "this", ".", "start", ".", "eql", "...
Returns true iff the line segment is equal to the argument
[ "Returns", "true", "iff", "the", "line", "segment", "is", "equal", "to", "the", "argument" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75975-L75978
train
repetere/modelscript
build/modelscript.umd.js
function() { var A = this.start.elements, B = this.end.elements; var C1 = B[0] - A[0], C2 = B[1] - A[1], C3 = B[2] - A[2]; return Math.sqrt(C1*C1 + C2*C2 + C3*C3); }
javascript
function() { var A = this.start.elements, B = this.end.elements; var C1 = B[0] - A[0], C2 = B[1] - A[1], C3 = B[2] - A[2]; return Math.sqrt(C1*C1 + C2*C2 + C3*C3); }
[ "function", "(", ")", "{", "var", "A", "=", "this", ".", "start", ".", "elements", ",", "B", "=", "this", ".", "end", ".", "elements", ";", "var", "C1", "=", "B", "[", "0", "]", "-", "A", "[", "0", "]", ",", "C2", "=", "B", "[", "1", "]",...
Returns the length of the line segment
[ "Returns", "the", "length", "of", "the", "line", "segment" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75986-L75990
train
repetere/modelscript
build/modelscript.umd.js
function() { var A = this.start.elements, B = this.end.elements; return vector.create([B[0] - A[0], B[1] - A[1], B[2] - A[2]]); }
javascript
function() { var A = this.start.elements, B = this.end.elements; return vector.create([B[0] - A[0], B[1] - A[1], B[2] - A[2]]); }
[ "function", "(", ")", "{", "var", "A", "=", "this", ".", "start", ".", "elements", ",", "B", "=", "this", ".", "end", ".", "elements", ";", "return", "vector", ".", "create", "(", "[", "B", "[", "0", "]", "-", "A", "[", "0", "]", ",", "B", ...
Returns the line segment as a vector equal to its end point relative to its endpoint
[ "Returns", "the", "line", "segment", "as", "a", "vector", "equal", "to", "its", "end", "point", "relative", "to", "its", "endpoint" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L75994-L75997
train
repetere/modelscript
build/modelscript.umd.js
function(obj) { var P = this.pointClosestTo(obj); return (P === null) ? null : P.distanceFrom(obj); }
javascript
function(obj) { var P = this.pointClosestTo(obj); return (P === null) ? null : P.distanceFrom(obj); }
[ "function", "(", "obj", ")", "{", "var", "P", "=", "this", ".", "pointClosestTo", "(", "obj", ")", ";", "return", "(", "P", "===", "null", ")", "?", "null", ":", "P", ".", "distanceFrom", "(", "obj", ")", ";", "}" ]
Returns the distance between the argument and the line segment's closest point to the argument
[ "Returns", "the", "distance", "between", "the", "argument", "and", "the", "line", "segment", "s", "closest", "point", "to", "the", "argument" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L76027-L76030
train
repetere/modelscript
build/modelscript.umd.js
function(obj) { if (obj.start && obj.end) { return this.contains(obj.start) && this.contains(obj.end); } var P = (obj.elements || obj).slice(); if (P.length == 2) { P.push(0); } if (this.start.eql(P)) { return true; } var S = this.start.ele...
javascript
function(obj) { if (obj.start && obj.end) { return this.contains(obj.start) && this.contains(obj.end); } var P = (obj.elements || obj).slice(); if (P.length == 2) { P.push(0); } if (this.start.eql(P)) { return true; } var S = this.start.ele...
[ "function", "(", "obj", ")", "{", "if", "(", "obj", ".", "start", "&&", "obj", ".", "end", ")", "{", "return", "this", ".", "contains", "(", "obj", ".", "start", ")", "&&", "this", ".", "contains", "(", "obj", ".", "end", ")", ";", "}", "var", ...
Returns true iff the given point lies on the segment
[ "Returns", "true", "iff", "the", "given", "point", "lies", "on", "the", "segment" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L76033-L76042
train
repetere/modelscript
build/modelscript.umd.js
function(obj) { if (!this.line.intersects(obj)) { return null; } var P = this.line.intersectionWith(obj); return (this.contains(P) ? P : null); }
javascript
function(obj) { if (!this.line.intersects(obj)) { return null; } var P = this.line.intersectionWith(obj); return (this.contains(P) ? P : null); }
[ "function", "(", "obj", ")", "{", "if", "(", "!", "this", ".", "line", ".", "intersects", "(", "obj", ")", ")", "{", "return", "null", ";", "}", "var", "P", "=", "this", ".", "line", ".", "intersectionWith", "(", "obj", ")", ";", "return", "(", ...
Returns the unique point of intersection with the argument
[ "Returns", "the", "unique", "point", "of", "intersection", "with", "the", "argument" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L76050-L76054
train
repetere/modelscript
build/modelscript.umd.js
function(obj) { if (obj.normal) { // obj is a plane var V = this.line.intersectionWith(obj); if (V === null) { return null; } return this.pointClosestTo(V); } else { // obj is a line (segment) or po...
javascript
function(obj) { if (obj.normal) { // obj is a plane var V = this.line.intersectionWith(obj); if (V === null) { return null; } return this.pointClosestTo(V); } else { // obj is a line (segment) or po...
[ "function", "(", "obj", ")", "{", "if", "(", "obj", ".", "normal", ")", "{", "// obj is a plane", "var", "V", "=", "this", ".", "line", ".", "intersectionWith", "(", "obj", ")", ";", "if", "(", "V", "===", "null", ")", "{", "return", "null", ";", ...
Returns the point on the line segment closest to the given object
[ "Returns", "the", "point", "on", "the", "line", "segment", "closest", "to", "the", "given", "object" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.umd.js#L76057-L76070
train