Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name = "ExtendableSparse"
uuid = "95c220a8-a1cf-11e9-0c77-dbfce5f500b3"
authors = ["Juergen Fuhrmann <juergen.fuhrmann@wias-berlin.de>"]
version = "1.4"
version = "1.4.0"

[deps]
AMGCLWrap = "4f76b812-4ba5-496d-b042-d70715554288"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
ILUZero = "88f59080-6952-5380-9ea5-54057fb9a43f"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Metis = "2679e427-3c69-5b7f-982b-ece356f1e94b"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Expand Down
39 changes: 29 additions & 10 deletions src/ExtendableSparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ using LinearAlgebra
using Sparspak
using ILUZero

using Metis
using Base.Threads

if !isdefined(Base, :get_extension)
using Requires
end
Expand All @@ -16,7 +19,6 @@ if USE_GPL_LIBS
using SuiteSparse
end


using DocStringExtensions

import SparseArrays: AbstractSparseMatrixCSC, rowvals, getcolptr, nonzeros
Expand All @@ -25,16 +27,40 @@ include("matrix/sparsematrixcsc.jl")
include("matrix/sparsematrixlnk.jl")
include("matrix/extendable.jl")

export SparseMatrixLNK,
ExtendableSparseMatrix, flush!, nnz, updateindex!, rawupdateindex!, colptrs, sparse
export SparseMatrixLNK, ExtendableSparseMatrix, flush!, nnz, updateindex!, rawupdateindex!, colptrs, sparse, reset!

export eliminate_dirichlet, eliminate_dirichlet!, mark_dirichlet


#@warn "ESMP!"
include("matrix/ExtendableSparseMatrixParallel/ExtendableSparseParallel.jl")



include("factorizations/ilu_Al-Kurdi_Mittal.jl")
#using .ILUAM
include("factorizations/pilu_Al-Kurdi_Mittal.jl")
#using .PILUAM
include("factorizations/factorizations.jl")

include("factorizations/simple_iteration.jl")
export simple, simple!

include("matrix/sprand.jl")
export sprand!, sprand_sdd!, fdrand, fdrand!, fdrand_coo, solverbenchmark




export ExtendableSparseMatrixParallel, SuperSparseMatrixLNK
export addtoentry!, reset!, dummy_assembly!, preparatory_multi_ps_less_reverse, fr, addtoentry!, rawupdateindex!, updateindex!, compare_matrices_light


export JacobiPreconditioner,
ILU0Preconditioner,
ILUZeroPreconditioner,
ILUAMPreconditioner,
PILUAMPreconditioner,
PointBlockILUZeroPreconditioner,
ParallelJacobiPreconditioner,
ParallelILU0Preconditioner,
Expand All @@ -45,13 +71,6 @@ export AbstractFactorization, LUFactorization, CholeskyFactorization, SparspakLU
export issolver
export factorize!, update!

include("factorizations/simple_iteration.jl")
export simple, simple!

include("matrix/sprand.jl")
export sprand!, sprand_sdd!, fdrand, fdrand!, fdrand_coo, solverbenchmark


@static if !isdefined(Base, :get_extension)
function __init__()
@require Pardiso = "46dd5b70-b6fb-5a00-ae2d-e8fea33afaf2" begin
Expand Down
117 changes: 78 additions & 39 deletions src/factorizations/factorizations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,52 @@ Determine if factorization is a solver or not
issolver(::AbstractLUFactorization) = true
issolver(::AbstractPreconditioner) = false



""""
@makefrommatrix(fact)

For an AbstractFactorization `MyFact`, provide methods
```
MyFact(A::ExtendableSparseMatrix; kwargs...)
MyFact(A::SparseMatrixCSC; kwargs...)
```
"""
macro makefrommatrix(fact)
return quote
function $(esc(fact))(A::ExtendableSparseMatrix; kwargs...)
factorize!($(esc(fact))(;kwargs...), A)
end
function $(esc(fact))(A::SparseMatrixCSC; kwargs...)
$(esc(fact))(ExtendableSparseMatrix(A); kwargs...)
end
end
end

