17 #include "sll_working_precision.h"
35 sll_int32 :: n_rows_a = 0
36 sll_int32 :: n_cols_a = 0
37 sll_int32 :: n_rows_b = 0
38 sll_int32 :: n_cols_b = 0
39 sll_int32 :: n_rows_c = 0
40 sll_int32 :: n_cols_c = 0
64 & linop_a, linop_b, linop_c)
72 self % n_rows_a = linop_a % n_rows
73 self % n_cols_a = linop_a % n_cols
74 self % ptr_linop_a => linop_a
76 self % n_rows_b = linop_b % n_rows
77 self % n_cols_b = linop_b % n_cols
78 self % ptr_linop_b => linop_b
80 self % n_rows = linop_a % n_rows * linop_b % n_rows
81 self % n_cols = linop_a % n_cols * linop_b % n_cols
83 self % n_block_rows = linop_a % n_block_rows * linop_b % n_block_rows
84 self % n_block_cols = linop_a % n_block_cols * linop_b % n_block_cols
86 self % n_global_rows = linop_a % n_global_rows * linop_b % n_global_rows
87 self % n_global_cols = linop_a % n_global_cols * linop_b % n_global_cols
89 if (
present(linop_c))
then
90 self % n_rows_c = linop_c % n_rows
91 self % n_cols_c = linop_c % n_cols
92 self % ptr_linop_c => linop_c
94 self % n_rows = self % n_rows * linop_c % n_rows
95 self % n_cols = self % n_cols * linop_c % n_cols
97 self % n_block_rows = self % n_block_rows * linop_c % n_block_rows
98 self % n_block_cols = self % n_block_cols * linop_c % n_block_cols
100 self % n_global_rows = self % n_global_rows * linop_c % n_global_rows
101 self % n_global_cols = self % n_global_cols * linop_c % n_global_cols
106 call self % initialize_abstract ()
132 sll_real64,
dimension(:),
intent(in ) :: x
133 sll_real64,
dimension(:),
intent( out) :: y
137 if (.not.
associated(self % ptr_linop_c))
then
160 sll_real64,
dimension(:),
intent(in) :: x
161 sll_real64,
dimension(:),
intent(inout) :: y
164 sll_int32 :: n_rows_a
165 sll_int32 :: n_rows_b
166 sll_int32 :: n_cols_a
167 sll_int32 :: n_cols_b
169 sll_real64,
dimension(:,:),
allocatable :: x_matrix
170 sll_real64,
dimension(:,:),
allocatable :: x_matrix_trans
171 sll_real64,
dimension(:,:),
allocatable :: x_prime
172 sll_real64,
dimension(:,:),
allocatable :: x_prime_trans
173 sll_real64,
dimension(:,:),
allocatable :: y_matrix
176 n_cols_a = linop_1 % n_cols
177 n_rows_a = linop_1 % n_rows
178 n_cols_b = linop_2 % n_cols
179 n_rows_b = linop_2 % n_rows
183 allocate(x_matrix(n_cols_b, n_cols_a))
184 allocate(x_matrix_trans(n_cols_a, n_cols_b))
185 allocate(x_prime(n_cols_b, n_rows_a))
186 allocate(x_prime_trans(n_rows_a, n_cols_b))
187 allocate(y_matrix(n_rows_b, n_rows_a))
197 call linop_1 % dot(x_matrix_trans(:,i), x_prime_trans(:,i))
203 call linop_2 % dot(x_prime(:,i), y_matrix(:,i))
211 deallocate(x_matrix_trans)
213 deallocate(x_prime_trans)
235 sll_real64,
dimension(:),
intent(in) :: x
236 sll_real64,
dimension(:),
intent(inout) :: y
239 sll_int32 :: n_rows_1
240 sll_int32 :: n_rows_23
241 sll_int32 :: n_cols_1
242 sll_int32 :: n_cols_23
243 sll_real64,
dimension(:,:),
allocatable :: x_matrix
244 sll_real64,
dimension(:,:),
allocatable :: x_matrix_trans
245 sll_real64,
dimension(:,:),
allocatable :: x_prime
246 sll_real64,
dimension(:,:),
allocatable :: x_prime_trans
247 sll_real64,
dimension(:,:),
allocatable :: y_matrix
250 n_rows_1 = linop_1 % n_rows
251 n_rows_23 = linop_2 % n_rows * linop_3 % n_rows
255 n_cols_1 = linop_1 % n_cols
256 n_cols_23 = linop_2 % n_cols * linop_3 % n_cols
260 allocate(y_matrix(n_rows_23, n_rows_1))
261 allocate(x_prime(n_cols_23, n_rows_1))
262 allocate(x_prime_trans(n_rows_1, n_cols_23))
263 allocate(x_matrix(n_cols_23, n_cols_1))
264 allocate(x_matrix_trans(n_cols_1, n_cols_23))
273 call linop_1 % dot(x_matrix_trans(:,i),x_prime_trans(:,i))
283 & self % ptr_linop_b, &
284 & self % ptr_linop_c, &
294 deallocate(x_prime_trans)
296 deallocate(x_matrix_trans)
312 print *,
">>>> linear_operator_kron"
313 call self % print_info_abstract()
315 print *,
"* n_rows_a : ", self % n_rows_a
316 print *,
"* n_cols_a : ", self % n_cols_a
317 print *,
"* n_rows_b : ", self % n_rows_b
318 print *,
"* n_cols_b : ", self % n_cols_b
332 sll_real64,
dimension(:,:),
intent(in) :: x
333 sll_real64,
dimension(:,:),
intent(out) :: x_t
364 sll_real64,
dimension(:) ,
intent(in) :: vec
365 sll_real64,
dimension(:,:),
intent(inout) :: mat
380 mat(1:n, j) = vec(1+(j-1)*n:j*n)
394 sll_real64,
dimension(:,:),
intent(in) :: mat
395 sll_real64,
dimension(:) ,
intent(inout) :: vec
408 vec(1+(j-1)*n:j*n) = mat(1:n, j)
module for abstract linear operator
module for a linear operator of kronecker solver
subroutine dot_2_linear_operator_kron(self, linop_1, linop_2, x, y)
apply the dot operation
subroutine dot_3_linear_operator_kron(self, linop_1, linop_2, linop_3, x, y)
apply the dot operation
recursive subroutine, public sll_transpose(x, x_t)
returnes the transpose of a 2d array
subroutine free_linear_operator_kron(self)
destroys the current object
subroutine create_linear_operator_kron(self, linop_a, linop_b, linop_c)
creates a linear operator
subroutine, public sll_matrix_to_vector(mat, vec)
converts a matrix to a vector
subroutine, public sll_vector_to_matrix(vec, mat)
converts a vector to a matrix
subroutine print_info_linear_operator_kron(self)
prints a linear operator
subroutine dot_linear_operator_kron(self, x, y)
apply the dot operation
class for abstract linear operator
class for a linear operator