next up previous contents
Next: 3.5 CG Module Up: 3. JTpack90 Previous: 3.3 JTpack90 Design   Contents

3.4 ELL ``Class'' Module

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


next up previous contents
Next: 3.5 CG Module Up: 3. JTpack90 Previous: 3.3 JTpack90 Design   Contents
John A. Turner