module JT_ELL_module
implicit none
type JT_ELL_matrix
real, dimension(:,:), pointer :: values
integer, dimension(:,:), pointer :: map
end type JT_ELL_matrix
interface MatMul
module procedure Ax
end interface
private
public :: JT_ELL_matrix, MatMul
contains
function Ax(a,x)
type(JT_ELL_matrix), intent(in) :: a
real, intent(in), dimension(:) :: x
real, dimension(SIZE(x)) :: Ax
integer :: j
Ax = zero
do j=1,SIZE(a%values, dim=2)
where (a%map(:,j) /= 0) Ax = Ax + a%values(:,j)*x(a%map(:,j))
end do
return
end function Ax
end module JT_ELL_module