Julia interface to hypre linear solvers (https://github.com/hypre-space/hypre)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

23 lines
867 B

# SPDX-License-Identifier: MIT
using HYPRE
using HYPRE.LibHYPRE
using HYPRE.LibHYPRE: @check
function getindex_debug(A::HYPREMatrix, i::AbstractVector, j::AbstractVector)
nrows = HYPRE_Int(length(i))
ncols = fill(HYPRE_Int(length(j)), length(i))
rows = convert(Vector{HYPRE_BigInt}, i)
cols = convert(Vector{HYPRE_BigInt}, repeat(j, length(i)))
values = Vector{HYPRE_Complex}(undef, length(i) * length(j))
@check HYPRE_IJMatrixGetValues(A.ijmatrix, nrows, ncols, rows, cols, values)
return permutedims(reshape(values, (length(j), length(i))))
end
function getindex_debug(b::HYPREVector, i::AbstractVector)
nvalues = HYPRE_Int(length(i))
indices = convert(Vector{HYPRE_BigInt}, i)
values = Vector{HYPRE_Complex}(undef, length(i))
@check HYPRE_IJVectorGetValues(b.ijvector, nvalues, indices, values)
return values
end