3 #include "sll_assert.h"
4 #include "sll_errors.h"
28 real(
wp),
allocatable :: a(:, :)
51 integer,
intent(in) :: s1
52 integer,
intent(in) :: s2
54 allocate (self%A(s1, s2))
76 integer :: j1, j2, j, k
78 character(len=*),
parameter :: this_sub_name =
"sll_t_linear_operator_matrix_dense_to_stencil % dot"
79 character(len=64) :: err_msg
86 sll_assert(self%s2 ==
size(x%array))
92 associate(p1 => -lbound(y%array, 1) + 1, &
93 p2 => -lbound(y%array, 2) + 1)
95 associate(ny1 => ubound(y%array, 1) - p1, &
96 ny2 => ubound(y%array, 2) - p2)
99 sll_assert(self%s1 == ny1*ny2)
104 j = (j1 - 1)*ny2 + j2
105 do k = 1,
size(x%array)
106 y%array(j1, j2) = y%array(j1, j2) + self%A(j, k)*x%array(k)
112 y%array(1 - p1:0, :) = y%array(ny1 - p1 + 1:ny1, :)
113 y%array(ny1 + 1:ny1 + p1, :) = y%array(1:p1, :)
114 y%array(:, 1 - p2:0) = y%array(:, ny2 - p2 + 1:ny2)
115 y%array(:, ny2 + 1:ny2 + p2) = y%array(:, 1:p2)
122 err_msg =
"y must be of type sll_t_vector_space_real_array_2d"
123 sll_error(this_sub_name, err_msg)
128 err_msg =
"x must be of type sll_t_vector_space_real_array_1d"
129 sll_error(this_sub_name, err_msg)
138 class(sll_c_vector_space),
intent(in) :: x
139 class(sll_c_vector_space),
intent(inout) :: y
141 integer :: j1, j2, j, k
143 character(len=*),
parameter :: this_sub_name =
"sll_t_linear_operator_matrix_dense_to_stencil % dot_incr"
144 character(len=64) :: err_msg
148 type is (sll_t_vector_space_real_array_1d)
151 sll_assert(self%s2 ==
size(x%array))
155 type is (sll_t_vector_space_real_array_2d)
157 associate(p1 => -lbound(y%array, 1) + 1, &
158 p2 => -lbound(y%array, 2) + 1)
160 associate(ny1 => ubound(y%array, 1) - p1, &
161 ny2 => ubound(y%array, 2) - p2)
164 sll_assert(self%s1 == ny1*ny2)
168 j = (j1 - 1)*ny2 + j2
169 do k = 1,
size(x%array)
170 y%array(j1, j2) = y%array(j1, j2) + self%A(j, k)*x%array(k)
176 y%array(1 - p1:0, :) = y%array(ny1 - p1 + 1:ny1, :)
177 y%array(ny1 + 1:ny1 + p1, :) = y%array(1:p1, :)
178 y%array(:, 1 - p2:0) = y%array(:, ny2 - p2 + 1:ny2)
179 y%array(:, ny2 + 1:ny2 + p2) = y%array(:, 1:p2)
186 err_msg =
"y must be of type sll_t_vector_space_real_array_2d"
187 sll_error(this_sub_name, err_msg)
192 err_msg =
"x must be of type sll_t_vector_space_real_array_1d"
193 sll_error(this_sub_name, err_msg)
202 real(wp),
intent(inout) :: A(:, :)
204 sll_assert(
size(a, 1) == self%s1)
205 sll_assert(
size(a, 2) == self%s2)
subroutine s_linear_operator_matrix_dense_to_stencil__dot_incr(self, x, y)
integer function, dimension(2) f_linear_operator_matrix_dense_to_stencil__get_shape(self)
subroutine s_linear_operator_matrix_dense_to_stencil__free(self)
subroutine s_linear_operator_matrix_dense_to_stencil__to_array(self, A)
subroutine s_linear_operator_matrix_dense_to_stencil__init(self, s1, s2)
subroutine s_linear_operator_matrix_dense_to_stencil__dot(self, x, y)
Abstract type implementing a generic vector space.
Vector space for wrapping 1D Fortran real arrays.
Vector space for wrapping 2D Fortran real arrays.
Module to select the kind parameter.
integer, parameter, public f64
f64 is the kind type for 64-bit reals (double precision)
Abstract base class for all vector spaces.
Vector space for wrapping 1D Fortran real arrays.
Vector space for wrapping 2D Fortran real arrays.