Skip to content

Commit

Permalink
Merge pull request #42 from jpthiele/codespell
Browse files Browse the repository at this point in the history
Add and apply codespell config
  • Loading branch information
j-fu authored Nov 20, 2024
2 parents 312b1ed + d60da29 commit c56b241
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[codespell]
ignore-words-list = missings,rcall,linke,fo,COO,alledges
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Breaking
- remove solver + precon API which is not based on precs or directly overloading `\`.
Fully rely on LinearSolve (besides `\`)
- Move AMGBuilder, ILUZeroBuilder etc. to the correspondig packages (depending on the PRs)
- Move AMGBuilder, ILUZeroBuilder etc. to the corresponding packages (depending on the PRs)
- remove "old" SparseMatrixLNK (need to benchmark before)

## [1.6.0] - 2024-11-10
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ With the advent of LinearSolve.jl, this functionality probably will be reduced t
### Interfaces to other packages

The package directly provides interfaces to other sparse matrix solvers and preconditioners. Dependencies on these
packages are handeled via [Requires.jl](https://github.com/JuliaPackaging/Requires.jl).
packages are handled via [Requires.jl](https://github.com/JuliaPackaging/Requires.jl).
Currently, support includes:

- [Pardiso.jl](https://github.com/JuliaSparse/Pardiso.jl) (both ["project Pardiso"](https://pardiso-project.org)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ and assemble it into the global one.
The code uses the index access API for the creation of the matrix,
inserting elements via `A[i,j]+=v`,
using an intermediate linked list structure which upon return
ist flushed into a SparseMatrixCSC structure.
is flushed into a SparseMatrixCSC structure.

```@example 1
@belapsed fdrand(30, 30, 30, matrixtype = ExtendableSparseMatrix)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/iter.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Private = false

Handling of the LU factorizations is meant to support
a workflow where sequences of problems are solved based
on the same matrix, where one possibly wants to re-use
on the same matrix, where one possibly wants to reuse
existing symbolic factorization data.

