From 91da5f53674727bc8bfc38eadc360a5dd5e7fca1 Mon Sep 17 00:00:00 2001 From: Markus Hovd Date: Thu, 3 Oct 2024 20:17:09 +0200 Subject: [PATCH] Fix minor typos (#22) --- src/api/python.rs | 8 ++++---- src/combinatorics.rs | 6 +++--- src/domains/factorized_rational_polynomial.rs | 8 ++++---- src/domains/integer.rs | 4 ++-- src/domains/rational_polynomial.rs | 8 ++++---- src/evaluate.rs | 4 ++-- src/parser.rs | 2 +- src/poly/gcd.rs | 2 +- symbolica.pyi | 8 ++++---- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/api/python.rs b/src/api/python.rs index d8bbdcd..0a4e62c 100644 --- a/src/api/python.rs +++ b/src/api/python.rs @@ -9987,7 +9987,7 @@ impl PythonMatrix { } /// A sample from the Symbolica integrator. It could consist of discrete layers, -/// accessible with `d` (empty when there are not discrete layers), and the final continous layer `c` if it is present. +/// accessible with `d` (empty when there are not discrete layers), and the final continuous layer `c` if it is present. #[pyclass(name = "Sample", module = "symbolica")] #[derive(Clone)] pub struct PythonSample { @@ -10277,11 +10277,11 @@ impl PythonNumericalIntegrator { /// >>> print('Iteration {}: {:.6} +- {:.6}, chi={:.6}'.format(i+1, avg, err, chi_sq)) fn update( &mut self, - discrete_learing_rate: f64, - continuous_learing_rate: f64, + discrete_learning_rate: f64, + continuous_learning_rate: f64, ) -> PyResult<(f64, f64, f64)> { self.grid - .update(discrete_learing_rate, continuous_learing_rate); + .update(discrete_learning_rate, continuous_learning_rate); let stats = self.grid.get_statistics(); Ok((stats.avg, stats.err, stats.chi_sq / stats.cur_iter as f64)) diff --git a/src/combinatorics.rs b/src/combinatorics.rs index f6ea47e..df79833 100644 --- a/src/combinatorics.rs +++ b/src/combinatorics.rs @@ -330,7 +330,7 @@ pub fn partitions( // compute the prefactor let mut counter = vec![]; - let mut bin_goups: HashMap<&(B, Vec), usize> = HashMap::default(); + let mut bin_groups: HashMap<&(B, Vec), usize> = HashMap::default(); for (pref, sol) in &mut res { for (e, _) in &element_sorted { counter.clear(); @@ -345,10 +345,10 @@ pub fn partitions( // count the number of unique bins for named_bin in &*sol { - *bin_goups.entry(named_bin).or_insert(0) += 1; + *bin_groups.entry(named_bin).or_insert(0) += 1; } - for (_, p) in bin_goups.drain() { + for (_, p) in bin_groups.drain() { *pref /= &Integer::new(p as i64); } } diff --git a/src/domains/factorized_rational_polynomial.rs b/src/domains/factorized_rational_polynomial.rs index c96ef27..b2b21fb 100644 --- a/src/domains/factorized_rational_polynomial.rs +++ b/src/domains/factorized_rational_polynomial.rs @@ -412,11 +412,11 @@ where { pub fn pow(&self, e: u64) -> Self { if e > u32::MAX as u64 { - panic!("Power of exponentation is larger than 2^32: {}", e); + panic!("Power of exponentiation is larger than 2^32: {}", e); } let e = e as u32; - // TODO: do binary exponentation + // TODO: do binary exponentiation let mut poly = FactorizedRationalPolynomial { numerator: self.numerator.constant(self.numerator.ring.one()), numer_coeff: self.numerator.ring.one(), @@ -572,11 +572,11 @@ where fn pow(&self, b: &Self::Element, e: u64) -> Self::Element { if e > u32::MAX as u64 { - panic!("Power of exponentation is larger than 2^32: {}", e); + panic!("Power of exponentiation is larger than 2^32: {}", e); } let e = e as u32; - // TODO: do binary exponentation + // TODO: do binary exponentiation let mut poly = FactorizedRationalPolynomial { numerator: b.numerator.constant(self.ring.one()), numer_coeff: self.ring.one(), diff --git a/src/domains/integer.rs b/src/domains/integer.rs index fc4e750..9373456 100644 --- a/src/domains/integer.rs +++ b/src/domains/integer.rs @@ -537,7 +537,7 @@ impl Integer { pub fn pow(&self, e: u64) -> Integer { if e > u32::MAX as u64 { - panic!("Power of exponentation is larger than 2^32: {}", e); + panic!("Power of exponentiation is larger than 2^32: {}", e); } let e = e as u32; @@ -1947,7 +1947,7 @@ impl Ring for MultiPrecisionIntegerRing { #[inline] fn pow(&self, b: &Self::Element, e: u64) -> Self::Element { if e > u32::MAX as u64 { - panic!("Power of exponentation is larger than 2^32: {}", e); + panic!("Power of exponentiation is larger than 2^32: {}", e); } b.clone().pow(e as u32) } diff --git a/src/domains/rational_polynomial.rs b/src/domains/rational_polynomial.rs index c509a9c..1c20c2a 100644 --- a/src/domains/rational_polynomial.rs +++ b/src/domains/rational_polynomial.rs @@ -315,11 +315,11 @@ where pub fn pow(&self, e: u64) -> Self { if e > u32::MAX as u64 { - panic!("Power of exponentation is larger than 2^32: {}", e); + panic!("Power of exponentiation is larger than 2^32: {}", e); } let e = e as u32; - // TODO: do binary exponentation + // TODO: do binary exponentiation let mut poly = RationalPolynomial { numerator: self.numerator.one(), denominator: self.denominator.one(), @@ -551,11 +551,11 @@ where fn pow(&self, b: &Self::Element, e: u64) -> Self::Element { if e > u32::MAX as u64 { - panic!("Power of exponentation is larger than 2^32: {}", e); + panic!("Power of exponentiation is larger than 2^32: {}", e); } let e = e as u32; - // TODO: do binary exponentation + // TODO: do binary exponentiation let mut poly = RationalPolynomial { numerator: b.numerator.zero(), denominator: b.denominator.zero(), diff --git a/src/evaluate.rs b/src/evaluate.rs index 1470298..a03658c 100644 --- a/src/evaluate.rs +++ b/src/evaluate.rs @@ -2452,7 +2452,7 @@ impl EvalTree { } impl EvalTree { - /// Find a near-optimal Horner scheme that minimzes the number of multiplications + /// Find a near-optimal Horner scheme that minimizes the number of multiplications /// and additions, using `iterations` iterations of the optimization algorithm /// and `n_cores` cores. Optionally, a starting scheme can be provided. pub fn optimize( @@ -2489,7 +2489,7 @@ impl EvalTree { } } - /// Find a near-optimal Horner scheme that minimzes the number of multiplications + /// Find a near-optimal Horner scheme that minimizes the number of multiplications /// and additions, using `iterations` iterations of the optimization algorithm /// and `n_cores` cores. Optionally, a starting scheme can be provided. pub fn optimize_horner_scheme( diff --git a/src/parser.rs b/src/parser.rs index b61c1df..63b53a3 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1278,7 +1278,7 @@ impl Token { } } - // contruct a new term + // construct a new term poly.append_monomial(coeff, &exponents); if input.is_empty() { diff --git a/src/poly/gcd.rs b/src/poly/gcd.rs index 3e92c2b..b57bbcb 100755 --- a/src/poly/gcd.rs +++ b/src/poly/gcd.rs @@ -2084,7 +2084,7 @@ impl MultivariatePolynomial { return gcd; } - // remove the content from the gcd before the divison test as the odds + // remove the content from the gcd before the division test as the odds // of an unlucky content are high let content = gcd.content(); gcd = gcd.div_coeff(&content); diff --git a/symbolica.pyi b/symbolica.pyi index 9a9b7d2..09eaa7a 100644 --- a/symbolica.pyi +++ b/symbolica.pyi @@ -2089,7 +2089,7 @@ class TermStreamer: """Check if the term stream fits in memory.""" def push(self, expr: Expression) -> None: - """Push an expresssion to the term stream.""" + """Push an expression to the term stream.""" def normalize(self) -> None: """Sort and fuse all terms in the stream.""" @@ -2115,7 +2115,7 @@ class MatchIterator: class ReplaceIterator: - """An iterator over single replacments.""" + """An iterator over single replacements.""" def __iter__(self) -> ReplaceIterator: """Create the iterator.""" @@ -3417,7 +3417,7 @@ class NumericalIntegrator: class Sample: """A sample from the Symbolica integrator. It could consist of discrete layers, - accessible with `d` (empty when there are not discrete layers), and the final continous layer `c` if it is present.""" + accessible with `d` (empty when there are not discrete layers), and the final continuous layer `c` if it is present.""" """ The weights the integrator assigned to this sample point, given in descending order: first the discrete layer weights and then the continuous layer weight.""" @@ -3500,7 +3500,7 @@ class Graph: ---------- external_nodes: Sequence[tuple[Expression | int, Expression | int]] The external edges, consisting of a tuple of the node data and the edge data. - If the node data is the same, flip symmetries will be recongized. + If the node data is the same, flip symmetries will be recognized. vertex_signatures: Sequence[Sequence[Expression | int]] The allowed connections for each vertex. max_vertices: int, optional