|
|
|
@ -6,7 +6,12 @@ Interface](https://hypre.readthedocs.io/en/latest/api-int-ij.html) which can be |
|
|
|
general sparse matrices. |
|
|
|
general sparse matrices. |
|
|
|
|
|
|
|
|
|
|
|
HYPRE.jl defines conversion methods from standard Julia datastructures to `HYPREMatrix` and |
|
|
|
HYPRE.jl defines conversion methods from standard Julia datastructures to `HYPREMatrix` and |
|
|
|
`HYPREVector`, respectively. |
|
|
|
`HYPREVector`, respectively. See the following sections for details: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```@contents |
|
|
|
|
|
|
|
Pages = ["hypre-matrix-vector.md"] |
|
|
|
|
|
|
|
MinDepth = 2 |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## PartitionedArrays.jl (multi-process) |
|
|
|
## PartitionedArrays.jl (multi-process) |
|
|
|
|
|
|
|
|
|
|
|
@ -15,11 +20,11 @@ HYPRE.jl integrates seemlessly with `PSparseMatrix` and `PVector` from the |
|
|
|
be passed directly to `solve` and `solve!`. Internally this will construct a `HYPREMatrix` |
|
|
|
be passed directly to `solve` and `solve!`. Internally this will construct a `HYPREMatrix` |
|
|
|
and `HYPREVector`s and then convert the solution back to a `PVector`. |
|
|
|
and `HYPREVector`s and then convert the solution back to a `PVector`. |
|
|
|
|
|
|
|
|
|
|
|
The `HYPREMatrix` constructor supports both `SparseMatrixCSC` and `SparseMatrixCSR` as |
|
|
|
The `HYPREMatrix` constructor support both `SparseMatrixCSC` and `SparseMatrixCSR` as |
|
|
|
storage backends for the `PSparseMatrix`. However, since HYPREs internal storage is also CSR |
|
|
|
storage backends for the `PSparseMatrix`. However, since HYPREs internal storage is also CSR |
|
|
|
based it can be *slightly* more resource efficient to use `SparseMatrixCSR`. |
|
|
|
based it can be *slightly* more resource efficient to use `SparseMatrixCSR`. |
|
|
|
|
|
|
|
|
|
|
|
The constructors also supports both PartitionedArrays.jl backends: When using the `MPI` |
|
|
|
The constructors also support both PartitionedArrays.jl backends: When using the `MPI` |
|
|
|
backend the communicator of the `PSparseMatrix`/`PVector` is used also for the |
|
|
|
backend the communicator of the `PSparseMatrix`/`PVector` is used also for the |
|
|
|
`HYPREMatrix`/`HYPREVector`, and when using the `Sequential` backend it is assumed to be a |
|
|
|
`HYPREMatrix`/`HYPREVector`, and when using the `Sequential` backend it is assumed to be a |
|
|
|
single-process setup, and the global communicator `MPI.COMM_WORLD` is used. |
|
|
|
single-process setup, and the global communicator `MPI.COMM_WORLD` is used. |
|
|
|
@ -68,9 +73,37 @@ copy!(x, x_h) |
|
|
|
|
|
|
|
|
|
|
|
## `SparseMatrixCSC` / `SparseMatrixCSR` (single-process) |
|
|
|
## `SparseMatrixCSC` / `SparseMatrixCSR` (single-process) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HYPRE.jl also support working directly with `SparseMatrixCSC` (from the |
|
|
|
|
|
|
|
[SparseArrays.jl](https://github.com/JuliaSparse/SparseArrays.jl) standard library) and |
|
|
|
|
|
|
|
`SparseMatrixCSR` (from the |
|
|
|
|
|
|
|
[SparseMatricesCSR.jl](https://github.com/gridap/SparseMatricesCSR.jl) package). This makes |
|
|
|
|
|
|
|
it possible to use solvers and preconditioners even for single-process problems. When using |
|
|
|
|
|
|
|
these type of spars matrices it is assumed that the right hand side and solution vectors are |
|
|
|
|
|
|
|
regular Julia `Vector`s. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Just like when using the PartitionedArrays.jl package, it is possible to pass sparse |
|
|
|
|
|
|
|
matrices directly to `solve` and `solve!`, but it is also possible to create `HYPREMatrix` |
|
|
|
|
|
|
|
and `HYPREVector` explicitly, possibly saving some resources when doing multiple consecutive |
|
|
|
|
|
|
|
linear solves (see previous section). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
**Example pseudocode** |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```julia |
|
|
|
|
|
|
|
A = SparseMatrixCSC(...) |
|
|
|
|
|
|
|
x = Vector(...) |
|
|
|
|
|
|
|
b = Vector(...) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Solve with zero initial guess |
|
|
|
|
|
|
|
x = solve(solver, A, b) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Inplace solve with x as initial guess |
|
|
|
|
|
|
|
x = zeros(length(b)) |
|
|
|
|
|
|
|
solve!(solver, x, A, b) |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## `SparseMatrixCSC` / `SparseMatrixCSR` (multi-process) |
|
|
|
## `SparseMatrixCSC` / `SparseMatrixCSR` (multi-process) |
|
|
|
|
|
|
|
|
|
|
|
!!! warning |
|
|
|
!!! warning |
|
|
|
This interface isn't finalized yet and is subject to change. |
|
|
|
This interface isn't finalized yet and is therefore not documented since it |
|
|
|
|
|
|
|
is subject to change. |
|
|
|
|