@datagrok-libraries/utils
Advanced tools
Comparing version 4.1.19 to 4.1.20
# utils changelog | ||
## 4.1.20 (2023-11-03) | ||
This release focuses on improving performance. | ||
## 4.1.19 (2023-10-30) | ||
### Features | ||
* Line rendering on scatterplot improvements. | ||
## 4.1.18 (2023-10-17) | ||
### Features | ||
* Added unsupported dataset for viewers test. | ||
## 4.1.17 (2023-10-13) | ||
### Features | ||
* Added demo tests registration. | ||
## 4.1.16 (2023-10-12) | ||
### Features | ||
* Implemented generic method to draw lines on the scatterplot. | ||
## 4.1.15 (2023-10-04) | ||
### Bug Fixes | ||
* Updated ItemsGrid classes. | ||
## 4.1.14 (2023-09-13) | ||
### Bug Fixes | ||
* Added events after adding ItemsGrid. | ||
## 4.1.13 (2023-09-13) | ||
### Bug Fixes | ||
* Fixed ItemsGrid removing label. | ||
## 4.1.12 (2023-09-12) | ||
### Bug Fixes | ||
* Updated ItemsGrid with custom inputs. | ||
## 4.1.11 (2023-09-10) | ||
### Bug Fixes | ||
* Fixed captions for ItemsGrid. | ||
## 4.1.10 (2023-09-01) | ||
### Bug Fixes | ||
* Fixed checkbox for ItemsGrid. | ||
## 4.1.9 (2023-09-01) | ||
### Bug Fixes | ||
* Added prefix for test parameters. | ||
## 4.1.8 (2023-09-01) | ||
## 4.1.7 (2023-08-31) | ||
### Bug Fixes | ||
* Fixed color input for ItemsGrid. | ||
## 4.1.6 (2023-08-31) | ||
### Features | ||
* Added ItemsGrid component. | ||
## 4.1.5 (2023-08-30) | ||
### Bug Fixes | ||
* Fixed tags for initTests(). | ||
* Handled test return values. | ||
* Tests now run by name. | ||
## 4.1.4 (2023-07-25) | ||
### Bug Fixes | ||
* Custom functions now run before tests. | ||
## 4.1.3 (2023-07-19) | ||
@@ -4,0 +102,0 @@ |
@@ -11,3 +11,3 @@ { | ||
"fullName": "Utils", | ||
"version": "4.1.19", | ||
"version": "4.1.20", | ||
"description": "Common utilities", | ||
@@ -40,2 +40,2 @@ "dependencies": { | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Matrix, Vector, Vectors, DistanceMetric } from './type-declarations'; | ||
import { Matrix, Vector, Coordinates, Vectors, DistanceMetric } from './type-declarations'; | ||
/** | ||
@@ -12,2 +12,12 @@ * Asserts a condition by throwing an Error. | ||
/** | ||
* Creates new two-dimensional array and fills it with the value given. | ||
* | ||
* @param {number} dimension1 The first dimension of the coordinates (number of rows). | ||
* @param {number} dimension2 The second dimension of the coordinates (number of columns). | ||
* @param {number} [fill=0] A value to fill the coordinates with. | ||
* @return {Coordinates} A two-dimensional filled with the value given. | ||
* @todo Might be slow since used Array.map. Probably needs performance revision. | ||
*/ | ||
export declare function initCoordinates(dimension1: number, dimension2: number, fill?: number): Coordinates; | ||
/** | ||
* Transpose matrix. | ||
@@ -91,3 +101,5 @@ * | ||
/** | ||
* Returns normalized vector | ||
* Returns normalized vector. | ||
* | ||
* @export | ||
* @param {Vector} data numerical array | ||
@@ -94,0 +106,0 @@ */ |
@@ -24,3 +24,3 @@ import { Vector } from './type-declarations'; | ||
*/ | ||
function initCoordinates(dimension1, dimension2, fill = 0) { | ||
export function initCoordinates(dimension1, dimension2, fill = 0) { | ||
return new Array(dimension1).fill(fill).map(() => (new Vector(dimension2).fill(fill))); | ||
@@ -122,6 +122,9 @@ } | ||
export function calculateEuclideanDistance(p, q) { | ||
const diff = vectorAdd(p, q, -1); | ||
const sqdiff = vectorSquare(diff); | ||
const sqdiffSumm = itemsSum(sqdiff); | ||
return Math.sqrt(sqdiffSumm); | ||
let result = 0; | ||
const len = p.length; | ||
if (len !== q.length) | ||
throw new Error('The dimensionality of the vectors must match'); | ||
for (let i = 0; i < len; ++i) | ||
result += Math.pow((p[i] - q[i]), 2); | ||
return Math.sqrt(result); | ||
} | ||
@@ -238,16 +241,19 @@ /** | ||
/** | ||
* Returns normalized vector | ||
* Returns normalized vector. | ||
* | ||
* @export | ||
* @param {Vector} data numerical array | ||
*/ | ||
export function normalize(data) { | ||
let mean = 0; | ||
let std = 0; | ||
for (let i = 0; i < data.length; ++i) | ||
mean += data[i]; | ||
mean /= data.length; | ||
for (let i = 0; i < data.length; ++i) | ||
std += (data[i] - mean) * (data[i] - mean); | ||
std = Math.sqrt(std / data.length); | ||
for (let i = 0; i < data.length; ++i) | ||
data[i] = (data[i] - mean) / std; | ||
const len = data.length; | ||
let sum = 0; | ||
let sumOfSquares = 0; | ||
for (let i = 0; i < len; ++i) { | ||
sum += data[i]; | ||
sumOfSquares += Math.pow(data[i], 2); | ||
} | ||
const mean = sum / len; | ||
const stdDevInverse = 1.0 / Math.sqrt(sumOfSquares / len - Math.pow(mean, 2)); | ||
for (let i = 0; i < len; ++i) | ||
data[i] = (data[i] - mean) * stdDevInverse; | ||
return data; | ||
@@ -265,2 +271,2 @@ } | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVjdG9yLW9wZXJhdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJ2ZWN0b3Itb3BlcmF0aW9ucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQVMsTUFBTSxFQUF1QyxNQUFNLHFCQUFxQixDQUFDO0FBQ3pGLE9BQU8sRUFBQyxXQUFXLEVBQUUsU0FBUyxFQUFDLE1BQU0sVUFBVSxDQUFDO0FBRWhEOzs7Ozs7O0dBT0c7QUFDSCxNQUFNLFVBQVUsTUFBTSxDQUFDLFlBQXFCLEtBQUssRUFBRSxVQUFrQixrQkFBa0I7SUFDckYsSUFBSSxDQUFDLFNBQVM7UUFDWixNQUFNLElBQUksS0FBSyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0FBQzdCLENBQUM7QUFFRDs7Ozs7Ozs7R0FRRztBQUNILFNBQVMsZUFBZSxDQUFDLFVBQWtCLEVBQUUsVUFBa0IsRUFBRSxPQUFlLENBQUM7SUFDL0UsT0FBTyxJQUFJLEtBQUssQ0FBQyxVQUFVLENBQUMsQ0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G4gKiBGaW5kcyBzZXQgZGlmZmVyZW5jZSBiZXR3ZWVuIHR3byBsaXN0cy5cbiAqIEBwYXJhbSB7YW55W119IGEgVGhlIGZpcnN0IGxpc3QuXG4gKiBAcGFyYW0ge2FueVtdfSBiIFRoZSBzZWNvbmQgbGlzdC5cbiAqIEByZXR1cm4ge2FueVtdfVxuICovXG5leHBvcnQgZnVuY3Rpb24gc2V0RGlmZmVyZW5jZShhOiBhbnlbXSwgYjogYW55W10pOiBhbnlbXSB7XG4gIGNvbnN0IGJTZXQgPSBuZXcgU2V0KGIpO1xuICByZXR1cm4gQXJyYXkuZnJvbShuZXcgU2V0KGEuZmlsdGVyKCh4KSA9PiAhYlNldC5oYXMoeCkpKS52YWx1ZXMoKSk7XG59XG4iXX0= |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
433874
3173