New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@datagrok-libraries/utils

Package Overview
Dependencies
Maintainers
3
Versions
233
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datagrok-libraries/utils - npm Package Compare versions

Comparing version 4.0.7 to 4.0.8

2

package.json

@@ -7,3 +7,3 @@ {

"fullName": "Utils",
"version": "4.0.7",
"version": "4.0.8",
"description": "Common utilities",

@@ -10,0 +10,0 @@ "dependencies": {

@@ -60,2 +60,11 @@ import { Matrix, Vector, Vectors, DistanceMetric } from './type-declarations';

export declare function calcDistanceMatrix(data: Vectors, distance: DistanceMetric): Matrix;
/**
* Creates a distance matrix using a custom distance function.
*
* @export
* @param {Vectors} data Input vectors to calculate distances.
* @param {DistanceMetric} distance Custom distance function.
* @return {Matrix} Calculated custom distance matrix.
*/
export declare function calcNormalizedDistanceMatrix(data: Vectors, distance: DistanceMetric): Matrix;
/** Generates array from a range [begin; end] or [begin; end) if endExclusive. **/

@@ -62,0 +71,0 @@ export declare function genRange(begin: number, end: number, endExclusive?: boolean): Int32Array;

@@ -145,2 +145,31 @@ import { Vector } from './type-declarations';

}
/**
* Creates a distance matrix using a custom distance function.
*
* @export
* @param {Vectors} data Input vectors to calculate distances.
* @param {DistanceMetric} distance Custom distance function.
* @return {Matrix} Calculated custom distance matrix.
*/
export function calcNormalizedDistanceMatrix(data, distance) {
const nItems = data.length;
const matrix = initCoordinates(nItems, nItems, 0);
let max = Number.MIN_VALUE;
let min = Number.MAX_VALUE;
for (let i = 0; i < nItems; ++i) {
for (let j = i; j < nItems; ++j) {
const d = (data[i] == null) || (data[j] == null || i === j) ? 0 : distance(data[i], data[j]);
matrix[i][j] = matrix[j][i] = d;
if (d > max)
max = d;
if (d < min)
min = d;
}
}
for (let i = 0; i < nItems; ++i) {
for (let j = i + 1; j < nItems; ++j)
matrix[i][j] = matrix[j][i] = (matrix[i][j] - min) / (max - min);
}
return matrix;
}
/** Generates array from a range [begin; end] or [begin; end) if endExclusive. **/

@@ -234,2 +263,2 @@ export function genRange(begin, end, endExclusive = false) {

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVjdG9yLW9wZXJhdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ2ZWN0b3Itb3BlcmF0aW9ucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQVMsTUFBTSxFQUF1QyxNQUFNLHFCQUFxQixDQUFDO0FBQ3pGLE9BQU8sRUFBQyxXQUFXLEVBQUUsU0FBUyxFQUFDLE1BQU0sVUFBVSxDQUFDO0FBRWhEOzs7Ozs7O0dBT0c7QUFDSCxNQUFNLFVBQVUsTUFBTSxDQUFDLFlBQXFCLEtBQUssRUFBRSxVQUFrQixrQkFBa0I7SUFDckYsSUFBSSxDQUFDLFNBQVM7UUFDWixNQUFNLElBQUksS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0FBQzdCLENBQUM7QUFFRDs7Ozs7Ozs7R0FRRztBQUNILFNBQVMsZUFBZSxDQUFDLFVBQWtCLEVBQUUsVUFBa0IsRUFBRSxPQUFlLENBQUM7SUFDL0UsT0FBTyxJQUFJLEtBQUssQ0FBQyxVQUFVLENBQUMsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUMsR0FBRyxDQUFDLEdBQUcsRUFBRSxDQUFDLENBQUMsSUFBSSxNQUFNLENBQUMsVUFBVSxDQUFDLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUN6RixDQUFDO0FBRUQ7Ozs7Ozs7R0FPRztBQUNILE1BQU0sVUFBVSxlQUFlLENBQUMsTUFBYztJQUM1QyxPQUFPLElBQUksS0FBSyxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxJQU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KHgpID0+ICFiU2V0Lmhhcyh4KSkpLnZhbHVlcygpKTtcbn1cbiJdfQ==

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc