Skip to content

Commit

Permalink
Add function descriptions and fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
NicklasXYZ committed Apr 14, 2024
1 parent d2485d4 commit ef8844d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/gleam_community/maths/arithmetics.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ pub fn proper_divisors(n: Int) -> List(Int) {
/// \\]
///
/// In the formula, $$n$$ is the length of the list and $$x_i \in \mathbb{R}$$ is
/// the value in the input list indexed by $$i$$, while $$w_i \in \mathbb{R}$$ is
/// a corresponding weight ($$w_i = 1.0\\;\forall i=1...n$$ by default).
/// the value in the input list indexed by $$i$$, while the $$w_i \in \mathbb{R}$$
/// are corresponding weights ($$w_i = 1.0\\;\forall i=1...n$$ by default).
///
/// <details>
/// <summary>Example:</summary>
Expand Down Expand Up @@ -412,8 +412,8 @@ pub fn int_sum(arr: List(Int)) -> Int {
/// \\]
///
/// In the formula, $$n$$ is the length of the list and $$x_i \in \mathbb{R}$$ is
/// the value in the input list indexed by $$i$$, while $$w_i \in \mathbb{R}$$ is
/// a corresponding weight ($$w_i = 1.0\\;\forall i=1...n$$ by default).
/// the value in the input list indexed by $$i$$, while the $$w_i \in \mathbb{R}$$
/// are corresponding weights ($$w_i = 1.0\\;\forall i=1...n$$ by default).
///
/// <details>
/// <summary>Example:</summary>
Expand Down
41 changes: 34 additions & 7 deletions src/gleam_community/maths/metrics.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ pub fn norm(
/// \\]
///
/// In the formula, $$n$$ is the length of the two lists and $$x_i, y_i$$ are the
/// values in the respective input lists indexed by $$i$$, while
/// $$w_i \in \mathbb{R}_{+}$$ is a corresponding positive weight
/// values in the respective input lists indexed by $$i$$, while the
/// $$w_i \in \mathbb{R}_{+}$$ are corresponding positive weights
/// ($$w_i = 1.0\\;\forall i=1...n$$ by default).
///
/// <details>
Expand Down Expand Up @@ -304,7 +304,7 @@ pub fn manhattan_distance(
///
/// In the formula, $$p >= 1$$ is the order, $$n$$ is the length of the two lists
/// and $$x_i, y_i$$ are the values in the respective input lists indexed by $$i$$.
/// $$w_i \in \mathbb{R}_{+}$$ is a corresponding positive weight
/// The $$w_i \in \mathbb{R}_{+}$$ are corresponding positive weights
/// ($$w_i = 1.0\\;\forall i=1...n$$ by default).
///
/// The Minkowski distance is a generalization of both the Euclidean distance
Expand Down Expand Up @@ -393,8 +393,8 @@ pub fn minkowski_distance(
/// \\]
///
/// In the formula, $$n$$ is the length of the two lists and $$x_i, y_i$$ are the
/// values in the respective input lists indexed by $$i$$, while
/// $$w_i \in \mathbb{R}_{+}$$ is a corresponding positive weight
/// values in the respective input lists indexed by $$i$$, while the
/// $$w_i \in \mathbb{R}_{+}$$ are corresponding positive weights
/// ($$w_i = 1.0\\;\forall i=1...n$$ by default).
///
/// <details>
Expand Down Expand Up @@ -1042,8 +1042,8 @@ pub fn overlap_coefficient(xset: set.Set(a), yset: set.Set(a)) -> Float {
/// \\]
///
/// In the formula, $$n$$ is the length of the two lists and $$x_i$$, $$y_i$$ are
/// the values in the respective input lists indexed by $$i$$, while
/// $$w_i \in \mathbb{R}_{+}$$ is a corresponding positive weight
/// the values in the respective input lists indexed by $$i$$, while the
/// $$w_i \in \mathbb{R}_{+}$$ are corresponding positive weights
/// ($$w_i = 1.0\\;\forall i=1...n$$ by default).
///
/// The cosine similarity provides a value between -1 and 1, where 1 means the
Expand Down Expand Up @@ -1253,6 +1253,18 @@ fn distance_list_helper(
/// </a>
/// </div>
///
/// Calculate the (weighted) Canberra distance between two lists:
///
/// \\[
/// \sum_{i=1}^n w_{i}\frac{\left| x_i - y_i \right|}
/// {\left| x_i \right| + \left| y_i \right|}
/// \\]
///
/// In the formula, $$n$$ is the length of the two lists, and $$x_i, y_i$$ are the
/// values in the respective input lists indexed by $$i$$, while the
/// $$w_i \in \mathbb{R}_{+}$$ are corresponding positive weights
/// ($$w_i = 1.0\\;\forall i=1...n$$ by default).
///
/// <details>
/// <summary>Example:</summary>
///
Expand Down Expand Up @@ -1330,6 +1342,21 @@ fn canberra_distance_helper(tuple: #(Float, Float)) -> Float {
/// </a>
/// </div>
///
/// Calculate the (weighted) Bray-Curtis distance between two lists:
///
/// \\[
/// \frac{\sum_{i=1}^n w_{i} \left| x_i - y_i \right|}
/// {\sum_{i=1}^n w_{i}\left| x_i + y_i \right|}
/// \\]
///
/// In the formula, $$n$$ is the length of the two lists, and $$x_i, y_i$$ are the values
/// in the respective input lists indexed by $$i$$, while the
/// $$w_i \in \mathbb{R}_{+}$$ are corresponding positive weights
/// ($$w_i = 1.0\\;\forall i=1...n$$ by default).
///
/// The Bray-Curtis distance is in the range $$[0, 1]$$ if all entries $$x_i, y_i$$ are
/// positive.
///
/// <details>
/// <summary>Example:</summary>
///
Expand Down

0 comments on commit ef8844d

Please sign in to comment.