WarmStart lists the initial guesses of the Krylov methods for a
LinearCache solved repeatedly, passed as KrylovJL_GMRES(warm_start = WarmStart$Hegedus): Auto and None start from zero, Previous from the
previous solution and Hegedus from the previous solution rescaled to
minimize the initial residual (used only when it halves the residual). The
stopping threshold stays the one of a cold start.
Usage
WarmStart
NonstructuralZeros
PartitionedSolversAlgorithm(solver = NULL, ...)
update_gamma(cache, gamma)
supernodal_panel_solve(W, B, np, operation, algorithm = "auto")
supernodal_panel_solve_backend(algorithm, W, B, np, operation)
slate_isavailable(libpath = NULL)
show_algorithm_choices()Arguments
- solver
A Krylov method name, or
NULLfor the direct solver.- ...
Options of the solver.
- cache
A
LinearCachefrominit().- gamma
The new shift.
- W
A panel whose leading
npbynpblock holds the factors.- B
The right-hand side panel.
- np
The width of the diagonal block.
- operation
The triangular operation.
- algorithm
The backend.
- libpath
Ignored; the path of a SLATE library.
Value
WarmStart and NonstructuralZeros are lists of names;
PartitionedSolversAlgorithm() a linear algorithm; update_gamma() the
cache; the panel solves the updated B; slate_isavailable() a logical;
show_algorithm_choices() is called for its output.
Details
NonstructuralZeros tells OperatorAssumptions() how stored zeros of a
sparse matrix behave over a sequence of solves: None keeps the matrix,
Present and Persistent drop the stored zeros of each matrix, and Auto
(the default) drops them when at least a tenth of the stored entries are
zero. The direct solvers of R factorize sparse matrices as dense ones, so
the option is recorded in the assumptions without changing the solution.
PartitionedSolversAlgorithm(solver) is the algorithm of
PartitionedSolvers.jl: the default solver is a direct LU solve, and
solver = "cg" (or another Krylov method name) an iterative one.
update_gamma(cache, gamma) sets the gamma of the WOperator of a
LinearCache (the system matrix J - M / gamma) and invalidates the
cached factorization.
supernodal_panel_solve(W, B, np, operation, algorithm) applies a
triangular solve with the factored diagonal block W[1:np, 1:np] of a
supernodal LU panel to B and returns the result: "factor_right_upper"
(B / U11), "factor_lower" and "lower" (L11 \ B, unit lower) and
"upper" (U11 \ B). supernodal_panel_solve_backend() runs one backend
("kernel", column oriented substitution; "blas" and
"triangularsolve", the triangular solves of R); "auto" picks the kernel
for blocks up to 256 wide or a single column, as LinearSolve.
slate_isavailable() is TRUE: SLATEFactorization() runs as an LU
factorization in R. show_algorithm_choices() prints the default
algorithm for dense square matrices of several sizes.
Examples
A <- diag(4) + 0.1; b <- 1:4
cache <- init(LinearProblem(A, b), KrylovJL_GMRES(warm_start = WarmStart$Hegedus))
solve_integrator(cache)$u
#> [1] 0.2857143 1.2857143 2.2857143 3.2857143
solve(LinearProblem(A, b), PartitionedSolversAlgorithm("cg"))$u
#> [1] 0.2857143 1.2857143 2.2857143 3.2857143
W <- matrix(c(2, 0.5, 1, 3), 2)
supernodal_panel_solve(W, matrix(1:4, 2), 2, "upper")
#> [,1] [,2]
#> [1,] 0.1666667 0.8333333
#> [2,] 0.6666667 1.3333333
OperatorAssumptions(TRUE, nonstructural_zeros = NonstructuralZeros$Present)$nonstructural_zeros
#> [1] "Present"