Skip to content

Commit

Permalink
Fix minor typos (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhovd authored Oct 3, 2024
1 parent 09fc011 commit 91da5f5
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions src/api/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions src/combinatorics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ pub fn partitions<T: Ord + Hash + Copy, B: Ord + Hash + Copy>(

// compute the prefactor
let mut counter = vec![];
let mut bin_goups: HashMap<&(B, Vec<T>), usize> = HashMap::default();
let mut bin_groups: HashMap<&(B, Vec<T>), usize> = HashMap::default();
for (pref, sol) in &mut res {
for (e, _) in &element_sorted {
counter.clear();
Expand All @@ -345,10 +345,10 @@ pub fn partitions<T: Ord + Hash + Copy, B: Ord + Hash + Copy>(

// 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);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/domains/factorized_rational_polynomial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions src/domains/integer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
}
Expand Down
8 changes: 4 additions & 4 deletions src/domains/rational_polynomial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions src/evaluate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2452,7 +2452,7 @@ impl<T: Clone + Default + PartialEq> EvalTree<T> {
}

impl EvalTree<Rational> {
/// 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(
Expand Down Expand Up @@ -2489,7 +2489,7 @@ impl EvalTree<Rational> {
}
}

/// 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(
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ impl Token {
}
}

// contruct a new term
// construct a new term
poly.append_monomial(coeff, &exponents);

if input.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion src/poly/gcd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2084,7 +2084,7 @@ impl<E: Exponent> MultivariatePolynomial<IntegerRing, E> {
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);
Expand Down
8 changes: 4 additions & 4 deletions symbolica.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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."""
Expand Down Expand Up @@ -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."""
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 91da5f5

Please sign in to comment.