13 integer(I4B),
pointer :: nrow
14 integer(I4B),
pointer :: ncol
15 integer(I4B),
pointer :: nja
16 integer(I4B),
dimension(:),
pointer,
contiguous :: ia
17 integer(I4B),
dimension(:),
pointer,
contiguous :: ja
18 real(dp),
dimension(:),
pointer,
contiguous :: amat
57 character(len=*) :: mem_path
59 integer(I4B) :: ierror
61 this%memory_path = mem_path
63 call this%allocate_scalars()
65 this%nrow = sparse%nrow
66 this%ncol = sparse%ncol
69 call this%allocate_arrays()
71 call sparse%filliaja(this%ia, this%ja, ierror, sort=.false.)
72 call this%zero_entries()
92 character(len=*) :: name
93 character(len=*) :: mem_path
99 call seq_vec%create_mm(n, name, mem_path)
112 call seq_vec%create(n)
122 value = this%amat(ipos)
129 real(dp) :: diag_value
131 diag_value = this%amat(this%ia(irow))
138 real(DP) :: diag_value
140 this%amat(this%ia(irow)) = diag_value
149 this%amat(ipos) =
value
158 this%amat(ipos) = this%amat(ipos) +
value
167 this%amat(this%ia(irow)) = this%amat(this%ia(irow)) +
value
174 integer(I4B) :: first_col_pos
176 first_col_pos = this%ia(irow)
183 integer(I4B) :: last_col_pos
185 last_col_pos = this%ia(irow + 1) - 1
208 integer(I4B) :: i, icol_s, icol_e
211 icol_s = this%get_first_col_pos(irow)
212 icol_e = this%get_last_col_pos(irow)
213 do i = icol_s, icol_e
214 if (this%ja(i) == icol)
then
225 integer(I4B) :: ipos_diag
227 ipos_diag = this%ia(irow)
243 call mem_allocate(this%ia, this%nrow + 1,
'IA', this%memory_path)
244 call mem_allocate(this%ja, this%nja,
'JA', this%memory_path)
245 call mem_allocate(this%amat, this%nja,
'AMAT', this%memory_path)
270 do ipos = this%ia(irow) + 1, this%ia(irow + 1) - 1
271 this%amat(ipos) =
dzero
278 integer(I4B),
dimension(:),
pointer,
contiguous :: ia
279 integer(I4B),
dimension(:),
pointer,
contiguous :: ja
280 real(DP),
dimension(:),
pointer,
contiguous :: amat
290 integer(I4B) :: offset
303 integer(I4B) :: irow, icol, ipos
304 real(DP),
dimension(:),
pointer,
contiguous :: x, y
306 x => vec_x%get_array()
307 y => vec_y%get_array()
308 do irow = 1, this%nrow
310 do ipos = this%ia(irow), this%ia(irow + 1) - 1
312 y(irow) = y(irow) + this%amat(ipos) * x(icol)
This module contains simulation constants.
real(dp), parameter dzero
real constant zero
This module defines variable data types.
integer(i4b) function spm_get_position(this, irow, icol)
Return position index for (irow,icol) element in the matrix. This index can be used in other routines...
integer(i4b) function spm_get_position_diag(this, irow)
subroutine allocate_scalars(this)
subroutine allocate_arrays(this)
real(dp) function spm_get_value_pos(this, ipos)
subroutine spm_multiply(this, vec_x, vec_y)
Calculates the matrix vector product y = A*x.
class(vectorbasetype) function, pointer spm_create_vec(this, n)
subroutine spm_set_value_pos(this, ipos, value)
subroutine spm_add_diag_value(this, irow, value)
subroutine spm_init(this, sparse, mem_path)
Initialize sparse matrix from passed.
class(vectorbasetype) function, pointer spm_create_vec_mm(this, n, name, mem_path)
subroutine spm_destroy(this)
subroutine spm_zero_entries(this)
Set all entries in the matrix to zero.
real(dp) function spm_get_diag_value(this, irow)
subroutine spm_set_diag_value(this, irow, diag_value)
subroutine spm_zero_row_offdiag(this, irow)
Set all off-diagonal entries in the matrix to zero.
integer(i4b) function spm_get_column(this, ipos)
integer(i4b) function spm_get_last_col_pos(this, irow)
integer(i4b) function spm_get_row_offset(this)
subroutine spm_add_value_pos(this, ipos, value)
subroutine spm_get_aij(this, ia, ja, amat)
integer(i4b) function spm_get_first_col_pos(this, irow)