SPEED
MATMUL_SPARSE.f90
Go to the documentation of this file.
1! Copyright (C) 2012 The SPEED FOUNDATION
2! Author: Ilario Mazzieri
3!
4! This file is part of SPEED.
5!
6! SPEED is free software; you can redistribute it and/or modify it
7! under the terms of the GNU Affero General Public License as
8! published by the Free Software Foundation, either version 3 of the
9! License, or (at your option) any later version.
10!
11! SPEED is distributed in the hope that it will be useful, but
12! WITHOUT ANY WARRANTY; without even the implied warranty of
13! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14! Affero General Public License for more details.
15!
16! You should have received a copy of the GNU Affero General Public License
17! along with SPEED. If not, see <http://www.gnu.org/licenses/>.
18
32
33 subroutine matmul_sparse(As, nnz, Jsp, Isp, vet_out, n, vet_in, m, error)
34
35
36 implicit none
37
38 integer*4 :: nnz, i, j, n, m, error
39 integer*4 :: Jsp(nnz), Isp(0:n)
40
41 real*8 :: as(nnz), vet_in(m), vet_out(n)
42
43 vet_out = 0.d0
44
45
46 do i = 1, n
47 do j = isp(i-1) + 1, isp(i)
48 vet_out(i) = vet_out(i) + as(j)*vet_in(jsp(j))
49 enddo
50 enddo
51
52
53 return
54 end subroutine matmul_sparse
subroutine matmul_sparse(as, nnz, jsp, isp, vet_out, n, vet_in,
Matrix-vector multiplication for sparse matrices (RCS format).