The support comes in two flavors.
Expand Down
4 changes: 2 additions & 2 deletions docs/src/linearsolve.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sum(y)
```

This works as well for number types besides `Float64` and related, in this case,
by default a LU factorization based on Sparspak ist used.
by default a LU factorization based on Sparspak is used.

```@example
using ExtendableSparse
Expand Down Expand Up @@ -77,7 +77,7 @@ sum(y)
```

## Available preconditioners
ExtendableSparse provides constructors for preconditioners wich can be used as `precs`.
ExtendableSparse provides constructors for preconditioners which can be used as `precs`.
These generally return a tuple `(Pl,I)` of a left preconditioner and a trivial right preconditioner.

ExtendableSparse has a number of package extensions which construct preconditioners
Expand Down
18 changes: 9 additions & 9 deletions src/experimental/ExtendableSparseMatrixParallel/preparatory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
`nm` is the number of nodes in each dimension (Examples: 2d: nm = (100,100) -> 100 x 100 grid, 3d: nm = (50,50,50) -> 50 x 50 x 50 grid).
`nt` is the number of threads.
`depth` is the number of partition layers, for depth=1, there are nt parts and 1 separator, for depth=2, the separator is partitioned again, leading to 2*nt+1 submatrices...
To assemble the system matrix parallely, things such as `cellsforpart` (= which thread takes which cells) need to be computed in advance. This is done here.
To assemble the system matrix parallelly, things such as `cellsforpart` (= which thread takes which cells) need to be computed in advance. This is done here.
This should be somewhere else, longterm
"""
Expand Down Expand Up @@ -58,7 +58,7 @@ end
`function get_nnnts_and_sortednodesperthread_and_noderegs_from_cellregs_ps_less_reverse_nopush(cellregs, allcells, start, nn, Ti, nt)`
After the cellregions (partitioning of the grid) of the grid have been computed, other things have to be computed, such as `sortednodesperthread` a depth+1 x num_nodes matrix, here `sortednodesperthreads[i,j]` is the point at which the j-th node appears in the i-th level matrix in the corresponding submatrix.
`cellregs` contains the partiton for each cell.
`cellregs` contains the partition for each cell.
Furthermore, `nnts` (number of nodes of the threads) is computed, which contain for each thread the number of nodes that are contained in the cells of that thread.
`allcells` and `start` together behave like the rowval and colptr arrays of a CSC matrix, such that `allcells[start[j]:start[j+1]-1]` are all cells that contain the j-th node.
`nn` is the number of nodes in the grid.
Expand Down Expand Up @@ -172,7 +172,7 @@ end
"""
`function separate!(cellregs, nc, ACSC, nt, level0, ctr_sepanodes)`
This function partitons the separator, which is done if `depth`>1 (see `grid_to_graph_ps_multi!` and/or `preparatory_multi_ps`).
This function partitions the separator, which is done if `depth`>1 (see `grid_to_graph_ps_multi!` and/or `preparatory_multi_ps`).
`cellregs` contains the regions/partitions/colors of each cell.
`nc` is the number of cells in the grid.
`ACSC` is the adjacency matrix of the graph of the (separator-) grid (vertex in graph is cell in grid, edge in graph means two cells share a node) stored as a CSC.
Expand Down Expand Up @@ -217,7 +217,7 @@ function separate!(cellregs, ACSC, nt, level0, ctr_sepanodes, ri, gi, do_print)
cellregs[gi[i]] = level0*nt + cellregs2[i]
end

# how many cells are in the separator of the new partiton (which is only computed on the separator of the old partition)
# how many cells are in the separator of the new partition (which is only computed on the separator of the old partition)
new_ctr_sepanodes = 0
ri2 = Vector{Int64}(undef, ctr_sepanodes)
gi2 = Vector{Int64}(undef, ctr_sepanodes)
Expand Down Expand Up @@ -255,7 +255,7 @@ end
"""
`function grid_to_graph_ps_multi_nogrid!(nc, nn, mat_cell_node, nt, depth)`
The function assigns colors/partitons to each cell in the `grid`. First, the grid is partitoned into `nt` partitions. If `depth` > 1, the separator is partitioned again...
The function assigns colors/partitions to each cell in the `grid`. First, the grid is partitioned into `nt` partitions. If `depth` > 1, the separator is partitioned again...
The grid is specified by nc (number of cells), nn (number of nodes) and the mat_cell_node (i.e. grid[CellNodes] if ExtendableGrids is used).
Here, `mat_cell_node[k,i]` is the i-th node in the k-th cell.
`nt` is the number of threads.
Expand Down Expand Up @@ -689,24 +689,24 @@ end
"""
`function add_all_par!(As)`
Add LNK matrices (stored in a vector) parallely (tree structure).
Add LNK matrices (stored in a vector) parallelly (tree structure).
The result is stored in the first LNK matrix.
"""
function add_all_par!(As)
nt = length(As)
depth = Int(floor(log2(nt)))
ende = nt
endpoint = nt
for level=1:depth

@threads for tid=1:2^(depth-level)
#@info "$level, $tid"
start = tid+2^(depth-level)
while start <= ende
while start <= endpoint
As[tid] += As[start]
start += 2^(depth-level)
end
end
ende = 2^(depth-level)
endpoint = 2^(depth-level)
end
As[1]

Expand Down
2 changes: 1 addition & 1 deletion src/factorizations/simple_iteration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function simple!(u,
res = A * u - b # initial residual
upd = similar(res)
r0 = norm(res) # residual norm
history = [r0] # intialize history recording
history = [r0] # initialize history recording
for i = 1:maxiter
ldiv!(upd, Pl, res)
u .-= upd # solve preconditioning system and update solution
Expand Down
4 changes: 2 additions & 2 deletions src/matrix/extendable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ end
"""
$(SIGNATURES)
Create similar but emtpy extendableSparseMatrix
Create similar but empty extendableSparseMatrix
"""
function Base.similar(m::ExtendableSparseMatrixCSC{Tv, Ti}) where {Tv, Ti}
ExtendableSparseMatrixCSC{Tv, Ti}(size(m)...)
Expand All @@ -136,7 +136,7 @@ $(SIGNATURES)
Update element of the matrix with operation `op`.
This can replace the following code and save one index
search during acces:
search during access:
```@example
using ExtendableSparse # hide
Expand Down
6 changes: 3 additions & 3 deletions src/matrix/sparsematrixcsc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ end
"""
$(SIGNATURES)
Update element of the matrix with operation `op` whithout
Update element of the matrix with operation `op` without
introducing new nonzero elements.
This can replace the following code and save one index
search during acces:
search during access:
```@example
using ExtendableSparse # hide
Expand Down Expand Up @@ -61,7 +61,7 @@ end
"""
$(SIGNATURES)
Trival flush! method for allowing to run the code with both `ExtendableSparseMatrix` and
Trivial flush! method for allowing to run the code with both `ExtendableSparseMatrix` and
`SparseMatrixCSC`.
"""
flush!(csc::SparseMatrixCSC) = csc
Expand Down
2 changes: 1 addition & 1 deletion src/matrix/sparsematrixdilnkc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ mutable struct SparseMatrixDILNKC{Tv, Ti <: Integer} <: AbstractSparseMatrixExte
rowval::Vector{Ti}

"""
Nonzero entry values correspondin to each pair
Nonzero entry values corresponding to each pair
(colptr[index],rowval[index])
"""
nzval::Vector{Tv}
Expand Down
2 changes: 1 addition & 1 deletion src/matrix/sparsematrixlnk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ mutable struct SparseMatrixLNK{Tv, Ti <: Integer} <: AbstractSparseMatrixExtensi
rowval::Vector{Ti}

"""
Nonzero entry values correspondin to each pair
Nonzero entry values corresponding to each pair
(colptr[index],rowval[index])
Initial length is n, it grows with each new entry.
Expand Down
4 changes: 2 additions & 2 deletions src/matrix/sprand.jl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ end
"""
$(SIGNATURES)
Create SparseMatrixCSC via COO intermedite arrrays
Create SparseMatrixCSC via COO intermedite arrays
"""

