Skip to content

Commit

Permalink
Expose dense matrix pointer using bml_get_ptr_dense
Browse files Browse the repository at this point in the history
  • Loading branch information
mewall committed Jan 14, 2025
1 parent d766123 commit 84be6e9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/C-interface/dense/bml_getters_dense.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,10 @@ bml_get_diagonal_dense(
}
return NULL;
}

void *
bml_get_ptr_dense(
bml_matrix_dense_t * A)
{
return (void *)A->matrix;
}
6 changes: 6 additions & 0 deletions src/Fortran-interface/bml_c_interface_m.F90
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,12 @@ function bml_get_bandwidth_C(a) bind(C, name="bml_get_bandwidth")
type(C_PTR), value, intent(in) :: a
integer(C_INT) :: bml_get_bandwidth_C
end function bml_get_bandwidth_C

function bml_get_ptr_dense_C(a) bind(C, name="bml_get_ptr_dense")
import :: C_PTR
type(C_PTR), value, intent(in) :: a
type(C_PTR) :: bml_get_ptr_dense_C
end function bml_get_ptr_dense_C

function bml_get_sparsity_C(a, threshold) bind(C, name="bml_get_sparsity")
import :: C_PTR, C_DOUBLE, C_INT
Expand Down
10 changes: 9 additions & 1 deletion src/Fortran-interface/bml_getters_m.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module bml_getters_m
module procedure bml_get_diagonal_double_complex
end interface bml_get_diagonal

public :: bml_get_row, bml_get_diagonal
public :: bml_get_row, bml_get_diagonal, bml_get_ptr_dense

contains

Expand Down Expand Up @@ -189,4 +189,12 @@ subroutine bml_get_row_double_complex(a, i, row)

end subroutine bml_get_row_double_complex

function bml_get_ptr_dense(a)
type(bml_matrix_t), intent(inout) :: a
type(C_PTR) :: bml_get_ptr_dense

bml_get_ptr_dense = bml_get_ptr_dense_C(a%ptr)

end function bml_get_ptr_dense

end module bml_getters_m

0 comments on commit 84be6e9

Please sign in to comment.