Skip to content

Commit

Permalink
More typos, part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Nicodemus committed Jan 14, 2025
1 parent 36668be commit 6281024
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ skip = '.git*,*.css,pyproject.toml,data,swc,*.swc,obj,*.obj,*.pyi,*.c'
check-hidden = true
# embedded images into jupyter notebooks, acronyms and names starting with capital letter
ignore-regex = '(^\s*"image/\S+": ".*|\b([A-Z][a-zA-Z]+|scl/fo/|ser: Series|ot\.lp|networkx\.algorithms\.mis)\b)'
ignore-words-list = 'coo,ot'
ignore-words-list = 'coo,ot,thi'
28 changes: 14 additions & 14 deletions src/cajal/ugw/lib/github.com/diku-dk/containers/array.fut
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import "../sorts/merge_sort"

module engine = xorshift128plus
type rng = xorshift128plus.rng

local def estimate_distinct' [n] 't
(r: rng)
(hash: i64 -> t -> i64)
Expand All @@ -26,7 +26,7 @@ local def estimate_distinct' [n] 't
-- Multiply by two for a better estimate in cases of collisions.
-- Since roughly half of the keys are expected to result in a collision.
in (new_rng, 2 * count)

local def create_sample [n] 't
(arr: [n]t)
(rng: rng)
Expand All @@ -52,7 +52,7 @@ local def estimate_distinct [n] 't
(arr: [n]t):
(rng, i64) =
let (new_rng, count) =
loop (rng, acc) = (rng, 0) for _i < times do
loop (rng, acc) = (rng, 0) for _i < times do
let (rng, sample) = create_sample arr rng sample_size
let (rng, c) = estimate_distinct' rng hash sample
in (rng, acc + c / times)
Expand All @@ -61,7 +61,7 @@ local def estimate_distinct [n] 't
in (new_rng, estimate)

-- | `reduce_by_key`@term, but paramatized. Here an initial `seed`@term
-- for a random number generater needed. And a `sample_fraction`@term
-- for a random number generator needed. And a `sample_fraction`@term
-- will be needed to determine the amount that will be sampled in each
-- iteration. This is used to estimate the number of distinct
-- elements. A `sample_fraction`@term of 2 will sample half of the pairs in that iteration
Expand All @@ -76,7 +76,7 @@ def reduce_by_key_param [n] 'k 'v
(eq: k -> k -> bool)
(ne: v)
(op: v -> v -> v)
(arr: [n](k, v)): [](k, v) =
(arr: [n](k, v)): [](k, v) =
let r = engine.rng_from_seed [seed]
let (reduction, _, _) =
-- Expected number of iterations is O(log n).
Expand Down Expand Up @@ -117,7 +117,7 @@ def dedup_param [n] 't
(times: i64)
(hash: i64 -> t -> i64)
(eq: t -> t -> bool)
(arr: [n]t): []t =
(arr: [n]t): []t =
let r = engine.rng_from_seed [seed]
let (uniques, _, _) =
loop (uniques, elems, old_rng) = ([], arr, r) while length elems != 0 do
Expand Down Expand Up @@ -158,7 +158,7 @@ def hash_i64 (a: i64) (x: i64): i64 =
-- some array it can instead correspond to a key. Here an array of `n`@term
-- key `k`@term and value `v`@term pairs are given as an array. And
-- every value with the same key will be reduced with an associative
-- and commutative operator `op`@term, futhermore an neutral element `ne`@term
-- and commutative operator `op`@term, furthermore an neutral element `ne`@term
-- must be given. To perform this reduction a definition of key
-- equality must be given `eq`@term, this is done as to figure out which
-- elements will be reduced. And a good hash function `hash`@term must be
Expand Down Expand Up @@ -189,14 +189,14 @@ def dedup [n] 't
(eq: t -> t -> bool)
(arr: [n]t): []t =
dedup_param 1 1024 5 hash eq arr

local def hash_i32 a x = hash_i64 a (i64.i32 x)

local entry replicate_i32 (n: i64) (m: i32): [n]i32 =
replicate n m
replicate n m

local entry replicate_i64 (n: i64) (m: i64): [n]i64 =
replicate n m
replicate n m

-- ==
-- entry: bench_dedup
Expand All @@ -220,7 +220,7 @@ local entry bench_dedup [n] (arr: [n]i32) =
local entry bench_dedup_mod [n] (arr: [n]i32) =
dedup hash_i32 (==) (map (% 40000) arr)


-- ==
-- entry: bench_count_occourences_i32
-- compiled random input { [100000]i32 }
Expand All @@ -244,7 +244,7 @@ local entry bench_count_occourences_i32 [n] (arr: [n]i32) =
local entry bench_count_occourences_mod_i32 [n] (arr: [n]i32) =
reduce_by_key hash_i32 (==) 0i32 (+) <| map (\a -> (a % 40000, 1)) arr
|> map (.0)


-- Contains code from the segmented library.
-- https://github.com/diku-dk/segmented
Expand Down Expand Up @@ -293,7 +293,7 @@ local entry bench_count_occourences_i64 [n] (arr: [n]i64) =
local entry bench_count_occourences_mod_i64 [n] (arr: [n]i64) =
reduce_by_key hash_i64 (==) 0i64 (+) <| map (\a -> (a % 40000, 1)) arr
|> map (.0)