include("ilu0.jl")
include("iluzero.jl")
include("iluam.jl")
include("piluam.jl")
include("parallel_jacobi.jl")
include("parallel_ilu0.jl")
include("sparspak.jl")
include("blockpreconditioner.jl")
include("jacobi.jl")

@eval begin
@makefrommatrix ILU0Preconditioner
@makefrommatrix ILUZeroPreconditioner
@makefrommatrix ILUAMPreconditioner
@makefrommatrix PILUAMPreconditioner
@makefrommatrix PointBlockILUZeroPreconditioner
@makefrommatrix JacobiPreconditioner
@makefrommatrix ParallelJacobiPreconditioner
@makefrommatrix ParallelILU0Preconditioner
@makefrommatrix SparspakLU
@makefrommatrix UpdateteableBlockpreconditioner
@makefrommatrix BlockPreconditioner
end

"""
```
factorize!(factorization, matrix)
Expand All @@ -65,8 +111,40 @@ function factorize!(p::AbstractFactorization, A::ExtendableSparseMatrix)
p
end

function factorize!(p::PILUAMPreconditioner, A::ExtendableSparseMatrixParallel)
p.A = A
update!(p)
p
end

#function factorize!(p::AbstractFactorization, A::ExtendableSparseMatrixParallel)
# p.A = A
# update!(p)
# p
#end

#factorize!(p::AbstractFactorization, A::ExtendableSparseMatrixParallel)=factorize!(p,ExtendableSparseMatrix(A.cscmatrix))

#factorize!(p::PILUAMPrecon, A::ExtendableSparseMatrixParallel)=factorize!(p,ExtendableSparseMatrix(A.cscmatrix))

factorize!(p::AbstractFactorization, A::SparseMatrixCSC)=factorize!(p,ExtendableSparseMatrix(A))

#function factorize!(p::PILUAMPrecon, A::ExtendableSparseMatrixParallel)
# factorize!(p, A)
#end

#function factorize!(p::AbstractFactorization, A::ExtendableSparseMatrixParallel)
# factorize!(p, A.cscmatrix)
#end


#function factorize!(p::AbstractFactorization, A::ExtendableSparseMatrix)
# factorize!(p, A.cscmatrix)
#end


#factorize!(p::PILUAMPrecon, A::ExtendableSparseMatrixParallel)=factorize!(p,A)

"""
```
lu!(factorization, matrix)
Expand Down Expand Up @@ -134,45 +212,6 @@ LinearAlgebra.ldiv!(fact::AbstractFactorization, v) = ldiv!(fact.factorization,



""""
@makefrommatrix(fact)

For an AbstractFactorization `MyFact`, provide methods
```
MyFact(A::ExtendableSparseMatrix; kwargs...)
MyFact(A::SparseMatrixCSC; kwargs...)
```
"""
macro makefrommatrix(fact)
return quote
function $(esc(fact))(A::ExtendableSparseMatrix; kwargs...)
factorize!($(esc(fact))(;kwargs...), A)
end
function $(esc(fact))(A::SparseMatrixCSC; kwargs...)
$(esc(fact))(ExtendableSparseMatrix(A); kwargs...)
end
end
end

include("jacobi.jl")
include("ilu0.jl")
include("iluzero.jl")
include("parallel_jacobi.jl")
include("parallel_ilu0.jl")
include("sparspak.jl")
include("blockpreconditioner.jl")

@eval begin
@makefrommatrix ILU0Preconditioner
@makefrommatrix ILUZeroPreconditioner
@makefrommatrix PointBlockILUZeroPreconditioner
@makefrommatrix JacobiPreconditioner
@makefrommatrix ParallelJacobiPreconditioner
@makefrommatrix ParallelILU0Preconditioner
@makefrommatrix SparspakLU
@makefrommatrix UpdateteableBlockpreconditioner
@makefrommatrix BlockPreconditioner
end

if USE_GPL_LIBS
#requires SuiteSparse which is not available in non-GPL builds
Expand Down
Loading