function fdrand_coo(T, nx, ny = 1, nz = 1; rand = () -> rand())
Expand Down Expand Up @@ -194,7 +194,7 @@ with ``d=1`` if `nx>1 && ny==1 && nz==1`, ``d=2`` if `nx>1 && ny>1 && nz==1` a
```math
\\begin{align*}
-\\nabla a \\nabla u &= f&& \\text{in}\\; \\Omega \\\\
a\\nabla u\\cdot \\vec n + bu &=g && \\text{on}\\; \\partial\\Omega
a\\nabla u\\cdot \\vec n + b u &=g && \\text{on}\\; \\partial\\Omega
\\end{align*}
```
Expand Down
4 changes: 2 additions & 2 deletions test/ExperimentalParallel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import ChunkSplitters

"""
Return colored partitioing of grid made up by `X` and `Y` for work with `max(nt,4)` threads
as a vector `p` of a vector pairs of index ranges such that `p[i]` containes partions
Return colored partitioning of grid made up by `X` and `Y` for work with `max(nt,4)` threads
as a vector `p` of a vector pairs of index ranges such that `p[i]` contains partitions
of color i which can be assembled independently.
The current algorithm creates `nt^2` partitions with `nt` colors.
Expand Down
2 changes: 1 addition & 1 deletion test/test_copymethods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function test(T)

if !(t1 / t0 < 10 && t0 / t2 < 10)
@warn """timing test failed.
If this occurs just once ot twice, it is probably due to CPU noise.
If this occurs just once or twice, it is probably due to CPU noise.
So we nevertheless count this as passing.
"""
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_parallel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function test_correctness_update(N,
for np in allnp
# Reset the nonzeros, keeping the structure intact
nonzeros(A) .= 0
# Parallel assembly whith np threads
# Parallel assembly with np threads
pgrid = partition(grid, Tp(; npart=np), nodes=true, keep_nodepermutation=true)
reset!(A, np)
@show num_partitions_per_color(pgrid)
Expand Down
2 changes: 1 addition & 1 deletion test/test_timings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function test(T, k, l, m)

if !(t3 < t2 < t1)
@warn """timing test failed for $T $k x $l x $m.
If this occurs just once ot twice, it is probably due to CPU noise.
If this occurs just once or twice, it is probably due to CPU noise.
So we nevertheless count this as passing.
"""
end
Expand Down

0 comments on commit c56b241

Please sign in to comment.