3 #include "sll_assert.h"
4 #include "sll_errors.h"
26 real(
wp),
allocatable :: a(:, :, :, :)
51 integer,
intent(in) :: s1
52 integer,
intent(in) :: s2
53 integer,
intent(in) :: p1
54 integer,
intent(in) :: p2
56 allocate (self%A(-p1:p1, -p2:p2, 1:s1, 1:s2))
70 s(1) =
size(self%A, 3)*
size(self%A, 4)
81 integer :: i1, i2, j1, j2, k1, k2
84 character(len=*),
parameter :: this_sub_name =
"sll_t_linear_operator_matrix_stencil_to_stencil % dot"
85 character(len=64) :: err_msg
87 associate(s1 => self%s1, &
97 sll_assert(self%p1 == -lbound(x%array, 1) + 1)
98 sll_assert(self%p2 == -lbound(x%array, 2) + 1)
99 sll_assert(self%s1 == ubound(x%array, 1) + lbound(x%array, 1) - 1)
100 sll_assert(self%s2 == ubound(x%array, 2) + lbound(x%array, 2) - 1)
107 sll_assert(self%p1 == -lbound(y%array, 1) + 1)
108 sll_assert(self%p2 == -lbound(y%array, 2) + 1)
109 sll_assert(self%s1 == ubound(y%array, 1) + lbound(y%array, 1) - 1)
110 sll_assert(self%s2 == ubound(y%array, 2) + lbound(y%array, 2) - 1)
129 else if (j1 > s1)
then
136 else if (j2 > s2)
then
140 temp = temp + self%A(k1, k2, i1, i2)*x%array(j1, j2)
145 y%array(i1, i2) = y%array(i1, i2) + temp
152 y%array(1 - p1:0, :) = y%array(s1 - p1 + 1:s1, :)
153 y%array(s1 + 1:s1 + p1, :) = y%array(1:p1, :)
154 y%array(:, 1 - p2:0) = y%array(:, s2 - p2 + 1:s2)
155 y%array(:, s2 + 1:s2 + p2) = y%array(:, 1:p2)
158 err_msg =
"y must be of type sll_t_vector_space_real_array_2d"
159 sll_error(this_sub_name, err_msg)
164 err_msg =
"x must be of type sll_t_vector_space_real_array_2d"
165 sll_error(this_sub_name, err_msg)
176 class(sll_c_vector_space),
intent(in) :: x
177 class(sll_c_vector_space),
intent(inout) :: y
179 integer :: i1, i2, j1, j2, k1, k2
182 character(len=*),
parameter :: this_sub_name =
"sll_t_linear_operator_matrix_stencil_to_stencil % dot"
183 character(len=64) :: err_msg
185 associate(s1 => self%s1, &
192 type is (sll_t_vector_space_real_array_2d)
195 sll_assert(self%p1 == -lbound(x%array, 1) + 1)
196 sll_assert(self%p2 == -lbound(x%array, 2) + 1)
197 sll_assert(self%s1 == ubound(x%array, 1) + lbound(x%array, 1) - 1)
198 sll_assert(self%s2 == ubound(x%array, 2) + lbound(x%array, 2) - 1)
202 type is (sll_t_vector_space_real_array_2d)
205 sll_assert(self%p1 == -lbound(y%array, 1) + 1)
206 sll_assert(self%p2 == -lbound(y%array, 2) + 1)
207 sll_assert(self%s1 == ubound(y%array, 1) + lbound(y%array, 1) - 1)
208 sll_assert(self%s2 == ubound(y%array, 2) + lbound(y%array, 2) - 1)
225 else if (j1 > s1)
then
232 else if (j2 > s2)
then
236 temp = temp + self%A(k1, k2, i1, i2)*x%array(j1, j2)
241 y%array(i1, i2) = y%array(i1, i2) + temp
248 y%array(1 - p1:0, :) = y%array(s1 - p1 + 1:s1, :)
249 y%array(s1 + 1:s1 + p1, :) = y%array(1:p1, :)
250 y%array(:, 1 - p2:0) = y%array(:, s2 - p2 + 1:s2)
251 y%array(:, s2 + 1:s2 + p2) = y%array(:, 1:p2)
254 err_msg =
"y must be of type sll_t_vector_space_real_array_2d"
255 sll_error(this_sub_name, err_msg)
260 err_msg =
"x must be of type sll_t_vector_space_real_array_2d"
261 sll_error(this_sub_name, err_msg)
272 real(wp),
intent(inout) :: A(:, :)
274 integer :: i, j, i1, i2, j1, j2, k1, k2
276 associate(s1 => self%s1, &
281 sll_assert(
size(a, 1) == s1*s2)
282 sll_assert(
size(a, 2) == s1*s2)
288 j1 = modulo(i1 - 1 + k1, s1) + 1
289 j2 = modulo(i2 - 1 + k2, s2) + 1
292 a(i, j) = self%A(k1, k2, i1, i2)
subroutine s_linear_operator_matrix_stencil_to_stencil__init(self, s1, s2, p1, p2)
subroutine s_linear_operator_matrix_stencil_to_stencil__free(self)
subroutine s_linear_operator_matrix_stencil_to_stencil__dot(self, x, y)
subroutine s_linear_operator_matrix_stencil_to_stencil__to_array(self, A)
subroutine s_linear_operator_matrix_stencil_to_stencil__dot_incr(self, x, y)
integer function, dimension(2) f_linear_operator_matrix_stencil_to_stencil__get_shape(self)
Abstract type implementing a generic vector space.
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 2D Fortran real arrays.