-- Contains code from the segmented library.
-- https://github.com/diku-dk/segmented
-- ==
Expand All @@ -317,4 +317,4 @@ local entry bench_count_occourences_radix_sort_and_segscan_i64 [n] (arr: [n]i64)
let index i f = if f then i-1 else -1
in scatter scratch (map2 index segment_end_offsets segment_ends) as
|> map (.0)

22 changes: 11 additions & 11 deletions src/cajal/ugw/lib/github.com/diku-dk/containers/bitset.fut
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- A bitset data structure is an array of bits where a bit
-- can be set or not set. If the bit is set then it is a
-- member of the set otherwise it is not. The indexes of
-- these bits can then be related to the indexes of
-- these bits can then be related to the indexes of
-- another array.
--
-- `nbs`@term is assumed to be constant in the time
Expand Down Expand Up @@ -122,7 +122,7 @@ module type bitset = {
val to_array [n] : bitset[(n - 1) / nbs + 1] -> []i64
}

-- | Creates a bitset module depending on a intergral type.
-- | Creates a bitset module depending on a integral type.
module mk_bitset (I: integral) : bitset = {
def nbs = i64.i32 I.num_bits

Expand All @@ -131,10 +131,10 @@ module mk_bitset (I: integral) : bitset = {
type bitset [n] = [n]t

def zero : t = I.u64 0

def empty (n : i64) : bitset[(n - 1) / nbs + 1] =
replicate ((n - 1) / nbs + 1) zero

def find_bitset_index (i : i64) (n : i64) : (i64, i32) =
if i < 0 || n <= i
then (-1, -1)
Expand All @@ -158,7 +158,7 @@ module mk_bitset (I: integral) : bitset = {

def is_empty [n] (s : bitset[(n - 1) / nbs + 1]) : bool =
all (I.==zero) s

def delete [n] (i : i64) (s : bitset[(n - 1) / nbs + 1]) : bitset[(n - 1) / nbs + 1] =
let index = find_bitset_index i n
in if index.0 < 0 || index.1 < 0
Expand All @@ -173,7 +173,7 @@ module mk_bitset (I: integral) : bitset = {

def union [n] (a : bitset[(n - 1) / nbs + 1]) (b : bitset[(n - 1) / nbs + 1]) : bitset[(n - 1) / nbs + 1] =
map2 (I.|) a b

def intersection [n] (a : bitset[(n - 1) / nbs + 1]) (b : bitset[(n - 1) / nbs + 1]) : bitset[(n - 1) / nbs + 1] =
map2 (I.&) a b

Expand All @@ -184,11 +184,11 @@ module mk_bitset (I: integral) : bitset = {
in if l == 0
then s
else copy s with [l - 1] = s[l - 1] I.& to_keep

def complement [n] (s : bitset[(n - 1) / nbs + 1]) : bitset[(n - 1) / nbs + 1] =
map I.not s
|> set_leading_bits_zero

def size [n] (s : bitset[(n - 1) / nbs + 1]) : i64 =
map (i64.i32 <-< I.popc) s
|> i64.sum
Expand All @@ -199,10 +199,10 @@ module mk_bitset (I: integral) : bitset = {

def is_subset [n] (a : bitset[(n - 1) / nbs + 1]) (b : bitset[(n - 1) / nbs + 1]) : bool =
(a `union` b) == b

def difference [n] (a : bitset[(n - 1) / nbs + 1]) (b : bitset[(n - 1) / nbs + 1]) : bitset[(n - 1) / nbs + 1] =
a `intersection` complement b

def set_capacity [m] (n : i64) (s : bitset[(m - 1) / nbs + 1]) : bitset[(n - 1) / nbs + 1] =
let s' = empty n
let len = length s
Expand All @@ -221,7 +221,7 @@ module mk_bitset (I: integral) : bitset = {
let empty' = empty n
in map (singleton n) arr
|> reduce_comm union empty'

def to_array [n] (s : bitset[(n - 1) / nbs + 1]) : []i64 =
map2 (\i v ->
let m = i * i64.i32 I.num_bits
Expand Down
2 changes: 1 addition & 1 deletion src/cajal/ugw/lib/github.com/diku-dk/containers/opt.fut
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

-- | The `opt`@term type
--
-- A `opt`@term type is a sum type. It is either `#some` containg a
-- A `opt`@term type is a sum type. It is either `#some` containing a
-- value `a`@term or `#none`.
type opt 'a = #some a | #none

Expand Down
2 changes: 1 addition & 1 deletion src/cajal/ugw/lib/github.com/diku-dk/cpprandom/random.fut
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
--
-- Since both `dist` and `norm_dist` have been initialised with the
-- same underlying `rng_engine`@mtype (`minstd_rand`@term), we can
-- re-use the same RNG state. This is often convenient when a program
-- reuse the same RNG state. This is often convenient when a program
-- needs to generate random numbers from several different
-- distributions, as we still only have to manage a single RNG state.
--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def segmented_iota [n] (flags:[n]bool) : [n]i64 =
in map (\x -> x-1) iotas

-- | Replicated and segmented iota generated together
-- in a slighly more efficient way.
-- in a slightly more efficient way.
-- each segment in the segmented iota corresponds to a segment
-- in the replicated iota. As an example repl_segm_iota [2,3,1]
-- returns the arrays [0,0,1,1,1,2] and [0,1,0,1,2,0].
Expand Down

0 comments on commit 6281024

Please sign in to comment.