linalg 1.8.2
A linear algebra library that provides a user-friendly interface to several BLAS and LAPACK routines.
Loading...
Searching...
No Matches
linalg.f90
1! linalg.f90
2
142
143
145module linalg
146 use, intrinsic :: iso_fortran_env, only : int32, real64
147 use ferror, only : errors
148 implicit none
149
150 private
151 public :: mtx_mult
152 public :: rank1_update
153 public :: diag_mtx_mult
154 public :: trace
155 public :: mtx_rank
156 public :: det
157 public :: swap
158 public :: recip_mult_array
159 public :: tri_mtx_mult
160 public :: lu_factor
161 public :: form_lu
162 public :: qr_factor
163 public :: form_qr
164 public :: mult_qr
165 public :: qr_rank1_update
166 public :: cholesky_factor
167 public :: cholesky_rank1_update
169 public :: rz_factor
170 public :: mult_rz
171 public :: svd
173 public :: solve_lu
174 public :: solve_qr
175 public :: solve_cholesky
176 public :: mtx_inverse
177 public :: mtx_pinverse
178 public :: solve_least_squares
181 public :: eigen
182 public :: sort
183 public :: lq_factor
184 public :: form_lq
185 public :: mult_lq
186 public :: solve_lq
187 public :: band_mtx_mult
188 public :: band_mtx_to_full_mtx
189 public :: band_diag_mtx_mult
190 public :: banded_to_dense
191 public :: dense_to_banded
192 public :: extract_diagonal
193 public :: csr_matrix
194 public :: msr_matrix
195 public :: size
196 public :: create_empty_csr_matrix
197 public :: create_empty_msr_matrix
198 public :: nonzero_count
199 public :: dense_to_csr
200 public :: diag_to_csr
201 public :: banded_to_csr
202 public :: csr_to_dense
203 public :: csr_to_msr
204 public :: msr_to_csr
205 public :: dense_to_msr
206 public :: msr_to_dense
207 public :: create_csr_matrix
208 public :: matmul
209 public :: operator(+)
210 public :: operator(-)
211 public :: operator(*)
212 public :: operator(/)
213 public :: assignment(=)
214 public :: transpose
215 public :: sparse_direct_solve
216 public :: pgmres_solver
217 public :: la_no_operation
218 public :: la_transpose
219 public :: la_hermitian_transpose
220 public :: la_no_error
221 public :: la_invalid_input_error
222 public :: la_array_size_error
223 public :: la_singular_matrix_error
224 public :: la_matrix_format_error
225 public :: la_out_of_memory_error
226 public :: la_convergence_error
227 public :: la_invalid_operation_error
228
229! ******************************************************************************
230! TYPES
231! ------------------------------------------------------------------------------
236 integer(int32), allocatable, dimension(:) :: row_indices
239 integer(int32), allocatable, dimension(:) :: column_indices
242 real(real64), allocatable, dimension(:) :: values
244 integer(int32), private :: n = 0
245 contains
247 procedure, public :: get => csr_get_element
248 end type
249
250! ------------------------------------------------------------------------------
255 integer(int32), allocatable, dimension(:) :: indices
258 real(real64), allocatable, dimension(:) :: values
260 integer(int32), private :: m = 0
262 integer(int32), private :: n = 0
264 integer(int32), private :: nnz = 0
265 end type
266
267! ******************************************************************************
268! CONSTANTS
269! ------------------------------------------------------------------------------
271 integer(int32), parameter :: la_no_operation = 0
273 integer(int32), parameter :: la_transpose = 1
275 integer(int32), parameter :: la_hermitian_transpose = 2
276
277! ******************************************************************************
278! ERROR FLAGS
279! ------------------------------------------------------------------------------
281 integer(int32), parameter :: la_no_error = 0
283 integer(int32), parameter :: la_invalid_input_error = 101
285 integer(int32), parameter :: la_array_size_error = 102
287 integer(int32), parameter :: la_singular_matrix_error = 103
289 integer(int32), parameter :: la_matrix_format_error = 104
291 integer(int32), parameter :: la_out_of_memory_error = 105
293 integer(int32), parameter :: la_convergence_error = 106
295 integer(int32), parameter :: la_invalid_operation_error = 107
296
297! ******************************************************************************
298! INTERFACES
299! ------------------------------------------------------------------------------
361interface mtx_mult
362 module procedure :: mtx_mult_mtx
363 module procedure :: mtx_mult_vec
364 module procedure :: cmtx_mult_mtx
365 module procedure :: cmtx_mult_vec
366end interface
367
368! ------------------------------------------------------------------------------
397 module procedure :: rank1_update_dbl
398 module procedure :: rank1_update_cmplx
399end interface
400
401! ------------------------------------------------------------------------------
554 module procedure :: diag_mtx_mult_mtx
555 module procedure :: diag_mtx_mult_mtx2
556 module procedure :: diag_mtx_mult_mtx3
557 module procedure :: diag_mtx_mult_mtx4
558 module procedure :: diag_mtx_mult_mtx_cmplx
559 module procedure :: diag_mtx_mult_mtx2_cmplx
560 module procedure :: diag_mtx_mult_mtx_mix
561 module procedure :: diag_mtx_mult_mtx2_mix
562 module procedure :: diag_mtx_sparse_mult
563end interface
564
565! ------------------------------------------------------------------------------
578interface trace
579 module procedure :: trace_dbl
580 module procedure :: trace_cmplx
581end interface
582
583! ------------------------------------------------------------------------------
626interface mtx_rank
627 module procedure :: mtx_rank_dbl
628 module procedure :: mtx_rank_cmplx
629end interface
630
631! ------------------------------------------------------------------------------
659interface det
660 module procedure :: det_dbl
661 module procedure :: det_cmplx
662end interface
663
664! ------------------------------------------------------------------------------
681interface swap
682 module procedure :: swap_dbl
683 module procedure :: swap_cmplx
684end interface
685
686! ------------------------------------------------------------------------------
701 module procedure :: recip_mult_array_dbl
702end interface
703
704! ------------------------------------------------------------------------------
735 module procedure :: tri_mtx_mult_dbl
736 module procedure :: tri_mtx_mult_cmplx
737end interface
738
739! ------------------------------------------------------------------------------
844interface lu_factor
845 module procedure :: lu_factor_dbl
846 module procedure :: lu_factor_cmplx
847 module procedure :: csr_lu_factor
848end interface
849
967interface form_lu
968 module procedure :: form_lu_all
969 module procedure :: form_lu_all_cmplx
970 module procedure :: form_lu_only
971 module procedure :: form_lu_only_cmplx
972end interface
973
974! ------------------------------------------------------------------------------
1121interface qr_factor
1122 module procedure :: qr_factor_no_pivot
1123 module procedure :: qr_factor_no_pivot_cmplx
1124 module procedure :: qr_factor_pivot
1125 module procedure :: qr_factor_pivot_cmplx
1126end interface
1127
1128! ------------------------------------------------------------------------------
1281interface form_qr
1282 module procedure :: form_qr_no_pivot
1283 module procedure :: form_qr_no_pivot_cmplx
1284 module procedure :: form_qr_pivot
1285 module procedure :: form_qr_pivot_cmplx
1286end interface
1287
1288! ------------------------------------------------------------------------------
1438interface mult_qr
1439 module procedure :: mult_qr_mtx
1440 module procedure :: mult_qr_mtx_cmplx
1441 module procedure :: mult_qr_vec
1442 module procedure :: mult_qr_vec_cmplx
1443end interface
1444
1445! ------------------------------------------------------------------------------
1589 module procedure :: qr_rank1_update_dbl
1590 module procedure :: qr_rank1_update_cmplx
1591end interface
1592
1593! ------------------------------------------------------------------------------
1688 module procedure :: cholesky_factor_dbl
1689 module procedure :: cholesky_factor_cmplx
1690end interface
1691
1692! ------------------------------------------------------------------------------
1787 module procedure :: cholesky_rank1_update_dbl
1788 module procedure :: cholesky_rank1_update_cmplx
1789end interface
1790
1791! ------------------------------------------------------------------------------
1894 module procedure :: cholesky_rank1_downdate_dbl
1895 module procedure :: cholesky_rank1_downdate_cmplx
1896end interface
1897
1898! ------------------------------------------------------------------------------
1966interface rz_factor
1967 module procedure :: rz_factor_dbl
1968 module procedure :: rz_factor_cmplx
1969end interface
1970
1971! ------------------------------------------------------------------------------
2057interface mult_rz
2058 module procedure :: mult_rz_mtx
2059 module procedure :: mult_rz_mtx_cmplx
2060 module procedure :: mult_rz_vec
2061 module procedure :: mult_rz_vec_cmplx
2062end interface
2063
2064! ------------------------------------------------------------------------------
2182interface svd
2183 module procedure :: svd_dbl
2184 module procedure :: svd_cmplx
2185end interface
2186
2187! ------------------------------------------------------------------------------
2317 module procedure :: solve_tri_mtx
2318 module procedure :: solve_tri_mtx_cmplx
2319 module procedure :: solve_tri_vec
2320 module procedure :: solve_tri_vec_cmplx
2321end interface
2322
2323! ------------------------------------------------------------------------------
2421interface solve_lu
2422 module procedure :: solve_lu_mtx
2423 module procedure :: solve_lu_mtx_cmplx
2424 module procedure :: solve_lu_vec
2425 module procedure :: solve_lu_vec_cmplx
2426 module procedure :: csr_lu_solve
2427end interface
2428
2429! ------------------------------------------------------------------------------
2557interface solve_qr
2558 module procedure :: solve_qr_no_pivot_mtx
2559 module procedure :: solve_qr_no_pivot_mtx_cmplx
2560 module procedure :: solve_qr_no_pivot_vec
2561 module procedure :: solve_qr_no_pivot_vec_cmplx
2562 module procedure :: solve_qr_pivot_mtx
2563 module procedure :: solve_qr_pivot_mtx_cmplx
2564 module procedure :: solve_qr_pivot_vec
2565 module procedure :: solve_qr_pivot_vec_cmplx
2566end interface
2567
2568! ------------------------------------------------------------------------------
2664 module procedure :: solve_cholesky_mtx
2665 module procedure :: solve_cholesky_mtx_cmplx
2666 module procedure :: solve_cholesky_vec
2667 module procedure :: solve_cholesky_vec_cmplx
2668end interface
2669
2670! ------------------------------------------------------------------------------
2754 module procedure :: solve_least_squares_mtx
2755 module procedure :: solve_least_squares_mtx_cmplx
2756 module procedure :: solve_least_squares_vec
2757 module procedure :: solve_least_squares_vec_cmplx
2758end interface
2759
2760! ------------------------------------------------------------------------------
2855 module procedure :: solve_least_squares_mtx_pvt
2856 module procedure :: solve_least_squares_mtx_pvt_cmplx
2857 module procedure :: solve_least_squares_vec_pvt
2858 module procedure :: solve_least_squares_vec_pvt_cmplx
2859end interface
2860
2861! ------------------------------------------------------------------------------
2957 module procedure :: solve_least_squares_mtx_svd
2958 module procedure :: solve_least_squares_vec_svd
2959end interface
2960
2961! ------------------------------------------------------------------------------
3052 module procedure :: mtx_inverse_dbl
3053 module procedure :: mtx_inverse_cmplx
3054end interface
3055
3056! ------------------------------------------------------------------------------
3158 module procedure :: mtx_pinverse_dbl
3159 module procedure :: mtx_pinverse_cmplx
3160end interface
3161
3162! ------------------------------------------------------------------------------
3371interface eigen
3372 module procedure :: eigen_symm
3373 module procedure :: eigen_asymm
3374 module procedure :: eigen_gen
3375 module procedure :: eigen_cmplx
3376end interface
3377
3378! ------------------------------------------------------------------------------
3454interface sort
3455 module procedure :: sort_dbl_array
3456 module procedure :: sort_dbl_array_ind
3457 module procedure :: sort_cmplx_array
3458 module procedure :: sort_cmplx_array_ind
3459 module procedure :: sort_eigen_cmplx
3460 module procedure :: sort_eigen_dbl
3461 module procedure :: sort_int32_array
3462 module procedure :: sort_int32_array_ind
3463end interface
3464
3570interface lq_factor
3571 module procedure :: lq_factor_no_pivot
3572 module procedure :: lq_factor_no_pivot_cmplx
3573end interface
3574
3684interface form_lq
3685 module procedure :: form_lq_no_pivot
3686 module procedure :: form_lq_no_pivot_cmplx
3687end interface
3688
3833interface mult_lq
3834 module procedure :: mult_lq_mtx
3835 module procedure :: mult_lq_mtx_cmplx
3836 module procedure :: mult_lq_vec
3837 module procedure :: mult_lq_vec_cmplx
3838end interface
3839
3928interface solve_lq
3929 module procedure :: solve_lq_mtx
3930 module procedure :: solve_lq_mtx_cmplx
3931 module procedure :: solve_lq_vec
3932 module procedure :: solve_lq_vec_cmplx
3933end interface
3934
3935! ------------------------------------------------------------------------------
4031 module procedure :: band_mtx_vec_mult_dbl
4032 module procedure :: band_mtx_vec_mult_cmplx
4033end interface
4034
4073 module procedure :: band_to_full_mtx_dbl
4074 module procedure :: band_to_full_mtx_cmplx
4075end interface
4076
4136 module procedure :: band_diag_mtx_mult_dbl
4137 module procedure :: band_diag_mtx_mult_cmplx
4138end interface
4139
4164 module procedure :: banded_to_dense_dbl
4165 module procedure :: banded_to_dense_cmplx
4166end interface
4167
4189 module procedure :: dense_to_banded_dbl
4190 module procedure :: dense_to_banded_cmplx
4191end interface
4192
4211 module procedure :: extract_diagonal_dbl
4212 module procedure :: extract_diagonal_cmplx
4213 module procedure :: extract_diagonal_csr
4214end interface
4215
4216! ******************************************************************************
4217! LINALG_BASIC.F90
4218! ------------------------------------------------------------------------------
4219interface
4220 module subroutine mtx_mult_mtx(transa, transb, alpha, a, b, beta, c, err)
4221 logical, intent(in) :: transa, transb
4222 real(real64), intent(in) :: alpha, beta
4223 real(real64), intent(in), dimension(:,:) :: a, b
4224 real(real64), intent(inout), dimension(:,:) :: c
4225 class(errors), intent(inout), optional, target :: err
4226 end subroutine
4227
4228 module subroutine mtx_mult_vec(trans, alpha, a, b, beta, c, err)
4229 logical, intent(in) :: trans
4230 real(real64), intent(in) :: alpha, beta
4231 real(real64), intent(in), dimension(:,:) :: a
4232 real(real64), intent(in), dimension(:) :: b
4233 real(real64), intent(inout), dimension(:) :: c
4234 class(errors), intent(inout), optional, target :: err
4235 end subroutine
4236
4237 module subroutine cmtx_mult_mtx(opa, opb, alpha, a, b, beta, c, err)
4238 integer(int32), intent(in) :: opa, opb
4239 complex(real64), intent(in) :: alpha, beta
4240 complex(real64), intent(in), dimension(:,:) :: a, b
4241 complex(real64), intent(inout), dimension(:,:) :: c
4242 class(errors), intent(inout), optional, target :: err
4243 end subroutine
4244
4245 module subroutine cmtx_mult_vec(opa, alpha, a, b, beta, c, err)
4246 integer(int32), intent(in) :: opa
4247 complex(real64), intent(in) :: alpha, beta
4248 complex(real64), intent(in), dimension(:,:) :: a
4249 complex(real64), intent(in), dimension(:) :: b
4250 complex(real64), intent(inout), dimension(:) :: c
4251 class(errors), intent(inout), optional, target :: err
4252 end subroutine
4253
4254 module subroutine rank1_update_dbl(alpha, x, y, a, err)
4255 real(real64), intent(in) :: alpha
4256 real(real64), intent(in), dimension(:) :: x, y
4257 real(real64), intent(inout), dimension(:,:) :: a
4258 class(errors), intent(inout), optional, target :: err
4259 end subroutine
4260
4261 module subroutine rank1_update_cmplx(alpha, x, y, a, err)
4262 complex(real64), intent(in) :: alpha
4263 complex(real64), intent(in), dimension(:) :: x, y
4264 complex(real64), intent(inout), dimension(:,:) :: a
4265 class(errors), intent(inout), optional, target :: err
4266 end subroutine
4267
4268 module subroutine diag_mtx_mult_mtx(lside, trans, alpha, a, b, beta, c, err)
4269 logical, intent(in) :: lside, trans
4270 real(real64) :: alpha, beta
4271 real(real64), intent(in), dimension(:) :: a
4272 real(real64), intent(in), dimension(:,:) :: b
4273 real(real64), intent(inout), dimension(:,:) :: c
4274 class(errors), intent(inout), optional, target :: err
4275 end subroutine
4276
4277 module subroutine diag_mtx_mult_mtx2(lside, alpha, a, b, err)
4278 logical, intent(in) :: lside
4279 real(real64), intent(in) :: alpha
4280 real(real64), intent(in), dimension(:) :: a
4281 real(real64), intent(inout), dimension(:,:) :: b
4282 class(errors), intent(inout), optional, target :: err
4283 end subroutine
4284
4285 module subroutine diag_mtx_mult_mtx3(lside, trans, alpha, a, b, beta, c, err)
4286 logical, intent(in) :: lside, trans
4287 real(real64) :: alpha, beta
4288 complex(real64), intent(in), dimension(:) :: a
4289 real(real64), intent(in), dimension(:,:) :: b
4290 complex(real64), intent(inout), dimension(:,:) :: c
4291 class(errors), intent(inout), optional, target :: err
4292 end subroutine
4293
4294 module subroutine diag_mtx_mult_mtx4(lside, opb, alpha, a, b, beta, c, err)
4295 logical, intent(in) :: lside
4296 integer(int32), intent(in) :: opb
4297 real(real64) :: alpha, beta
4298 complex(real64), intent(in), dimension(:) :: a
4299 complex(real64), intent(in), dimension(:,:) :: b
4300 complex(real64), intent(inout), dimension(:,:) :: c
4301 class(errors), intent(inout), optional, target :: err
4302 end subroutine
4303
4304 module subroutine diag_mtx_mult_mtx_cmplx(lside, opb, alpha, a, b, beta, c, err)
4305 logical, intent(in) :: lside
4306 integer(int32), intent(in) :: opb
4307 complex(real64) :: alpha, beta
4308 complex(real64), intent(in), dimension(:) :: a
4309 complex(real64), intent(in), dimension(:,:) :: b
4310 complex(real64), intent(inout), dimension(:,:) :: c
4311 class(errors), intent(inout), optional, target :: err
4312 end subroutine
4313
4314 module subroutine diag_mtx_mult_mtx2_cmplx(lside, alpha, a, b, err)
4315 logical, intent(in) :: lside
4316 complex(real64), intent(in) :: alpha
4317 complex(real64), intent(in), dimension(:) :: a
4318 complex(real64), intent(inout), dimension(:,:) :: b
4319 class(errors), intent(inout), optional, target :: err
4320 end subroutine
4321
4322 module subroutine diag_mtx_mult_mtx_mix(lside, opb, alpha, a, b, beta, c, err)
4323 logical, intent(in) :: lside
4324 integer(int32), intent(in) :: opb
4325 complex(real64) :: alpha, beta
4326 real(real64), intent(in), dimension(:) :: a
4327 complex(real64), intent(in), dimension(:,:) :: b
4328 complex(real64), intent(inout), dimension(:,:) :: c
4329 class(errors), intent(inout), optional, target :: err
4330 end subroutine
4331
4332 module subroutine diag_mtx_mult_mtx2_mix(lside, alpha, a, b, err)
4333 logical, intent(in) :: lside
4334 complex(real64), intent(in) :: alpha
4335 real(real64), intent(in), dimension(:) :: a
4336 complex(real64), intent(inout), dimension(:,:) :: b
4337 class(errors), intent(inout), optional, target :: err
4338 end subroutine
4339
4340 module subroutine diag_mtx_sparse_mult(lside, alpha, a, b, err)
4341 logical, intent(in) :: lside
4342 real(real64), intent(in) :: alpha
4343 real(real64), intent(in), dimension(:) :: a
4344 type(csr_matrix), intent(inout) :: b
4345 class(errors), intent(inout), optional, target :: err
4346 end subroutine
4347
4348 pure module function trace_dbl(x) result(y)
4349 real(real64), intent(in), dimension(:,:) :: x
4350 real(real64) :: y
4351 end function
4352
4353 pure module function trace_cmplx(x) result(y)
4354 complex(real64), intent(in), dimension(:,:) :: x
4355 complex(real64) :: y
4356 end function
4357
4358 module function mtx_rank_dbl(a, tol, work, olwork, err) result(rnk)
4359 real(real64), intent(inout), dimension(:,:) :: a
4360 real(real64), intent(in), optional :: tol
4361 real(real64), intent(out), target, optional, dimension(:) :: work
4362 integer(int32), intent(out), optional :: olwork
4363 class(errors), intent(inout), optional, target :: err
4364 integer(int32) :: rnk
4365 end function
4366
4367 module function mtx_rank_cmplx(a, tol, work, olwork, rwork, err) result(rnk)
4368 complex(real64), intent(inout), dimension(:,:) :: a
4369 real(real64), intent(in), optional :: tol
4370 complex(real64), intent(out), target, optional, dimension(:) :: work
4371 integer(int32), intent(out), optional :: olwork
4372 real(real64), intent(out), target, optional, dimension(:) :: rwork
4373 class(errors), intent(inout), optional, target :: err
4374 integer(int32) :: rnk
4375 end function
4376
4377 module function det_dbl(a, iwork, err) result(x)
4378 real(real64), intent(inout), dimension(:,:) :: a
4379 integer(int32), intent(out), target, optional, dimension(:) :: iwork
4380 class(errors), intent(inout), optional, target :: err
4381 real(real64) :: x
4382 end function
4383
4384 module function det_cmplx(a, iwork, err) result(x)
4385 complex(real64), intent(inout), dimension(:,:) :: a
4386 integer(int32), intent(out), target, optional, dimension(:) :: iwork
4387 class(errors), intent(inout), optional, target :: err
4388 complex(real64) :: x
4389 end function
4390
4391 module subroutine swap_dbl(x, y, err)
4392 real(real64), intent(inout), dimension(:) :: x, y
4393 class(errors), intent(inout), optional, target :: err
4394 end subroutine
4395
4396 module subroutine swap_cmplx(x, y, err)
4397 complex(real64), intent(inout), dimension(:) :: x, y
4398 class(errors), intent(inout), optional, target :: err
4399 end subroutine
4400
4401 module subroutine recip_mult_array_dbl(a, x)
4402 real(real64), intent(in) :: a
4403 real(real64), intent(inout), dimension(:) :: x
4404 end subroutine
4405
4406 module subroutine tri_mtx_mult_dbl(upper, alpha, a, beta, b, err)
4407 logical, intent(in) :: upper
4408 real(real64), intent(in) :: alpha, beta
4409 real(real64), intent(in), dimension(:,:) :: a
4410 real(real64), intent(inout), dimension(:,:) :: b
4411 class(errors), intent(inout), optional, target :: err
4412 end subroutine
4413
4414 module subroutine tri_mtx_mult_cmplx(upper, alpha, a, beta, b, err)
4415 logical, intent(in) :: upper
4416 complex(real64), intent(in) :: alpha, beta
4417 complex(real64), intent(in), dimension(:,:) :: a
4418 complex(real64), intent(inout), dimension(:,:) :: b
4419 class(errors), intent(inout), optional, target :: err
4420 end subroutine
4421
4422 module subroutine band_mtx_vec_mult_dbl(trans, kl, ku, alpha, a, x, beta, &
4423 y, err)
4424 logical, intent(in) :: trans
4425 integer(int32), intent(in) :: kl, ku
4426 real(real64), intent(in) :: alpha, beta
4427 real(real64), intent(in), dimension(:,:) :: a
4428 real(real64), intent(in), dimension(:) :: x
4429 real(real64), intent(inout), dimension(:) :: y
4430 class(errors), intent(inout), optional, target :: err
4431 end subroutine
4432
4433 module subroutine band_mtx_vec_mult_cmplx(trans, kl, ku, alpha, a, x, &
4434 beta, y, err)
4435 integer(int32), intent(in) :: trans
4436 integer(int32), intent(in) :: kl, ku
4437 complex(real64), intent(in) :: alpha, beta
4438 complex(real64), intent(in), dimension(:,:) :: a
4439 complex(real64), intent(in), dimension(:) :: x
4440 complex(real64), intent(inout), dimension(:) :: y
4441 class(errors), intent(inout), optional, target :: err
4442 end subroutine
4443
4444 module subroutine band_to_full_mtx_dbl(kl, ku, b, f, err)
4445 integer(int32), intent(in) :: kl, ku
4446 real(real64), intent(in), dimension(:,:) :: b
4447 real(real64), intent(out), dimension(:,:) :: f
4448 class(errors), intent(inout), optional, target :: err
4449 end subroutine
4450
4451 module subroutine band_to_full_mtx_cmplx(kl, ku, b, f, err)
4452 integer(int32), intent(in) :: kl, ku
4453 complex(real64), intent(in), dimension(:,:) :: b
4454 complex(real64), intent(out), dimension(:,:) :: f
4455 class(errors), intent(inout), optional, target :: err
4456 end subroutine
4457
4458 module subroutine band_diag_mtx_mult_dbl(left, m, kl, ku, alpha, a, b, err)
4459 logical, intent(in) :: left
4460 integer(int32), intent(in) :: m, kl, ku
4461 real(real64), intent(in) :: alpha
4462 real(real64), intent(inout), dimension(:,:) :: a
4463 real(real64), intent(in), dimension(:) :: b
4464 class(errors), intent(inout), optional, target :: err
4465 end subroutine
4466
4467 module subroutine band_diag_mtx_mult_cmplx(left, m, kl, ku, alpha, a, b, err)
4468 logical, intent(in) :: left
4469 integer(int32), intent(in) :: m, kl, ku
4470 complex(real64), intent(in) :: alpha
4471 complex(real64), intent(inout), dimension(:,:) :: a
4472 complex(real64), intent(in), dimension(:) :: b
4473 class(errors), intent(inout), optional, target :: err
4474 end subroutine
4475
4476 module subroutine banded_to_dense_dbl(m, kl, ku, a, x, err)
4477 integer(int32), intent(in) :: m, kl, ku
4478 real(real64), intent(in), dimension(:,:) :: a
4479 real(real64), intent(out), dimension(:,:) :: x
4480 class(errors), intent(inout), optional, target :: err
4481 end subroutine
4482
4483 module subroutine banded_to_dense_cmplx(m, kl, ku, a, x, err)
4484 integer(int32), intent(in) :: m, kl, ku
4485 complex(real64), intent(in), dimension(:,:) :: a
4486 complex(real64), intent(out), dimension(:,:) :: x
4487 class(errors), intent(inout), optional, target :: err
4488 end subroutine
4489
4490 module subroutine dense_to_banded_dbl(a, kl, ku, x, err)
4491 real(real64), intent(in), dimension(:,:) :: a
4492 integer(int32), intent(in) :: kl, ku
4493 real(real64), intent(out), dimension(:,:) :: x
4494 class(errors), intent(inout), optional, target :: err
4495 end subroutine
4496
4497 module subroutine dense_to_banded_cmplx(a, kl, ku, x, err)
4498 complex(real64), intent(in), dimension(:,:) :: a
4499 integer(int32), intent(in) :: kl, ku
4500 complex(real64), intent(out), dimension(:,:) :: x
4501 class(errors), intent(inout), optional, target :: err
4502 end subroutine
4503
4504 module subroutine extract_diagonal_dbl(a, diag, err)
4505 ! Arguments
4506 real(real64), intent(in), dimension(:,:) :: a
4507 real(real64), intent(out), dimension(:) :: diag
4508 class(errors), intent(inout), optional, target :: err
4509 end subroutine
4510
4511 module subroutine extract_diagonal_cmplx(a, diag, err)
4512 ! Arguments
4513 complex(real64), intent(in), dimension(:,:) :: a
4514 complex(real64), intent(out), dimension(:) :: diag
4515 class(errors), intent(inout), optional, target :: err
4516 end subroutine
4517end interface
4518
4519! ******************************************************************************
4520! LINALG_FACTOR.F90
4521! ------------------------------------------------------------------------------
4522interface
4523 module subroutine lu_factor_dbl(a, ipvt, err)
4524 real(real64), intent(inout), dimension(:,:) :: a
4525 integer(int32), intent(out), dimension(:) :: ipvt
4526 class(errors), intent(inout), optional, target :: err
4527 end subroutine
4528
4529 module subroutine lu_factor_cmplx(a, ipvt, err)
4530 complex(real64), intent(inout), dimension(:,:) :: a
4531 integer(int32), intent(out), dimension(:) :: ipvt
4532 class(errors), intent(inout), optional, target :: err
4533 end subroutine
4534
4535 module subroutine form_lu_all(lu, ipvt, u, p, err)
4536 real(real64), intent(inout), dimension(:,:) :: lu
4537 integer(int32), intent(in), dimension(:) :: ipvt
4538 real(real64), intent(out), dimension(:,:) :: u, p
4539 class(errors), intent(inout), optional, target :: err
4540 end subroutine
4541
4542 module subroutine form_lu_all_cmplx(lu, ipvt, u, p, err)
4543 complex(real64), intent(inout), dimension(:,:) :: lu
4544 integer(int32), intent(in), dimension(:) :: ipvt
4545 complex(real64), intent(out), dimension(:,:) :: u
4546 real(real64), intent(out), dimension(:,:) :: p
4547 class(errors), intent(inout), optional, target :: err
4548 end subroutine
4549
4550 module subroutine form_lu_only(lu, u, err)
4551 real(real64), intent(inout), dimension(:,:) :: lu
4552 real(real64), intent(out), dimension(:,:) :: u
4553 class(errors), intent(inout), optional, target :: err
4554 end subroutine
4555
4556 module subroutine form_lu_only_cmplx(lu, u, err)
4557 complex(real64), intent(inout), dimension(:,:) :: lu
4558 complex(real64), intent(out), dimension(:,:) :: u
4559 class(errors), intent(inout), optional, target :: err
4560 end subroutine
4561
4562 module subroutine qr_factor_no_pivot(a, tau, work, olwork, err)
4563 real(real64), intent(inout), dimension(:,:) :: a
4564 real(real64), intent(out), dimension(:) :: tau
4565 real(real64), intent(out), target, dimension(:), optional :: work
4566 integer(int32), intent(out), optional :: olwork
4567 class(errors), intent(inout), optional, target :: err
4568 end subroutine
4569
4570 module subroutine qr_factor_no_pivot_cmplx(a, tau, work, olwork, err)
4571 complex(real64), intent(inout), dimension(:,:) :: a
4572 complex(real64), intent(out), dimension(:) :: tau
4573 complex(real64), intent(out), target, dimension(:), optional :: work
4574 integer(int32), intent(out), optional :: olwork
4575 class(errors), intent(inout), optional, target :: err
4576 end subroutine
4577
4578 module subroutine qr_factor_pivot(a, tau, jpvt, work, olwork, err)
4579 real(real64), intent(inout), dimension(:,:) :: a
4580 real(real64), intent(out), dimension(:) :: tau
4581 integer(int32), intent(inout), dimension(:) :: jpvt
4582 real(real64), intent(out), target, dimension(:), optional :: work
4583 integer(int32), intent(out), optional :: olwork
4584 class(errors), intent(inout), optional, target :: err
4585 end subroutine
4586
4587 module subroutine qr_factor_pivot_cmplx(a, tau, jpvt, work, olwork, rwork, &
4588 err)
4589 complex(real64), intent(inout), dimension(:,:) :: a
4590 complex(real64), intent(out), dimension(:) :: tau
4591 integer(int32), intent(inout), dimension(:) :: jpvt
4592 complex(real64), intent(out), target, dimension(:), optional :: work
4593 integer(int32), intent(out), optional :: olwork
4594 real(real64), intent(out), target, dimension(:), optional :: rwork
4595 class(errors), intent(inout), optional, target :: err
4596 end subroutine
4597
4598 module subroutine form_qr_no_pivot(r, tau, q, work, olwork, err)
4599 real(real64), intent(inout), dimension(:,:) :: r
4600 real(real64), intent(in), dimension(:) :: tau
4601 real(real64), intent(out), dimension(:,:) :: q
4602 real(real64), intent(out), target, dimension(:), optional :: work
4603 integer(int32), intent(out), optional :: olwork
4604 class(errors), intent(inout), optional, target :: err
4605 end subroutine
4606
4607 module subroutine form_qr_no_pivot_cmplx(r, tau, q, work, olwork, err)
4608 complex(real64), intent(inout), dimension(:,:) :: r
4609 complex(real64), intent(in), dimension(:) :: tau
4610 complex(real64), intent(out), dimension(:,:) :: q
4611 complex(real64), intent(out), target, dimension(:), optional :: work
4612 integer(int32), intent(out), optional :: olwork
4613 class(errors), intent(inout), optional, target :: err
4614 end subroutine
4615
4616 module subroutine form_qr_pivot(r, tau, pvt, q, p, work, olwork, err)
4617 real(real64), intent(inout), dimension(:,:) :: r
4618 real(real64), intent(in), dimension(:) :: tau
4619 integer(int32), intent(in), dimension(:) :: pvt
4620 real(real64), intent(out), dimension(:,:) :: q, p
4621 real(real64), intent(out), target, dimension(:), optional :: work
4622 integer(int32), intent(out), optional :: olwork
4623 class(errors), intent(inout), optional, target :: err
4624 end subroutine
4625
4626 module subroutine form_qr_pivot_cmplx(r, tau, pvt, q, p, work, olwork, err)
4627 complex(real64), intent(inout), dimension(:,:) :: r
4628 complex(real64), intent(in), dimension(:) :: tau
4629 integer(int32), intent(in), dimension(:) :: pvt
4630 complex(real64), intent(out), dimension(:,:) :: q, p
4631 complex(real64), intent(out), target, dimension(:), optional :: work
4632 integer(int32), intent(out), optional :: olwork
4633 class(errors), intent(inout), optional, target :: err
4634 end subroutine
4635
4636 module subroutine mult_qr_mtx(lside, trans, a, tau, c, work, olwork, err)
4637 logical, intent(in) :: lside, trans
4638 real(real64), intent(in), dimension(:) :: tau
4639 real(real64), intent(inout), dimension(:,:) :: a, c
4640 real(real64), intent(out), target, dimension(:), optional :: work
4641 integer(int32), intent(out), optional :: olwork
4642 class(errors), intent(inout), optional, target :: err
4643 end subroutine
4644
4645 module subroutine mult_qr_mtx_cmplx(lside, trans, a, tau, c, work, olwork, err)
4646 logical, intent(in) :: lside, trans
4647 complex(real64), intent(in), dimension(:) :: tau
4648 complex(real64), intent(inout), dimension(:,:) :: a, c
4649 complex(real64), intent(out), target, dimension(:), optional :: work
4650 integer(int32), intent(out), optional :: olwork
4651 class(errors), intent(inout), optional, target :: err
4652 end subroutine
4653
4654 module subroutine mult_qr_vec(trans, a, tau, c, work, olwork, err)
4655 logical, intent(in) :: trans
4656 real(real64), intent(inout), dimension(:,:) :: a
4657 real(real64), intent(in), dimension(:) :: tau
4658 real(real64), intent(inout), dimension(:) :: c
4659 real(real64), intent(out), target, dimension(:), optional :: work
4660 integer(int32), intent(out), optional :: olwork
4661 class(errors), intent(inout), optional, target :: err
4662 end subroutine
4663
4664 module subroutine mult_qr_vec_cmplx(trans, a, tau, c, work, olwork, err)
4665 logical, intent(in) :: trans
4666 complex(real64), intent(inout), dimension(:,:) :: a
4667 complex(real64), intent(in), dimension(:) :: tau
4668 complex(real64), intent(inout), dimension(:) :: c
4669 complex(real64), intent(out), target, dimension(:), optional :: work
4670 integer(int32), intent(out), optional :: olwork
4671 class(errors), intent(inout), optional, target :: err
4672 end subroutine
4673
4674 module subroutine qr_rank1_update_dbl(q, r, u, v, work, err)
4675 real(real64), intent(inout), dimension(:,:) :: q, r
4676 real(real64), intent(inout), dimension(:) :: u, v
4677 real(real64), intent(out), target, optional, dimension(:) :: work
4678 class(errors), intent(inout), optional, target :: err
4679 end subroutine
4680
4681 module subroutine qr_rank1_update_cmplx(q, r, u, v, work, rwork, err)
4682 complex(real64), intent(inout), dimension(:,:) :: q, r
4683 complex(real64), intent(inout), dimension(:) :: u, v
4684 complex(real64), intent(out), target, optional, dimension(:) :: work
4685 real(real64), intent(out), target, optional, dimension(:) :: rwork
4686 class(errors), intent(inout), optional, target :: err
4687 end subroutine
4688
4689 module subroutine cholesky_factor_dbl(a, upper, err)
4690 real(real64), intent(inout), dimension(:,:) :: a
4691 logical, intent(in), optional :: upper
4692 class(errors), intent(inout), optional, target :: err
4693 end subroutine
4694
4695 module subroutine cholesky_factor_cmplx(a, upper, err)
4696 complex(real64), intent(inout), dimension(:,:) :: a
4697 logical, intent(in), optional :: upper
4698 class(errors), intent(inout), optional, target :: err
4699 end subroutine
4700
4701 module subroutine cholesky_rank1_update_dbl(r, u, work, err)
4702 real(real64), intent(inout), dimension(:,:) :: r
4703 real(real64), intent(inout), dimension(:) :: u
4704 real(real64), intent(out), target, optional, dimension(:) :: work
4705 class(errors), intent(inout), optional, target :: err
4706 end subroutine
4707
4708 module subroutine cholesky_rank1_update_cmplx(r, u, work, err)
4709 complex(real64), intent(inout), dimension(:,:) :: r
4710 complex(real64), intent(inout), dimension(:) :: u
4711 real(real64), intent(out), target, optional, dimension(:) :: work
4712 class(errors), intent(inout), optional, target :: err
4713 end subroutine
4714
4715 module subroutine cholesky_rank1_downdate_dbl(r, u, work, err)
4716 real(real64), intent(inout), dimension(:,:) :: r
4717 real(real64), intent(inout), dimension(:) :: u
4718 real(real64), intent(out), target, optional, dimension(:) :: work
4719 class(errors), intent(inout), optional, target :: err
4720 end subroutine
4721
4722 module subroutine cholesky_rank1_downdate_cmplx(r, u, work, err)
4723 complex(real64), intent(inout), dimension(:,:) :: r
4724 complex(real64), intent(inout), dimension(:) :: u
4725 real(real64), intent(out), target, optional, dimension(:) :: work
4726 class(errors), intent(inout), optional, target :: err
4727 end subroutine
4728
4729 module subroutine rz_factor_dbl(a, tau, work, olwork, err)
4730 real(real64), intent(inout), dimension(:,:) :: a
4731 real(real64), intent(out), dimension(:) :: tau
4732 real(real64), intent(out), target, optional, dimension(:) :: work
4733 integer(int32), intent(out), optional :: olwork
4734 class(errors), intent(inout), optional, target :: err
4735 end subroutine
4736
4737 module subroutine rz_factor_cmplx(a, tau, work, olwork, err)
4738 complex(real64), intent(inout), dimension(:,:) :: a
4739 complex(real64), intent(out), dimension(:) :: tau
4740 complex(real64), intent(out), target, optional, dimension(:) :: work
4741 integer(int32), intent(out), optional :: olwork
4742 class(errors), intent(inout), optional, target :: err
4743 end subroutine
4744
4745 module subroutine mult_rz_mtx(lside, trans, l, a, tau, c, work, olwork, err)
4746 logical, intent(in) :: lside, trans
4747 integer(int32), intent(in) :: l
4748 real(real64), intent(inout), dimension(:,:) :: a, c
4749 real(real64), intent(in), dimension(:) :: tau
4750 real(real64), intent(out), target, optional, dimension(:) :: work
4751 integer(int32), intent(out), optional :: olwork
4752 class(errors), intent(inout), optional, target :: err
4753 end subroutine
4754
4755 module subroutine mult_rz_mtx_cmplx(lside, trans, l, a, tau, c, work, olwork, err)
4756 logical, intent(in) :: lside, trans
4757 integer(int32), intent(in) :: l
4758 complex(real64), intent(inout), dimension(:,:) :: a, c
4759 complex(real64), intent(in), dimension(:) :: tau
4760 complex(real64), intent(out), target, optional, dimension(:) :: work
4761 integer(int32), intent(out), optional :: olwork
4762 class(errors), intent(inout), optional, target :: err
4763 end subroutine
4764
4765 module subroutine mult_rz_vec(trans, l, a, tau, c, work, olwork, err)
4766 logical, intent(in) :: trans
4767 integer(int32), intent(in) :: l
4768 real(real64), intent(inout), dimension(:,:) :: a
4769 real(real64), intent(in), dimension(:) :: tau
4770 real(real64), intent(inout), dimension(:) :: c
4771 real(real64), intent(out), target, optional, dimension(:) :: work
4772 integer(int32), intent(out), optional :: olwork
4773 class(errors), intent(inout), optional, target :: err
4774 end subroutine
4775
4776 module subroutine mult_rz_vec_cmplx(trans, l, a, tau, c, work, olwork, err)
4777 logical, intent(in) :: trans
4778 integer(int32), intent(in) :: l
4779 complex(real64), intent(inout), dimension(:,:) :: a
4780 complex(real64), intent(in), dimension(:) :: tau
4781 complex(real64), intent(inout), dimension(:) :: c
4782 complex(real64), intent(out), target, optional, dimension(:) :: work
4783 integer(int32), intent(out), optional :: olwork
4784 class(errors), intent(inout), optional, target :: err
4785 end subroutine
4786
4787 module subroutine svd_dbl(a, s, u, vt, work, olwork, err)
4788 real(real64), intent(inout), dimension(:,:) :: a
4789 real(real64), intent(out), dimension(:) :: s
4790 real(real64), intent(out), optional, dimension(:,:) :: u, vt
4791 real(real64), intent(out), target, optional, dimension(:) :: work
4792 integer(int32), intent(out), optional :: olwork
4793 class(errors), intent(inout), optional, target :: err
4794 end subroutine
4795
4796 module subroutine svd_cmplx(a, s, u, vt, work, olwork, rwork, err)
4797 complex(real64), intent(inout), dimension(:,:) :: a
4798 real(real64), intent(out), dimension(:) :: s
4799 complex(real64), intent(out), optional, dimension(:,:) :: u, vt
4800 complex(real64), intent(out), target, optional, dimension(:) :: work
4801 integer(int32), intent(out), optional :: olwork
4802 real(real64), intent(out), target, optional, dimension(:) :: rwork
4803 class(errors), intent(inout), optional, target :: err
4804 end subroutine
4805
4806 module subroutine lq_factor_no_pivot(a, tau, work, olwork, err)
4807 real(real64), intent(inout), dimension(:,:) :: a
4808 real(real64), intent(out), dimension(:) :: tau
4809 real(real64), intent(out), target, dimension(:), optional :: work
4810 integer(int32), intent(out), optional :: olwork
4811 class(errors), intent(inout), optional, target :: err
4812 end subroutine
4813
4814 module subroutine lq_factor_no_pivot_cmplx(a, tau, work, olwork, err)
4815 complex(real64), intent(inout), dimension(:,:) :: a
4816 complex(real64), intent(out), dimension(:) :: tau
4817 complex(real64), intent(out), target, dimension(:), optional :: work
4818 integer(int32), intent(out), optional :: olwork
4819 class(errors), intent(inout), optional, target :: err
4820 end subroutine
4821
4822 module subroutine form_lq_no_pivot(l, tau, q, work, olwork, err)
4823 real(real64), intent(inout), dimension(:,:) :: l
4824 real(real64), intent(in), dimension(:) :: tau
4825 real(real64), intent(out), dimension(:,:) :: q
4826 real(real64), intent(out), target, dimension(:), optional :: work
4827 integer(int32), intent(out), optional :: olwork
4828 class(errors), intent(inout), optional, target :: err
4829 end subroutine
4830
4831 module subroutine form_lq_no_pivot_cmplx(l, tau, q, work, olwork, err)
4832 complex(real64), intent(inout), dimension(:,:) :: l
4833 complex(real64), intent(in), dimension(:) :: tau
4834 complex(real64), intent(out), dimension(:,:) :: q
4835 complex(real64), intent(out), target, dimension(:), optional :: work
4836 integer(int32), intent(out), optional :: olwork
4837 class(errors), intent(inout), optional, target :: err
4838 end subroutine
4839
4840 module subroutine mult_lq_mtx(lside, trans, a, tau, c, work, olwork, err)
4841 logical, intent(in) :: lside, trans
4842 real(real64), intent(in), dimension(:,:) :: a
4843 real(real64), intent(in), dimension(:) :: tau
4844 real(real64), intent(inout), dimension(:,:) :: c
4845 real(real64), intent(out), target, dimension(:), optional :: work
4846 integer(int32), intent(out), optional :: olwork
4847 class(errors), intent(inout), optional, target :: err
4848 end subroutine
4849
4850 module subroutine mult_lq_mtx_cmplx(lside, trans, a, tau, c, work, olwork, err)
4851 logical, intent(in) :: lside, trans
4852 complex(real64), intent(in), dimension(:,:) :: a
4853 complex(real64), intent(in), dimension(:) :: tau
4854 complex(real64), intent(inout), dimension(:,:) :: c
4855 complex(real64), intent(out), target, dimension(:), optional :: work
4856 integer(int32), intent(out), optional :: olwork
4857 class(errors), intent(inout), optional, target :: err
4858 end subroutine
4859
4860 module subroutine mult_lq_vec(trans, a, tau, c, work, olwork, err)
4861 logical, intent(in) :: trans
4862 real(real64), intent(in), dimension(:,:) :: a
4863 real(real64), intent(in), dimension(:) :: tau
4864 real(real64), intent(inout), dimension(:) :: c
4865 real(real64), intent(out), target, dimension(:), optional :: work
4866 integer(int32), intent(out), optional :: olwork
4867 class(errors), intent(inout), optional, target :: err
4868 end subroutine
4869
4870 module subroutine mult_lq_vec_cmplx(trans, a, tau, c, work, olwork, err)
4871 logical, intent(in) :: trans
4872 complex(real64), intent(in), dimension(:,:) :: a
4873 complex(real64), intent(in), dimension(:) :: tau
4874 complex(real64), intent(inout), dimension(:) :: c
4875 complex(real64), intent(out), target, dimension(:), optional :: work
4876 integer(int32), intent(out), optional :: olwork
4877 class(errors), intent(inout), optional, target :: err
4878 end subroutine
4879end interface
4880
4881! ******************************************************************************
4882! LINALG_SOLVE.F90
4883! ------------------------------------------------------------------------------
4884interface
4885 module subroutine solve_tri_mtx(lside, upper, trans, nounit, alpha, a, b, err)
4886 logical, intent(in) :: lside, upper, trans, nounit
4887 real(real64), intent(in) :: alpha
4888 real(real64), intent(in), dimension(:,:) :: a
4889 real(real64), intent(inout), dimension(:,:) :: b
4890 class(errors), intent(inout), optional, target :: err
4891 end subroutine
4892
4893 module subroutine solve_tri_mtx_cmplx(lside, upper, trans, nounit, alpha, a, b, err)
4894 logical, intent(in) :: lside, upper, trans, nounit
4895 complex(real64), intent(in) :: alpha
4896 complex(real64), intent(in), dimension(:,:) :: a
4897 complex(real64), intent(inout), dimension(:,:) :: b
4898 class(errors), intent(inout), optional, target :: err
4899 end subroutine
4900
4901 module subroutine solve_tri_vec(upper, trans, nounit, a, x, err)
4902 logical, intent(in) :: upper, trans, nounit
4903 real(real64), intent(in), dimension(:,:) :: a
4904 real(real64), intent(inout), dimension(:) :: x
4905 class(errors), intent(inout), optional, target :: err
4906 end subroutine
4907
4908 module subroutine solve_tri_vec_cmplx(upper, trans, nounit, a, x, err)
4909 logical, intent(in) :: upper, trans, nounit
4910 complex(real64), intent(in), dimension(:,:) :: a
4911 complex(real64), intent(inout), dimension(:) :: x
4912 class(errors), intent(inout), optional, target :: err
4913 end subroutine
4914
4915 module subroutine solve_lu_mtx(a, ipvt, b, err)
4916 real(real64), intent(in), dimension(:,:) :: a
4917 integer(int32), intent(in), dimension(:) :: ipvt
4918 real(real64), intent(inout), dimension(:,:) :: b
4919 class(errors), intent(inout), optional, target :: err
4920 end subroutine
4921
4922 module subroutine solve_lu_mtx_cmplx(a, ipvt, b, err)
4923 complex(real64), intent(in), dimension(:,:) :: a
4924 integer(int32), intent(in), dimension(:) :: ipvt
4925 complex(real64), intent(inout), dimension(:,:) :: b
4926 class(errors), intent(inout), optional, target :: err
4927 end subroutine
4928
4929 module subroutine solve_lu_vec(a, ipvt, b, err)
4930 real(real64), intent(in), dimension(:,:) :: a
4931 integer(int32), intent(in), dimension(:) :: ipvt
4932 real(real64), intent(inout), dimension(:) :: b
4933 class(errors), intent(inout), optional, target :: err
4934 end subroutine
4935
4936 module subroutine solve_lu_vec_cmplx(a, ipvt, b, err)
4937 complex(real64), intent(in), dimension(:,:) :: a
4938 integer(int32), intent(in), dimension(:) :: ipvt
4939 complex(real64), intent(inout), dimension(:) :: b
4940 class(errors), intent(inout), optional, target :: err
4941 end subroutine
4942
4943 module subroutine solve_qr_no_pivot_mtx(a, tau, b, work, olwork, err)
4944 real(real64), intent(inout), dimension(:,:) :: a, b
4945 real(real64), intent(in), dimension(:) :: tau
4946 real(real64), intent(out), target, optional, dimension(:) :: work
4947 integer(int32), intent(out), optional :: olwork
4948 class(errors), intent(inout), optional, target :: err
4949 end subroutine
4950
4951 module subroutine solve_qr_no_pivot_mtx_cmplx(a, tau, b, work, olwork, err)
4952 complex(real64), intent(inout), dimension(:,:) :: a, b
4953 complex(real64), intent(in), dimension(:) :: tau
4954 complex(real64), intent(out), target, optional, dimension(:) :: work
4955 integer(int32), intent(out), optional :: olwork
4956 class(errors), intent(inout), optional, target :: err
4957 end subroutine
4958
4959 module subroutine solve_qr_no_pivot_vec(a, tau, b, work, olwork, err)
4960 real(real64), intent(inout), dimension(:,:) :: a
4961 real(real64), intent(in), dimension(:) :: tau
4962 real(real64), intent(inout), dimension(:) :: b
4963 real(real64), intent(out), target, optional, dimension(:) :: work
4964 integer(int32), intent(out), optional :: olwork
4965 class(errors), intent(inout), optional, target :: err
4966 end subroutine
4967
4968 module subroutine solve_qr_no_pivot_vec_cmplx(a, tau, b, work, olwork, err)
4969 complex(real64), intent(inout), dimension(:,:) :: a
4970 complex(real64), intent(in), dimension(:) :: tau
4971 complex(real64), intent(inout), dimension(:) :: b
4972 complex(real64), intent(out), target, optional, dimension(:) :: work
4973 integer(int32), intent(out), optional :: olwork
4974 class(errors), intent(inout), optional, target :: err
4975 end subroutine
4976
4977 module subroutine solve_qr_pivot_mtx(a, tau, jpvt, b, work, olwork, err)
4978 real(real64), intent(inout), dimension(:,:) :: a
4979 real(real64), intent(in), dimension(:) :: tau
4980 integer(int32), intent(in), dimension(:) :: jpvt
4981 real(real64), intent(inout), dimension(:,:) :: b
4982 real(real64), intent(out), target, optional, dimension(:) :: work
4983 integer(int32), intent(out), optional :: olwork
4984 class(errors), intent(inout), optional, target :: err
4985 end subroutine
4986
4987 module subroutine solve_qr_pivot_mtx_cmplx(a, tau, jpvt, b, work, olwork, err)
4988 complex(real64), intent(inout), dimension(:,:) :: a
4989 complex(real64), intent(in), dimension(:) :: tau
4990 integer(int32), intent(in), dimension(:) :: jpvt
4991 complex(real64), intent(inout), dimension(:,:) :: b
4992 complex(real64), intent(out), target, optional, dimension(:) :: work
4993 integer(int32), intent(out), optional :: olwork
4994 class(errors), intent(inout), optional, target :: err
4995 end subroutine
4996
4997 module subroutine solve_qr_pivot_vec(a, tau, jpvt, b, work, olwork, err)
4998 real(real64), intent(inout), dimension(:,:) :: a
4999 real(real64), intent(in), dimension(:) :: tau
5000 integer(int32), intent(in), dimension(:) :: jpvt
5001 real(real64), intent(inout), dimension(:) :: b
5002 real(real64), intent(out), target, optional, dimension(:) :: work
5003 integer(int32), intent(out), optional :: olwork
5004 class(errors), intent(inout), optional, target :: err
5005 end subroutine
5006
5007 module subroutine solve_qr_pivot_vec_cmplx(a, tau, jpvt, b, work, olwork, err)
5008 complex(real64), intent(inout), dimension(:,:) :: a
5009 complex(real64), intent(in), dimension(:) :: tau
5010 integer(int32), intent(in), dimension(:) :: jpvt
5011 complex(real64), intent(inout), dimension(:) :: b
5012 complex(real64), intent(out), target, optional, dimension(:) :: work
5013 integer(int32), intent(out), optional :: olwork
5014 class(errors), intent(inout), optional, target :: err
5015 end subroutine
5016
5017 module subroutine solve_cholesky_mtx(upper, a, b, err)
5018 logical, intent(in) :: upper
5019 real(real64), intent(in), dimension(:,:) :: a
5020 real(real64), intent(inout), dimension(:,:) :: b
5021 class(errors), intent(inout), optional, target :: err
5022 end subroutine
5023
5024 module subroutine solve_cholesky_mtx_cmplx(upper, a, b, err)
5025 logical, intent(in) :: upper
5026 complex(real64), intent(in), dimension(:,:) :: a
5027 complex(real64), intent(inout), dimension(:,:) :: b
5028 class(errors), intent(inout), optional, target :: err
5029 end subroutine
5030
5031 module subroutine solve_cholesky_vec(upper, a, b, err)
5032 logical, intent(in) :: upper
5033 real(real64), intent(in), dimension(:,:) :: a
5034 real(real64), intent(inout), dimension(:) :: b
5035 class(errors), intent(inout), optional, target :: err
5036 end subroutine
5037
5038 module subroutine solve_cholesky_vec_cmplx(upper, a, b, err)
5039 logical, intent(in) :: upper
5040 complex(real64), intent(in), dimension(:,:) :: a
5041 complex(real64), intent(inout), dimension(:) :: b
5042 class(errors), intent(inout), optional, target :: err
5043 end subroutine
5044
5045 module subroutine solve_least_squares_mtx(a, b, work, olwork, err)
5046 real(real64), intent(inout), dimension(:,:) :: a, b
5047 real(real64), intent(out), target, optional, dimension(:) :: work
5048 integer(int32), intent(out), optional :: olwork
5049 class(errors), intent(inout), optional, target :: err
5050 end subroutine
5051
5052 module subroutine solve_least_squares_mtx_cmplx(a, b, work, olwork, err)
5053 complex(real64), intent(inout), dimension(:,:) :: a, b
5054 complex(real64), intent(out), target, optional, dimension(:) :: work
5055 integer(int32), intent(out), optional :: olwork
5056 class(errors), intent(inout), optional, target :: err
5057 end subroutine
5058
5059 module subroutine solve_least_squares_vec(a, b, work, olwork, err)
5060 real(real64), intent(inout), dimension(:,:) :: a
5061 real(real64), intent(inout), dimension(:) :: b
5062 real(real64), intent(out), target, optional, dimension(:) :: work
5063 integer(int32), intent(out), optional :: olwork
5064 class(errors), intent(inout), optional, target :: err
5065 end subroutine
5066
5067 module subroutine solve_least_squares_vec_cmplx(a, b, work, olwork, err)
5068 complex(real64), intent(inout), dimension(:,:) :: a
5069 complex(real64), intent(inout), dimension(:) :: b
5070 complex(real64), intent(out), target, optional, dimension(:) :: work
5071 integer(int32), intent(out), optional :: olwork
5072 class(errors), intent(inout), optional, target :: err
5073 end subroutine
5074
5075 module subroutine solve_least_squares_mtx_pvt(a, b, ipvt, arnk, work, olwork, err)
5076 real(real64), intent(inout), dimension(:,:) :: a, b
5077 integer(int32), intent(inout), target, optional, dimension(:) :: ipvt
5078 integer(int32), intent(out), optional :: arnk
5079 real(real64), intent(out), target, optional, dimension(:) :: work
5080 integer(int32), intent(out), optional :: olwork
5081 class(errors), intent(inout), optional, target :: err
5082 end subroutine
5083
5084 module subroutine solve_least_squares_mtx_pvt_cmplx(a, b, ipvt, arnk, &
5085 work, olwork, rwork, err)
5086 complex(real64), intent(inout), dimension(:,:) :: a, b
5087 integer(int32), intent(inout), target, optional, dimension(:) :: ipvt
5088 integer(int32), intent(out), optional :: arnk
5089 complex(real64), intent(out), target, optional, dimension(:) :: work
5090 integer(int32), intent(out), optional :: olwork
5091 real(real64), intent(out), target, optional, dimension(:) :: rwork
5092 class(errors), intent(inout), optional, target :: err
5093 end subroutine
5094
5095 module subroutine solve_least_squares_vec_pvt(a, b, ipvt, arnk, work, olwork, err)
5096 real(real64), intent(inout), dimension(:,:) :: a
5097 real(real64), intent(inout), dimension(:) :: b
5098 integer(int32), intent(inout), target, optional, dimension(:) :: ipvt
5099 integer(int32), intent(out), optional :: arnk
5100 real(real64), intent(out), target, optional, dimension(:) :: work
5101 integer(int32), intent(out), optional :: olwork
5102 class(errors), intent(inout), optional, target :: err
5103 end subroutine
5104
5105 module subroutine solve_least_squares_vec_pvt_cmplx(a, b, ipvt, arnk, &
5106 work, olwork, rwork, err)
5107 complex(real64), intent(inout), dimension(:,:) :: a
5108 complex(real64), intent(inout), dimension(:) :: b
5109 integer(int32), intent(inout), target, optional, dimension(:) :: ipvt
5110 integer(int32), intent(out), optional :: arnk
5111 complex(real64), intent(out), target, optional, dimension(:) :: work
5112 integer(int32), intent(out), optional :: olwork
5113 real(real64), intent(out), target, optional, dimension(:) :: rwork
5114 class(errors), intent(inout), optional, target :: err
5115 end subroutine
5116
5117 module subroutine solve_least_squares_mtx_svd(a, b, s, arnk, work, olwork, err)
5118 real(real64), intent(inout), dimension(:,:) :: a, b
5119 integer(int32), intent(out), optional :: arnk
5120 real(real64), intent(out), target, optional, dimension(:) :: work, s
5121 integer(int32), intent(out), optional :: olwork
5122 class(errors), intent(inout), optional, target :: err
5123 end subroutine
5124
5125 module subroutine solve_least_squares_mtx_svd_cmplx(a, b, s, arnk, work, &
5126 olwork, rwork, err)
5127 complex(real64), intent(inout), dimension(:,:) :: a, b
5128 integer(int32), intent(out), optional :: arnk
5129 complex(real64), intent(out), target, optional, dimension(:) :: work
5130 real(real64), intent(out), target, optional, dimension(:) :: rwork, s
5131 integer(int32), intent(out), optional :: olwork
5132 class(errors), intent(inout), optional, target :: err
5133 end subroutine
5134
5135 module subroutine solve_least_squares_vec_svd(a, b, s, arnk, work, olwork, err)
5136 real(real64), intent(inout), dimension(:,:) :: a
5137 real(real64), intent(inout), dimension(:) :: b
5138 integer(int32), intent(out), optional :: arnk
5139 real(real64), intent(out), target, optional, dimension(:) :: work, s
5140 integer(int32), intent(out), optional :: olwork
5141 class(errors), intent(inout), optional, target :: err
5142 end subroutine
5143
5144 module subroutine solve_least_squares_vec_svd_cmplx(a, b, s, arnk, work, &
5145 olwork, rwork, err)
5146 complex(real64), intent(inout), dimension(:,:) :: a
5147 complex(real64), intent(inout), dimension(:) :: b
5148 integer(int32), intent(out), optional :: arnk
5149 complex(real64), intent(out), target, optional, dimension(:) :: work
5150 real(real64), intent(out), target, optional, dimension(:) :: rwork, s
5151 integer(int32), intent(out), optional :: olwork
5152 class(errors), intent(inout), optional, target :: err
5153 end subroutine
5154
5155 module subroutine mtx_inverse_dbl(a, iwork, work, olwork, err)
5156 real(real64), intent(inout), dimension(:,:) :: a
5157 integer(int32), intent(out), target, optional, dimension(:) :: iwork
5158 real(real64), intent(out), target, optional, dimension(:) :: work
5159 integer(int32), intent(out), optional :: olwork
5160 class(errors), intent(inout), optional, target :: err
5161 end subroutine
5162
5163 module subroutine mtx_inverse_cmplx(a, iwork, work, olwork, err)
5164 complex(real64), intent(inout), dimension(:,:) :: a
5165 integer(int32), intent(out), target, optional, dimension(:) :: iwork
5166 complex(real64), intent(out), target, optional, dimension(:) :: work
5167 integer(int32), intent(out), optional :: olwork
5168 class(errors), intent(inout), optional, target :: err
5169 end subroutine
5170
5171 module subroutine mtx_pinverse_dbl(a, ainv, tol, work, olwork, err)
5172 real(real64), intent(inout), dimension(:,:) :: a
5173 real(real64), intent(out), dimension(:,:) :: ainv
5174 real(real64), intent(in), optional :: tol
5175 real(real64), intent(out), target, dimension(:), optional :: work
5176 integer(int32), intent(out), optional :: olwork
5177 class(errors), intent(inout), optional, target :: err
5178 end subroutine
5179
5180 module subroutine mtx_pinverse_cmplx(a, ainv, tol, work, olwork, rwork, err)
5181 complex(real64), intent(inout), dimension(:,:) :: a
5182 complex(real64), intent(out), dimension(:,:) :: ainv
5183 real(real64), intent(in), optional :: tol
5184 complex(real64), intent(out), target, dimension(:), optional :: work
5185 integer(int32), intent(out), optional :: olwork
5186 real(real64), intent(out), target, dimension(:), optional :: rwork
5187 class(errors), intent(inout), optional, target :: err
5188 end subroutine
5189
5190 module subroutine solve_lq_mtx(a, tau, b, work, olwork, err)
5191 real(real64), intent(in), dimension(:,:) :: a
5192 real(real64), intent(in), dimension(:) :: tau
5193 real(real64), intent(inout), dimension(:,:) :: b
5194 real(real64), intent(out), target, optional, dimension(:) :: work
5195 integer(int32), intent(out), optional :: olwork
5196 class(errors), intent(inout), optional, target :: err
5197 end subroutine
5198
5199 module subroutine solve_lq_mtx_cmplx(a, tau, b, work, olwork, err)
5200 complex(real64), intent(in), dimension(:,:) :: a
5201 complex(real64), intent(in), dimension(:) :: tau
5202 complex(real64), intent(inout), dimension(:,:) :: b
5203 complex(real64), intent(out), target, optional, dimension(:) :: work
5204 integer(int32), intent(out), optional :: olwork
5205 class(errors), intent(inout), optional, target :: err
5206 end subroutine
5207
5208 module subroutine solve_lq_vec(a, tau, b, work, olwork, err)
5209 real(real64), intent(in), dimension(:,:) :: a
5210 real(real64), intent(in), dimension(:) :: tau
5211 real(real64), intent(inout), dimension(:) :: b
5212 real(real64), intent(out), target, optional, dimension(:) :: work
5213 integer(int32), intent(out), optional :: olwork
5214 class(errors), intent(inout), optional, target :: err
5215 end subroutine
5216
5217 module subroutine solve_lq_vec_cmplx(a, tau, b, work, olwork, err)
5218 complex(real64), intent(in), dimension(:,:) :: a
5219 complex(real64), intent(in), dimension(:) :: tau
5220 complex(real64), intent(inout), dimension(:) :: b
5221 complex(real64), intent(out), target, optional, dimension(:) :: work
5222 integer(int32), intent(out), optional :: olwork
5223 class(errors), intent(inout), optional, target :: err
5224 end subroutine
5225end interface
5226
5227! ******************************************************************************
5228! LINALG_EIGEN.F90
5229! ------------------------------------------------------------------------------
5230interface
5231 module subroutine eigen_symm(vecs, a, vals, work, olwork, err)
5232 logical, intent(in) :: vecs
5233 real(real64), intent(inout), dimension(:,:) :: a
5234 real(real64), intent(out), dimension(:) :: vals
5235 real(real64), intent(out), pointer, optional, dimension(:) :: work
5236 integer(int32), intent(out), optional :: olwork
5237 class(errors), intent(inout), optional, target :: err
5238 end subroutine
5239
5240 module subroutine eigen_asymm(a, vals, vecs, work, olwork, err)
5241 real(real64), intent(inout), dimension(:,:) :: a
5242 complex(real64), intent(out), dimension(:) :: vals
5243 complex(real64), intent(out), optional, dimension(:,:) :: vecs
5244 real(real64), intent(out), pointer, optional, dimension(:) :: work
5245 integer(int32), intent(out), optional :: olwork
5246 class(errors), intent(inout), optional, target :: err
5247 end subroutine
5248
5249 module subroutine eigen_gen(a, b, alpha, beta, vecs, work, olwork, err)
5250 real(real64), intent(inout), dimension(:,:) :: a, b
5251 complex(real64), intent(out), dimension(:) :: alpha
5252 real(real64), intent(out), optional, dimension(:) :: beta
5253 complex(real64), intent(out), optional, dimension(:,:) :: vecs
5254 real(real64), intent(out), optional, pointer, dimension(:) :: work
5255 integer(int32), intent(out), optional :: olwork
5256 class(errors), intent(inout), optional, target :: err
5257 end subroutine
5258
5259 module subroutine eigen_cmplx(a, vals, vecs, work, olwork, rwork, err)
5260 complex(real64), intent(inout), dimension(:,:) :: a
5261 complex(real64), intent(out), dimension(:) :: vals
5262 complex(real64), intent(out), optional, dimension(:,:) :: vecs
5263 complex(real64), intent(out), target, optional, dimension(:) :: work
5264 real(real64), intent(out), target, optional, dimension(:) :: rwork
5265 integer(int32), intent(out), optional :: olwork
5266 class(errors), intent(inout), optional, target :: err
5267 end subroutine
5268end interface
5269
5270! ******************************************************************************
5271! LINALG_SORTING.F90
5272! ------------------------------------------------------------------------------
5273interface
5274 module subroutine sort_dbl_array(x, ascend)
5275 real(real64), intent(inout), dimension(:) :: x
5276 logical, intent(in), optional :: ascend
5277 end subroutine
5278
5279 module subroutine sort_dbl_array_ind(x, ind, ascend, err)
5280 real(real64), intent(inout), dimension(:) :: x
5281 integer(int32), intent(inout), dimension(:) :: ind
5282 logical, intent(in), optional :: ascend
5283 class(errors), intent(inout), optional, target :: err
5284 end subroutine
5285
5286 module subroutine sort_cmplx_array(x, ascend)
5287 complex(real64), intent(inout), dimension(:) :: x
5288 logical, intent(in), optional :: ascend
5289 end subroutine
5290
5291 module subroutine sort_cmplx_array_ind(x, ind, ascend, err)
5292 complex(real64), intent(inout), dimension(:) :: x
5293 integer(int32), intent(inout), dimension(:) :: ind
5294 logical, intent(in), optional :: ascend
5295 class(errors), intent(inout), optional, target :: err
5296 end subroutine
5297
5298 module subroutine sort_eigen_cmplx(vals, vecs, ascend, err)
5299 complex(real64), intent(inout), dimension(:) :: vals
5300 complex(real64), intent(inout), dimension(:,:) :: vecs
5301 logical, intent(in), optional :: ascend
5302 class(errors), intent(inout), optional, target :: err
5303 end subroutine
5304
5305 module subroutine sort_eigen_dbl(vals, vecs, ascend, err)
5306 real(real64), intent(inout), dimension(:) :: vals
5307 real(real64), intent(inout), dimension(:,:) :: vecs
5308 logical, intent(in), optional :: ascend
5309 class(errors), intent(inout), optional, target :: err
5310 end subroutine
5311
5312 module subroutine sort_int32_array(x, ascend)
5313 integer(int32), intent(inout), dimension(:) :: x
5314 logical, intent(in), optional :: ascend
5315 end subroutine
5316
5317 module subroutine sort_int32_array_ind(x, ind, ascend, err)
5318 integer(int32), intent(inout), dimension(:) :: x
5319 integer(int32), intent(inout), dimension(:) :: ind
5320 logical, intent(in), optional :: ascend
5321 class(errors), intent(inout), optional, target :: err
5322 end subroutine
5323end interface
5324
5325! ******************************************************************************
5326! LINALG_SPARSE.F90
5327! ------------------------------------------------------------------------------
5338 interface nonzero_count
5339 module procedure :: nonzero_count_csr
5340 module procedure :: nonzero_count_msr
5341 end interface
5342
5356 interface size
5357 module procedure :: csr_size
5358 module procedure :: msr_size
5359 end interface
5360
5382 interface matmul
5383 module procedure :: csr_mtx_mtx_mult
5384 module procedure :: csr_mtx_vec_mult
5385 end interface
5386
5398 interface operator(+)
5399 module procedure :: csr_mtx_add
5400 end interface
5401
5413 interface operator(-)
5414 module procedure :: csr_mtx_sub
5415 end interface
5416
5429 interface operator(*)
5430 module procedure :: csr_mtx_mult_scalar_1
5431 module procedure :: csr_mtx_mult_scalar_2
5432 end interface
5433
5445 interface operator(/)
5446 module procedure :: csr_mtx_divide_scalar_1
5447 end interface
5448
5450 interface assignment(=)
5451 module procedure :: csr_assign_to_dense
5452 module procedure :: dense_assign_to_csr
5453 module procedure :: msr_assign_to_dense
5454 module procedure :: dense_assign_to_msr
5455 module procedure :: csr_assign_to_msr
5456 module procedure :: msr_assign_to_csr
5457 end interface
5458
5468 interface transpose
5469 module procedure :: csr_transpose
5470 end interface
5471
5496 interface sparse_direct_solve
5497 module procedure :: csr_solve_sparse_direct
5498 end interface
5499
5546 interface pgmres_solver
5547 module procedure :: csr_pgmres_solver
5548 end interface
5549
5550 interface
5551 module function csr_get_element(this, i, j) result(rst)
5552 class(csr_matrix), intent(in) :: this
5553 integer(int32), intent(in) :: i, j
5554 real(real64) :: rst
5555 end function
5556 pure module function csr_size(x, dim) result(rst)
5557 class(csr_matrix), intent(in) :: x
5558 integer(int32), intent(in) :: dim
5559 integer(int32) :: rst
5560 end function
5561
5562 module function create_empty_csr_matrix(m, n, nnz, err) result(rst)
5563 integer(int32), intent(in) :: m, n, nnz
5564 class(errors), intent(inout), optional, target :: err
5565 type(csr_matrix) :: rst
5566 end function
5567
5568 pure module function nonzero_count_csr(x) result(rst)
5569 class(csr_matrix), intent(in) :: x
5570 integer(int32) :: rst
5571 end function
5572
5573 module function dense_to_csr(a, err) result(rst)
5574 real(real64), intent(in), dimension(:,:) :: a
5575 class(errors), intent(inout), optional, target :: err
5576 type(csr_matrix) :: rst
5577 end function
5578
5579 module subroutine csr_to_dense(a, x, err)
5580 class(csr_matrix), intent(in) :: a
5581 real(real64), intent(out), dimension(:,:) :: x
5582 class(errors), intent(inout), optional, target :: err
5583 end subroutine
5584
5585 module function csr_mtx_mtx_mult(a, b) result(rst)
5586 class(csr_matrix), intent(in) :: a, b
5587 type(csr_matrix) :: rst
5588 end function
5589
5590 module function csr_mtx_vec_mult(a, b) result(rst)
5591 class(csr_matrix), intent(in) :: a
5592 real(real64), intent(in), dimension(:) :: b
5593 real(real64), allocatable, dimension(:) :: rst
5594 end function
5595
5596 module function csr_mtx_add(a, b) result(rst)
5597 class(csr_matrix), intent(in) :: a, b
5598 type(csr_matrix) :: rst
5599 end function
5600
5601 module function csr_mtx_sub(a, b) result(rst)
5602 class(csr_matrix), intent(in) :: a, b
5603 type(csr_matrix) :: rst
5604 end function
5605
5606 module function csr_mtx_mult_scalar_1(a, b) result(rst)
5607 class(csr_matrix), intent(in) :: a
5608 real(real64), intent(in) :: b
5609 type(csr_matrix) :: rst
5610 end function
5611
5612 module function csr_mtx_mult_scalar_2(a, b) result(rst)
5613 real(real64), intent(in) :: a
5614 class(csr_matrix), intent(in) :: b
5615 type(csr_matrix) :: rst
5616 end function
5617
5618 module function csr_mtx_divide_scalar_1(a, b) result(rst)
5619 class(csr_matrix), intent(in) :: a
5620 real(real64), intent(in) :: b
5621 type(csr_matrix) :: rst
5622 end function
5623
5624 module function csr_transpose(a) result(rst)
5625 class(csr_matrix), intent(in) :: a
5626 type(csr_matrix) :: rst
5627 end function
5628
5629 module subroutine extract_diagonal_csr(a, diag, err)
5630 class(csr_matrix), intent(in) :: a
5631 real(real64), intent(out), dimension(:) :: diag
5632 class(errors), intent(inout), optional, target :: err
5633 end subroutine
5634
5635 module subroutine csr_solve_sparse_direct(a, b, x, droptol, err)
5636 class(csr_matrix), intent(in) :: a
5637 real(real64), intent(in), dimension(:) :: b
5638 real(real64), intent(out), dimension(:) :: x
5639 real(real64), intent(in), optional :: droptol
5640 class(errors), intent(inout), optional, target :: err
5641 end subroutine
5642
5643 module function diag_to_csr(a, err) result(rst)
5644 real(real64), intent(in), dimension(:) :: a
5645 class(errors), intent(inout), optional, target :: err
5646 type(csr_matrix) :: rst
5647 end function
5648
5649 module function banded_to_csr(m, ml, mu, a, err) result(rst)
5650 integer(int32), intent(in) :: m, ml, mu
5651 real(real64), intent(in), dimension(:,:) :: a
5652 class(errors), intent(inout), optional, target :: err
5653 type(csr_matrix) :: rst
5654 end function
5655
5656 module subroutine csr_assign_to_dense(dense, sparse)
5657 real(real64), intent(out), dimension(:,:) :: dense
5658 class(csr_matrix), intent(in) :: sparse
5659 end subroutine
5660
5661 module subroutine dense_assign_to_csr(sparse, dense)
5662 type(csr_matrix), intent(out) :: sparse
5663 real(real64), intent(in), dimension(:,:) :: dense
5664 end subroutine
5665
5666 pure module function msr_size(x, dim) result(rst)
5667 class(msr_matrix), intent(in) :: x
5668 integer(int32), intent(in) :: dim
5669 integer(int32) :: rst
5670 end function
5671
5672 pure module function nonzero_count_msr(x) result(rst)
5673 class(msr_matrix), intent(in) :: x
5674 integer(int32) :: rst
5675 end function
5676
5677 module function create_empty_msr_matrix(m, n, nnz, err) result(rst)
5678 integer(int32), intent(in) :: m, n, nnz
5679 class(errors), intent(inout), optional, target :: err
5680 type(msr_matrix) :: rst
5681 end function
5682
5683 module function csr_to_msr(a, err) result(rst)
5684 class(csr_matrix), intent(in) :: a
5685 class(errors), intent(inout), optional, target :: err
5686 type(msr_matrix) :: rst
5687 end function
5688
5689 module function msr_to_csr(a, err) result(rst)
5690 class(msr_matrix), intent(in) :: a
5691 class(errors), intent(inout), optional, target :: err
5692 type(csr_matrix) :: rst
5693 end function
5694
5695 module function dense_to_msr(a, err) result(rst)
5696 real(real64), intent(in), dimension(:,:) :: a
5697 class(errors), intent(inout), optional, target :: err
5698 type(msr_matrix) :: rst
5699 end function
5700
5701 module subroutine msr_to_dense(a, x, err)
5702 ! Arguments
5703 class(msr_matrix), intent(in) :: a
5704 real(real64), intent(out), dimension(:,:) :: x
5705 class(errors), intent(inout), optional, target :: err
5706 end subroutine
5707
5708 module subroutine msr_assign_to_dense(dense, msr)
5709 real(real64), intent(out), dimension(:,:) :: dense
5710 class(msr_matrix), intent(in) :: msr
5711 end subroutine
5712
5713 module subroutine dense_assign_to_msr(msr, dense)
5714 type(msr_matrix), intent(out) :: msr
5715 real(real64), intent(in), dimension(:,:) :: dense
5716 end subroutine
5717
5718 module subroutine csr_assign_to_msr(msr, csr)
5719 type(msr_matrix), intent(out) :: msr
5720 class(csr_matrix), intent(in) :: csr
5721 end subroutine
5722
5723 module subroutine msr_assign_to_csr(csr, msr)
5724 type(csr_matrix), intent(out) :: csr
5725 class(msr_matrix), intent(in) :: msr
5726 end subroutine
5727
5728 module subroutine csr_lu_factor(a, lu, ju, droptol, err)
5729 class(csr_matrix), intent(in) :: a
5730 type(msr_matrix), intent(out) :: lu
5731 integer(int32), intent(out), dimension(:) :: ju
5732 real(real64), intent(in), optional :: droptol
5733 class(errors), intent(inout), optional, target :: err
5734 end subroutine
5735
5736 module subroutine csr_lu_solve(lu, ju, b, x, err)
5737 class(msr_matrix), intent(in) :: lu
5738 integer(int32), intent(in), dimension(:) :: ju
5739 real(real64), intent(in), dimension(:) :: b
5740 real(real64), intent(out), dimension(:) :: x
5741 class(errors), intent(inout), optional, target :: err
5742 end subroutine
5743
5744 module subroutine csr_pgmres_solver(a, lu, ju, b, x, im, tol, maxits, &
5745 iout, err)
5746 class(csr_matrix), intent(in) :: a
5747 class(msr_matrix), intent(in) :: lu
5748 integer(int32), intent(in), dimension(:) :: ju
5749 real(real64), intent(inout), dimension(:) :: b
5750 real(real64), intent(out), dimension(:) :: x
5751 integer(int32), intent(in), optional :: im, maxits, iout
5752 real(real64), intent(in), optional :: tol
5753 class(errors), intent(inout), optional, target :: err
5754 end subroutine
5755
5756 module function create_csr_matrix(m, n, rows, cols, vals, err) &
5757 result(rst)
5758 integer(int32), intent(in) :: m, n
5759 integer(int32), intent(in), dimension(:) :: rows, cols
5760 real(real64), intent(in), dimension(:) :: vals
5761 class(errors), intent(inout), optional, target :: err
5762 type(csr_matrix) :: rst
5763 end function
5764 end interface
5765
5766! ------------------------------------------------------------------------------
5767end module
Multiplies a banded matrix, A, with a diagonal matrix, B, such that A = alpha * A * B,...
Definition linalg.f90:4135
Multiplies a banded matrix, A, by a vector x such that alpha * op(A) * x + beta * y = y.
Definition linalg.f90:4030
Converts a banded matrix stored in dense form to a full matrix.
Definition linalg.f90:4072
Converts a banded matrix to a dense matrix.
Definition linalg.f90:4163
Computes the Cholesky factorization of a symmetric, positive definite matrix.
Definition linalg.f90:1687
Computes the rank 1 downdate to a Cholesky factored matrix (upper triangular).
Definition linalg.f90:1893
Computes the rank 1 update to a Cholesky factored matrix (upper triangular).
Definition linalg.f90:1786
Converts a dense matrix to a banded matrix.
Definition linalg.f90:4188
Computes the determinant of a square matrix.
Definition linalg.f90:659
Multiplies a diagonal matrix with another matrix or array.
Definition linalg.f90:553
Computes the eigenvalues, and optionally the eigenvectors, of a matrix.
Definition linalg.f90:3371
Extracts the diagonal of a matrix.
Definition linalg.f90:4210
Forms the orthogonal matrix Q from the elementary reflectors returned by the LQ factorization algorit...
Definition linalg.f90:3684
Extracts the L and U matrices from the condensed [L\U] storage format used by the lu_factor.
Definition linalg.f90:967
Forms the full M-by-M orthogonal matrix Q from the elementary reflectors returned by the base QR fact...
Definition linalg.f90:1281
Computes the LQ factorization of an M-by-N matrix.
Definition linalg.f90:3570
Computes the LU factorization of an M-by-N matrix.
Definition linalg.f90:844
Performs sparse matrix multiplication C = A * B.
Definition linalg.f90:5382
Computes the inverse of a square matrix.
Definition linalg.f90:3051
Performs the matrix operation: .
Definition linalg.f90:361
Computes the Moore-Penrose pseudo-inverse of a M-by-N matrix using the singular value decomposition o...
Definition linalg.f90:3157
Computes the rank of a matrix.
Definition linalg.f90:626
Multiplies a general matrix by the orthogonal matrix Q from a LQ factorization.
Definition linalg.f90:3833
Multiplies a general matrix by the orthogonal matrix Q from a QR factorization.
Definition linalg.f90:1438
Multiplies a general matrix by the orthogonal matrix Z from an RZ factorization.
Definition linalg.f90:2057
Determines the number of nonzero entries in a sparse matrix.
Definition linalg.f90:5338
A preconditioned GMRES solver.
Definition linalg.f90:5546
Computes the QR factorization of an M-by-N matrix.
Definition linalg.f90:1121
Computes the rank 1 update to an M-by-N QR factored matrix A (M >= N) where , and such that ....
Definition linalg.f90:1588
Performs the rank-1 update to matrix A such that: , where is an M-by-N matrix, is a scalar,...
Definition linalg.f90:396
Multiplies a vector by the reciprocal of a real scalar.
Definition linalg.f90:700
Factors an upper trapezoidal matrix by means of orthogonal transformations such that ....
Definition linalg.f90:1966
Solves a system of Cholesky factored equations.
Definition linalg.f90:2663
Solves the overdetermined or underdetermined system of M equations of N unknowns,...
Definition linalg.f90:2854
Solves the overdetermined or underdetermined system of M equations of N unknowns using a singular va...
Definition linalg.f90:2956
Solves the overdetermined or underdetermined system of M equations of N unknowns....
Definition linalg.f90:2753
Solves a system of M LQ-factored equations of N unknowns. N must be greater than or equal to M.
Definition linalg.f90:3928
Solves a system of LU-factored equations.
Definition linalg.f90:2421
Solves a system of M QR-factored equations of N unknowns.
Definition linalg.f90:2557
Solves a triangular system of equations.
Definition linalg.f90:2316
Sorts an array.
Definition linalg.f90:3454
Provides a direct solution to a square, sparse system.
Definition linalg.f90:5496
Computes the singular value decomposition of a matrix A. The SVD is defined as: , where is an M-by-M...
Definition linalg.f90:2182
Swaps the contents of two arrays.
Definition linalg.f90:681
Computes the trace of a matrix (the sum of the main diagonal elements).
Definition linalg.f90:578
Provides the transpose of a sparse matrix.
Definition linalg.f90:5468
Computes the triangular matrix operation: , or , where A is a triangular matrix.
Definition linalg.f90:734
Provides a set of common linear algebra routines.
Definition linalg.f90:145
A sparse matrix stored in compressed sparse row (CSR) format.
Definition linalg.f90:233
A sparse matrix stored in modified sparse row format. This format is convenient for situations where ...
Definition linalg.f90:253