Comparing version 0.33.1 to 0.34.0
# Changelog | ||
## 0.34.0 | ||
* Adding `set.overlap`. | ||
## 0.33.1 | ||
@@ -4,0 +8,0 @@ |
@@ -262,2 +262,4 @@ /** | ||
*/ | ||
// TODO: can do better by improving upon static-kdtree here | ||
KDTree.prototype.kNearestNeighbors = function(k, query) { | ||
@@ -264,0 +266,0 @@ if (k <= 0) |
{ | ||
"name": "mnemonist", | ||
"version": "0.33.1", | ||
"version": "0.34.0", | ||
"description": "Curated collection of data structures for the JavaScript language.", | ||
@@ -85,2 +85,3 @@ "scripts": { | ||
"seedrandom": "^3.0.5", | ||
"static-kdtree": "^1.0.2", | ||
"typescript": "^3.8.2" | ||
@@ -87,0 +88,0 @@ }, |
@@ -64,2 +64,3 @@ [![Build Status](https://travis-ci.org/Yomguithereal/mnemonist.svg)](https://travis-ci.org/Yomguithereal/mnemonist) | ||
* [Static IntervalTree](https://yomguithereal.github.io/mnemonist/static-interval-tree) | ||
* [KD-Tree](https://yomguithereal.github.io/mnemonist/kd-tree) | ||
@@ -66,0 +67,0 @@ **Metric space indexation** |
@@ -18,1 +18,2 @@ /** | ||
export function jaccard<T>(a: Set<T>, b:Set<T>): number; | ||
export function overlap<T>(a: Set<T>, b: Set<T>): number; |
19
set.js
@@ -280,2 +280,3 @@ /** | ||
* @param {Set} B - Second set. | ||
* @return {number} | ||
*/ | ||
@@ -316,2 +317,3 @@ exports.intersectionSize = function(A, B) { | ||
* @param {Set} B - Second set. | ||
* @return {number} | ||
*/ | ||
@@ -329,2 +331,3 @@ exports.unionSize = function(A, B) { | ||
* @param {Set} B - Second set. | ||
* @return {number} | ||
*/ | ||
@@ -341,1 +344,17 @@ exports.jaccard = function(A, B) { | ||
}; | ||
/** | ||
* Function returning the overlap coefficient between A & B. | ||
* | ||
* @param {Set} A - First set. | ||
* @param {Set} B - Second set. | ||
* @return {number} | ||
*/ | ||
exports.overlap = function(A, B) { | ||
var I = exports.intersectionSize(A, B); | ||
if (I === 0) | ||
return 0; | ||
return I / Math.min(A.size, B.size); | ||
}; |
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
349639
12541
110
12