linalg 1.7.4
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 :: la_no_operation
191 public :: la_transpose
192 public :: la_hermitian_transpose
193 public :: la_no_error
194 public :: la_invalid_input_error
195 public :: la_array_size_error
196 public :: la_singular_matrix_error
197 public :: la_matrix_format_error
198 public :: la_out_of_memory_error
199 public :: la_convergence_error
200 public :: la_invalid_operation_error
201
202! ******************************************************************************
203! CONSTANTS
204! ------------------------------------------------------------------------------
206 integer(int32), parameter :: la_no_operation = 0
208 integer(int32), parameter :: la_transpose = 1
210 integer(int32), parameter :: la_hermitian_transpose = 2
211
212! ******************************************************************************
213! ERROR FLAGS
214! ------------------------------------------------------------------------------
216 integer(int32), parameter :: la_no_error = 0
218 integer(int32), parameter :: la_invalid_input_error = 101
220 integer(int32), parameter :: la_array_size_error = 102
222 integer(int32), parameter :: la_singular_matrix_error = 103
224 integer(int32), parameter :: la_matrix_format_error = 104
226 integer(int32), parameter :: la_out_of_memory_error = 105
228 integer(int32), parameter :: la_convergence_error = 106
230 integer(int32), parameter :: la_invalid_operation_error = 107
231
232! ******************************************************************************
233! INTERFACES
234! ------------------------------------------------------------------------------
296interface mtx_mult
297 module procedure :: mtx_mult_mtx
298 module procedure :: mtx_mult_vec
299 module procedure :: cmtx_mult_mtx
300 module procedure :: cmtx_mult_vec
301end interface
302
303! ------------------------------------------------------------------------------
332 module procedure :: rank1_update_dbl
333 module procedure :: rank1_update_cmplx
334end interface
335
336! ------------------------------------------------------------------------------
467 module procedure :: diag_mtx_mult_mtx
468 module procedure :: diag_mtx_mult_mtx2
469 module procedure :: diag_mtx_mult_mtx3
470 module procedure :: diag_mtx_mult_mtx4
471 module procedure :: diag_mtx_mult_mtx_cmplx
472 module procedure :: diag_mtx_mult_mtx2_cmplx
473 module procedure :: diag_mtx_mult_mtx_mix
474 module procedure :: diag_mtx_mult_mtx2_mix
475end interface
476
477! ------------------------------------------------------------------------------
490interface trace
491 module procedure :: trace_dbl
492 module procedure :: trace_cmplx
493end interface
494
495! ------------------------------------------------------------------------------
538interface mtx_rank
539 module procedure :: mtx_rank_dbl
540 module procedure :: mtx_rank_cmplx
541end interface
542
543! ------------------------------------------------------------------------------
571interface det
572 module procedure :: det_dbl
573 module procedure :: det_cmplx
574end interface
575
576! ------------------------------------------------------------------------------
593interface swap
594 module procedure :: swap_dbl
595 module procedure :: swap_cmplx
596end interface
597
598! ------------------------------------------------------------------------------
613 module procedure :: recip_mult_array_dbl
614end interface
615
616! ------------------------------------------------------------------------------
647 module procedure :: tri_mtx_mult_dbl
648 module procedure :: tri_mtx_mult_cmplx
649end interface
650
651! ------------------------------------------------------------------------------
732interface lu_factor
733 module procedure :: lu_factor_dbl
734 module procedure :: lu_factor_cmplx
735end interface
736
854interface form_lu
855 module procedure :: form_lu_all
856 module procedure :: form_lu_all_cmplx
857 module procedure :: form_lu_only
858 module procedure :: form_lu_only_cmplx
859end interface
860
861! ------------------------------------------------------------------------------
1008interface qr_factor
1009 module procedure :: qr_factor_no_pivot
1010 module procedure :: qr_factor_no_pivot_cmplx
1011 module procedure :: qr_factor_pivot
1012 module procedure :: qr_factor_pivot_cmplx
1013end interface
1014
1015! ------------------------------------------------------------------------------
1168interface form_qr
1169 module procedure :: form_qr_no_pivot
1170 module procedure :: form_qr_no_pivot_cmplx
1171 module procedure :: form_qr_pivot
1172 module procedure :: form_qr_pivot_cmplx
1173end interface
1174
1175! ------------------------------------------------------------------------------
1325interface mult_qr
1326 module procedure :: mult_qr_mtx
1327 module procedure :: mult_qr_mtx_cmplx
1328 module procedure :: mult_qr_vec
1329 module procedure :: mult_qr_vec_cmplx
1330end interface
1331
1332! ------------------------------------------------------------------------------
1476 module procedure :: qr_rank1_update_dbl
1477 module procedure :: qr_rank1_update_cmplx
1478end interface
1479
1480! ------------------------------------------------------------------------------
1575 module procedure :: cholesky_factor_dbl
1576 module procedure :: cholesky_factor_cmplx
1577end interface
1578
1579! ------------------------------------------------------------------------------
1674 module procedure :: cholesky_rank1_update_dbl
1675 module procedure :: cholesky_rank1_update_cmplx
1676end interface
1677
1678! ------------------------------------------------------------------------------
1781 module procedure :: cholesky_rank1_downdate_dbl
1782 module procedure :: cholesky_rank1_downdate_cmplx
1783end interface
1784
1785! ------------------------------------------------------------------------------
1853interface rz_factor
1854 module procedure :: rz_factor_dbl
1855 module procedure :: rz_factor_cmplx
1856end interface
1857
1858! ------------------------------------------------------------------------------
1944interface mult_rz
1945 module procedure :: mult_rz_mtx
1946 module procedure :: mult_rz_mtx_cmplx
1947 module procedure :: mult_rz_vec
1948 module procedure :: mult_rz_vec_cmplx
1949end interface
1950
1951! ------------------------------------------------------------------------------
2069interface svd
2070 module procedure :: svd_dbl
2071 module procedure :: svd_cmplx
2072end interface
2073
2074! ------------------------------------------------------------------------------
2204 module procedure :: solve_tri_mtx
2205 module procedure :: solve_tri_mtx_cmplx
2206 module procedure :: solve_tri_vec
2207 module procedure :: solve_tri_vec_cmplx
2208end interface
2209
2210! ------------------------------------------------------------------------------
2291interface solve_lu
2292 module procedure :: solve_lu_mtx
2293 module procedure :: solve_lu_mtx_cmplx
2294 module procedure :: solve_lu_vec
2295 module procedure :: solve_lu_vec_cmplx
2296end interface
2297
2298! ------------------------------------------------------------------------------
2426interface solve_qr
2427 module procedure :: solve_qr_no_pivot_mtx
2428 module procedure :: solve_qr_no_pivot_mtx_cmplx
2429 module procedure :: solve_qr_no_pivot_vec
2430 module procedure :: solve_qr_no_pivot_vec_cmplx
2431 module procedure :: solve_qr_pivot_mtx
2432 module procedure :: solve_qr_pivot_mtx_cmplx
2433 module procedure :: solve_qr_pivot_vec
2434 module procedure :: solve_qr_pivot_vec_cmplx
2435end interface
2436
2437! ------------------------------------------------------------------------------
2533 module procedure :: solve_cholesky_mtx
2534 module procedure :: solve_cholesky_mtx_cmplx
2535 module procedure :: solve_cholesky_vec
2536 module procedure :: solve_cholesky_vec_cmplx
2537end interface
2538
2539! ------------------------------------------------------------------------------
2623 module procedure :: solve_least_squares_mtx
2624 module procedure :: solve_least_squares_mtx_cmplx
2625 module procedure :: solve_least_squares_vec
2626 module procedure :: solve_least_squares_vec_cmplx
2627end interface
2628
2629! ------------------------------------------------------------------------------
2724 module procedure :: solve_least_squares_mtx_pvt
2725 module procedure :: solve_least_squares_mtx_pvt_cmplx
2726 module procedure :: solve_least_squares_vec_pvt
2727 module procedure :: solve_least_squares_vec_pvt_cmplx
2728end interface
2729
2730! ------------------------------------------------------------------------------
2826 module procedure :: solve_least_squares_mtx_svd
2827 module procedure :: solve_least_squares_vec_svd
2828end interface
2829
2830! ------------------------------------------------------------------------------
2921 module procedure :: mtx_inverse_dbl
2922 module procedure :: mtx_inverse_cmplx
2923end interface
2924
2925! ------------------------------------------------------------------------------
3027 module procedure :: mtx_pinverse_dbl
3028 module procedure :: mtx_pinverse_cmplx
3029end interface
3030
3031! ------------------------------------------------------------------------------
3240interface eigen
3241 module procedure :: eigen_symm
3242 module procedure :: eigen_asymm
3243 module procedure :: eigen_gen
3244 module procedure :: eigen_cmplx
3245end interface
3246
3247! ------------------------------------------------------------------------------
3323interface sort
3324 module procedure :: sort_dbl_array
3325 module procedure :: sort_dbl_array_ind
3326 module procedure :: sort_cmplx_array
3327 module procedure :: sort_cmplx_array_ind
3328 module procedure :: sort_eigen_cmplx
3329 module procedure :: sort_eigen_dbl
3330end interface
3331
3437interface lq_factor
3438 module procedure :: lq_factor_no_pivot
3439 module procedure :: lq_factor_no_pivot_cmplx
3440end interface
3441
3551interface form_lq
3552 module procedure :: form_lq_no_pivot
3553 module procedure :: form_lq_no_pivot_cmplx
3554end interface
3555
3700interface mult_lq
3701 module procedure :: mult_lq_mtx
3702 module procedure :: mult_lq_mtx_cmplx
3703 module procedure :: mult_lq_vec
3704 module procedure :: mult_lq_vec_cmplx
3705end interface
3706
3795interface solve_lq
3796 module procedure :: solve_lq_mtx
3797 module procedure :: solve_lq_mtx_cmplx
3798 module procedure :: solve_lq_vec
3799 module procedure :: solve_lq_vec_cmplx
3800end interface
3801
3802! ------------------------------------------------------------------------------
3898 module procedure :: band_mtx_vec_mult_dbl
3899 module procedure :: band_mtx_vec_mult_cmplx
3900end interface
3901
3940 module procedure :: band_to_full_mtx_dbl
3941 module procedure :: band_to_full_mtx_cmplx
3942end interface
3943
4003 module procedure :: band_diag_mtx_mult_dbl
4004 module procedure :: band_diag_mtx_mult_cmplx
4005end interface
4006
4007! ******************************************************************************
4008! LINALG_BASIC.F90
4009! ------------------------------------------------------------------------------
4010interface
4011 module subroutine mtx_mult_mtx(transa, transb, alpha, a, b, beta, c, err)
4012 logical, intent(in) :: transa, transb
4013 real(real64), intent(in) :: alpha, beta
4014 real(real64), intent(in), dimension(:,:) :: a, b
4015 real(real64), intent(inout), dimension(:,:) :: c
4016 class(errors), intent(inout), optional, target :: err
4017 end subroutine
4018
4019 module subroutine mtx_mult_vec(trans, alpha, a, b, beta, c, err)
4020 logical, intent(in) :: trans
4021 real(real64), intent(in) :: alpha, beta
4022 real(real64), intent(in), dimension(:,:) :: a
4023 real(real64), intent(in), dimension(:) :: b
4024 real(real64), intent(inout), dimension(:) :: c
4025 class(errors), intent(inout), optional, target :: err
4026 end subroutine
4027
4028 module subroutine cmtx_mult_mtx(opa, opb, alpha, a, b, beta, c, err)
4029 integer(int32), intent(in) :: opa, opb
4030 complex(real64), intent(in) :: alpha, beta
4031 complex(real64), intent(in), dimension(:,:) :: a, b
4032 complex(real64), intent(inout), dimension(:,:) :: c
4033 class(errors), intent(inout), optional, target :: err
4034 end subroutine
4035
4036 module subroutine cmtx_mult_vec(opa, alpha, a, b, beta, c, err)
4037 integer(int32), intent(in) :: opa
4038 complex(real64), intent(in) :: alpha, beta
4039 complex(real64), intent(in), dimension(:,:) :: a
4040 complex(real64), intent(in), dimension(:) :: b
4041 complex(real64), intent(inout), dimension(:) :: c
4042 class(errors), intent(inout), optional, target :: err
4043 end subroutine
4044
4045 module subroutine rank1_update_dbl(alpha, x, y, a, err)
4046 real(real64), intent(in) :: alpha
4047 real(real64), intent(in), dimension(:) :: x, y
4048 real(real64), intent(inout), dimension(:,:) :: a
4049 class(errors), intent(inout), optional, target :: err
4050 end subroutine
4051
4052 module subroutine rank1_update_cmplx(alpha, x, y, a, err)
4053 complex(real64), intent(in) :: alpha
4054 complex(real64), intent(in), dimension(:) :: x, y
4055 complex(real64), intent(inout), dimension(:,:) :: a
4056 class(errors), intent(inout), optional, target :: err
4057 end subroutine
4058
4059 module subroutine diag_mtx_mult_mtx(lside, trans, alpha, a, b, beta, c, err)
4060 logical, intent(in) :: lside, trans
4061 real(real64) :: alpha, beta
4062 real(real64), intent(in), dimension(:) :: a
4063 real(real64), intent(in), dimension(:,:) :: b
4064 real(real64), intent(inout), dimension(:,:) :: c
4065 class(errors), intent(inout), optional, target :: err
4066 end subroutine
4067
4068 module subroutine diag_mtx_mult_mtx2(lside, alpha, a, b, err)
4069 logical, intent(in) :: lside
4070 real(real64), intent(in) :: alpha
4071 real(real64), intent(in), dimension(:) :: a
4072 real(real64), intent(inout), dimension(:,:) :: b
4073 class(errors), intent(inout), optional, target :: err
4074 end subroutine
4075
4076 module subroutine diag_mtx_mult_mtx3(lside, trans, alpha, a, b, beta, c, err)
4077 logical, intent(in) :: lside, trans
4078 real(real64) :: alpha, beta
4079 complex(real64), intent(in), dimension(:) :: a
4080 real(real64), intent(in), dimension(:,:) :: b
4081 complex(real64), intent(inout), dimension(:,:) :: c
4082 class(errors), intent(inout), optional, target :: err
4083 end subroutine
4084
4085 module subroutine diag_mtx_mult_mtx4(lside, opb, alpha, a, b, beta, c, err)
4086 logical, intent(in) :: lside
4087 integer(int32), intent(in) :: opb
4088 real(real64) :: alpha, beta
4089 complex(real64), intent(in), dimension(:) :: a
4090 complex(real64), intent(in), dimension(:,:) :: b
4091 complex(real64), intent(inout), dimension(:,:) :: c
4092 class(errors), intent(inout), optional, target :: err
4093 end subroutine
4094
4095 module subroutine diag_mtx_mult_mtx_cmplx(lside, opb, alpha, a, b, beta, c, err)
4096 logical, intent(in) :: lside
4097 integer(int32), intent(in) :: opb
4098 complex(real64) :: alpha, beta
4099 complex(real64), intent(in), dimension(:) :: a
4100 complex(real64), intent(in), dimension(:,:) :: b
4101 complex(real64), intent(inout), dimension(:,:) :: c
4102 class(errors), intent(inout), optional, target :: err
4103 end subroutine
4104
4105 module subroutine diag_mtx_mult_mtx2_cmplx(lside, alpha, a, b, err)
4106 logical, intent(in) :: lside
4107 complex(real64), intent(in) :: alpha
4108 complex(real64), intent(in), dimension(:) :: a
4109 complex(real64), intent(inout), dimension(:,:) :: b
4110 class(errors), intent(inout), optional, target :: err
4111 end subroutine
4112
4113 module subroutine diag_mtx_mult_mtx_mix(lside, opb, alpha, a, b, beta, c, err)
4114 logical, intent(in) :: lside
4115 integer(int32), intent(in) :: opb
4116 complex(real64) :: alpha, beta
4117 real(real64), intent(in), dimension(:) :: a
4118 complex(real64), intent(in), dimension(:,:) :: b
4119 complex(real64), intent(inout), dimension(:,:) :: c
4120 class(errors), intent(inout), optional, target :: err
4121 end subroutine
4122
4123 module subroutine diag_mtx_mult_mtx2_mix(lside, alpha, a, b, err)
4124 logical, intent(in) :: lside
4125 complex(real64), intent(in) :: alpha
4126 real(real64), intent(in), dimension(:) :: a
4127 complex(real64), intent(inout), dimension(:,:) :: b
4128 class(errors), intent(inout), optional, target :: err
4129 end subroutine
4130
4131 pure module function trace_dbl(x) result(y)
4132 real(real64), intent(in), dimension(:,:) :: x
4133 real(real64) :: y
4134 end function
4135
4136 pure module function trace_cmplx(x) result(y)
4137 complex(real64), intent(in), dimension(:,:) :: x
4138 complex(real64) :: y
4139 end function
4140
4141 module function mtx_rank_dbl(a, tol, work, olwork, err) result(rnk)
4142 real(real64), intent(inout), dimension(:,:) :: a
4143 real(real64), intent(in), optional :: tol
4144 real(real64), intent(out), target, optional, dimension(:) :: work
4145 integer(int32), intent(out), optional :: olwork
4146 class(errors), intent(inout), optional, target :: err
4147 integer(int32) :: rnk
4148 end function
4149
4150 module function mtx_rank_cmplx(a, tol, work, olwork, rwork, err) result(rnk)
4151 complex(real64), intent(inout), dimension(:,:) :: a
4152 real(real64), intent(in), optional :: tol
4153 complex(real64), intent(out), target, optional, dimension(:) :: work
4154 integer(int32), intent(out), optional :: olwork
4155 real(real64), intent(out), target, optional, dimension(:) :: rwork
4156 class(errors), intent(inout), optional, target :: err
4157 integer(int32) :: rnk
4158 end function
4159
4160 module function det_dbl(a, iwork, err) result(x)
4161 real(real64), intent(inout), dimension(:,:) :: a
4162 integer(int32), intent(out), target, optional, dimension(:) :: iwork
4163 class(errors), intent(inout), optional, target :: err
4164 real(real64) :: x
4165 end function
4166
4167 module function det_cmplx(a, iwork, err) result(x)
4168 complex(real64), intent(inout), dimension(:,:) :: a
4169 integer(int32), intent(out), target, optional, dimension(:) :: iwork
4170 class(errors), intent(inout), optional, target :: err
4171 complex(real64) :: x
4172 end function
4173
4174 module subroutine swap_dbl(x, y, err)
4175 real(real64), intent(inout), dimension(:) :: x, y
4176 class(errors), intent(inout), optional, target :: err
4177 end subroutine
4178
4179 module subroutine swap_cmplx(x, y, err)
4180 complex(real64), intent(inout), dimension(:) :: x, y
4181 class(errors), intent(inout), optional, target :: err
4182 end subroutine
4183
4184 module subroutine recip_mult_array_dbl(a, x)
4185 real(real64), intent(in) :: a
4186 real(real64), intent(inout), dimension(:) :: x
4187 end subroutine
4188
4189 module subroutine tri_mtx_mult_dbl(upper, alpha, a, beta, b, err)
4190 logical, intent(in) :: upper
4191 real(real64), intent(in) :: alpha, beta
4192 real(real64), intent(in), dimension(:,:) :: a
4193 real(real64), intent(inout), dimension(:,:) :: b
4194 class(errors), intent(inout), optional, target :: err
4195 end subroutine
4196
4197 module subroutine tri_mtx_mult_cmplx(upper, alpha, a, beta, b, err)
4198 logical, intent(in) :: upper
4199 complex(real64), intent(in) :: alpha, beta
4200 complex(real64), intent(in), dimension(:,:) :: a
4201 complex(real64), intent(inout), dimension(:,:) :: b
4202 class(errors), intent(inout), optional, target :: err
4203 end subroutine
4204
4205 module subroutine band_mtx_vec_mult_dbl(trans, kl, ku, alpha, a, x, beta, &
4206 y, err)
4207 logical, intent(in) :: trans
4208 integer(int32), intent(in) :: kl, ku
4209 real(real64), intent(in) :: alpha, beta
4210 real(real64), intent(in), dimension(:,:) :: a
4211 real(real64), intent(in), dimension(:) :: x
4212 real(real64), intent(inout), dimension(:) :: y
4213 class(errors), intent(inout), optional, target :: err
4214 end subroutine
4215
4216 module subroutine band_mtx_vec_mult_cmplx(trans, kl, ku, alpha, a, x, &
4217 beta, y, err)
4218 integer(int32), intent(in) :: trans
4219 integer(int32), intent(in) :: kl, ku
4220 complex(real64), intent(in) :: alpha, beta
4221 complex(real64), intent(in), dimension(:,:) :: a
4222 complex(real64), intent(in), dimension(:) :: x
4223 complex(real64), intent(inout), dimension(:) :: y
4224 class(errors), intent(inout), optional, target :: err
4225 end subroutine
4226
4227 module subroutine band_to_full_mtx_dbl(kl, ku, b, f, err)
4228 integer(int32), intent(in) :: kl, ku
4229 real(real64), intent(in), dimension(:,:) :: b
4230 real(real64), intent(out), dimension(:,:) :: f
4231 class(errors), intent(inout), optional, target :: err
4232 end subroutine
4233
4234 module subroutine band_to_full_mtx_cmplx(kl, ku, b, f, err)
4235 integer(int32), intent(in) :: kl, ku
4236 complex(real64), intent(in), dimension(:,:) :: b
4237 complex(real64), intent(out), dimension(:,:) :: f
4238 class(errors), intent(inout), optional, target :: err
4239 end subroutine
4240
4241 module subroutine band_diag_mtx_mult_dbl(left, m, kl, ku, alpha, a, b, err)
4242 logical, intent(in) :: left
4243 integer(int32), intent(in) :: m, kl, ku
4244 real(real64), intent(in) :: alpha
4245 real(real64), intent(inout), dimension(:,:) :: a
4246 real(real64), intent(in), dimension(:) :: b
4247 class(errors), intent(inout), optional, target :: err
4248 end subroutine
4249
4250 module subroutine band_diag_mtx_mult_cmplx(left, m, kl, ku, alpha, a, b, err)
4251 logical, intent(in) :: left
4252 integer(int32), intent(in) :: m, kl, ku
4253 complex(real64), intent(in) :: alpha
4254 complex(real64), intent(inout), dimension(:,:) :: a
4255 complex(real64), intent(in), dimension(:) :: b
4256 class(errors), intent(inout), optional, target :: err
4257 end subroutine
4258end interface
4259
4260! ******************************************************************************
4261! LINALG_FACTOR.F90
4262! ------------------------------------------------------------------------------
4263interface
4264 module subroutine lu_factor_dbl(a, ipvt, err)
4265 real(real64), intent(inout), dimension(:,:) :: a
4266 integer(int32), intent(out), dimension(:) :: ipvt
4267 class(errors), intent(inout), optional, target :: err
4268 end subroutine
4269
4270 module subroutine lu_factor_cmplx(a, ipvt, err)
4271 complex(real64), intent(inout), dimension(:,:) :: a
4272 integer(int32), intent(out), dimension(:) :: ipvt
4273 class(errors), intent(inout), optional, target :: err
4274 end subroutine
4275
4276 module subroutine form_lu_all(lu, ipvt, u, p, err)
4277 real(real64), intent(inout), dimension(:,:) :: lu
4278 integer(int32), intent(in), dimension(:) :: ipvt
4279 real(real64), intent(out), dimension(:,:) :: u, p
4280 class(errors), intent(inout), optional, target :: err
4281 end subroutine
4282
4283 module subroutine form_lu_all_cmplx(lu, ipvt, u, p, err)
4284 complex(real64), intent(inout), dimension(:,:) :: lu
4285 integer(int32), intent(in), dimension(:) :: ipvt
4286 complex(real64), intent(out), dimension(:,:) :: u
4287 real(real64), intent(out), dimension(:,:) :: p
4288 class(errors), intent(inout), optional, target :: err
4289 end subroutine
4290
4291 module subroutine form_lu_only(lu, u, err)
4292 real(real64), intent(inout), dimension(:,:) :: lu
4293 real(real64), intent(out), dimension(:,:) :: u
4294 class(errors), intent(inout), optional, target :: err
4295 end subroutine
4296
4297 module subroutine form_lu_only_cmplx(lu, u, err)
4298 complex(real64), intent(inout), dimension(:,:) :: lu
4299 complex(real64), intent(out), dimension(:,:) :: u
4300 class(errors), intent(inout), optional, target :: err
4301 end subroutine
4302
4303 module subroutine qr_factor_no_pivot(a, tau, work, olwork, err)
4304 real(real64), intent(inout), dimension(:,:) :: a
4305 real(real64), intent(out), dimension(:) :: tau
4306 real(real64), intent(out), target, dimension(:), optional :: work
4307 integer(int32), intent(out), optional :: olwork
4308 class(errors), intent(inout), optional, target :: err
4309 end subroutine
4310
4311 module subroutine qr_factor_no_pivot_cmplx(a, tau, work, olwork, err)
4312 complex(real64), intent(inout), dimension(:,:) :: a
4313 complex(real64), intent(out), dimension(:) :: tau
4314 complex(real64), intent(out), target, dimension(:), optional :: work
4315 integer(int32), intent(out), optional :: olwork
4316 class(errors), intent(inout), optional, target :: err
4317 end subroutine
4318
4319 module subroutine qr_factor_pivot(a, tau, jpvt, work, olwork, err)
4320 real(real64), intent(inout), dimension(:,:) :: a
4321 real(real64), intent(out), dimension(:) :: tau
4322 integer(int32), intent(inout), dimension(:) :: jpvt
4323 real(real64), intent(out), target, dimension(:), optional :: work
4324 integer(int32), intent(out), optional :: olwork
4325 class(errors), intent(inout), optional, target :: err
4326 end subroutine
4327
4328 module subroutine qr_factor_pivot_cmplx(a, tau, jpvt, work, olwork, rwork, &
4329 err)
4330 complex(real64), intent(inout), dimension(:,:) :: a
4331 complex(real64), intent(out), dimension(:) :: tau
4332 integer(int32), intent(inout), dimension(:) :: jpvt
4333 complex(real64), intent(out), target, dimension(:), optional :: work
4334 integer(int32), intent(out), optional :: olwork
4335 real(real64), intent(out), target, dimension(:), optional :: rwork
4336 class(errors), intent(inout), optional, target :: err
4337 end subroutine
4338
4339 module subroutine form_qr_no_pivot(r, tau, q, work, olwork, err)
4340 real(real64), intent(inout), dimension(:,:) :: r
4341 real(real64), intent(in), dimension(:) :: tau
4342 real(real64), intent(out), dimension(:,:) :: q
4343 real(real64), intent(out), target, dimension(:), optional :: work
4344 integer(int32), intent(out), optional :: olwork
4345 class(errors), intent(inout), optional, target :: err
4346 end subroutine
4347
4348 module subroutine form_qr_no_pivot_cmplx(r, tau, q, work, olwork, err)
4349 complex(real64), intent(inout), dimension(:,:) :: r
4350 complex(real64), intent(in), dimension(:) :: tau
4351 complex(real64), intent(out), dimension(:,:) :: q
4352 complex(real64), intent(out), target, dimension(:), optional :: work
4353 integer(int32), intent(out), optional :: olwork
4354 class(errors), intent(inout), optional, target :: err
4355 end subroutine
4356
4357 module subroutine form_qr_pivot(r, tau, pvt, q, p, work, olwork, err)
4358 real(real64), intent(inout), dimension(:,:) :: r
4359 real(real64), intent(in), dimension(:) :: tau
4360 integer(int32), intent(in), dimension(:) :: pvt
4361 real(real64), intent(out), dimension(:,:) :: q, p
4362 real(real64), intent(out), target, dimension(:), optional :: work
4363 integer(int32), intent(out), optional :: olwork
4364 class(errors), intent(inout), optional, target :: err
4365 end subroutine
4366
4367 module subroutine form_qr_pivot_cmplx(r, tau, pvt, q, p, work, olwork, err)
4368 complex(real64), intent(inout), dimension(:,:) :: r
4369 complex(real64), intent(in), dimension(:) :: tau
4370 integer(int32), intent(in), dimension(:) :: pvt
4371 complex(real64), intent(out), dimension(:,:) :: q, p
4372 complex(real64), intent(out), target, dimension(:), optional :: work
4373 integer(int32), intent(out), optional :: olwork
4374 class(errors), intent(inout), optional, target :: err
4375 end subroutine
4376
4377 module subroutine mult_qr_mtx(lside, trans, a, tau, c, work, olwork, err)
4378 logical, intent(in) :: lside, trans
4379 real(real64), intent(in), dimension(:) :: tau
4380 real(real64), intent(inout), dimension(:,:) :: a, c
4381 real(real64), intent(out), target, dimension(:), optional :: work
4382 integer(int32), intent(out), optional :: olwork
4383 class(errors), intent(inout), optional, target :: err
4384 end subroutine
4385
4386 module subroutine mult_qr_mtx_cmplx(lside, trans, a, tau, c, work, olwork, err)
4387 logical, intent(in) :: lside, trans
4388 complex(real64), intent(in), dimension(:) :: tau
4389 complex(real64), intent(inout), dimension(:,:) :: a, c
4390 complex(real64), intent(out), target, dimension(:), optional :: work
4391 integer(int32), intent(out), optional :: olwork
4392 class(errors), intent(inout), optional, target :: err
4393 end subroutine
4394
4395 module subroutine mult_qr_vec(trans, a, tau, c, work, olwork, err)
4396 logical, intent(in) :: trans
4397 real(real64), intent(inout), dimension(:,:) :: a
4398 real(real64), intent(in), dimension(:) :: tau
4399 real(real64), intent(inout), dimension(:) :: c
4400 real(real64), intent(out), target, dimension(:), optional :: work
4401 integer(int32), intent(out), optional :: olwork
4402 class(errors), intent(inout), optional, target :: err
4403 end subroutine
4404
4405 module subroutine mult_qr_vec_cmplx(trans, a, tau, c, work, olwork, err)
4406 logical, intent(in) :: trans
4407 complex(real64), intent(inout), dimension(:,:) :: a
4408 complex(real64), intent(in), dimension(:) :: tau
4409 complex(real64), intent(inout), dimension(:) :: c
4410 complex(real64), intent(out), target, dimension(:), optional :: work
4411 integer(int32), intent(out), optional :: olwork
4412 class(errors), intent(inout), optional, target :: err
4413 end subroutine
4414
4415 module subroutine qr_rank1_update_dbl(q, r, u, v, work, err)
4416 real(real64), intent(inout), dimension(:,:) :: q, r
4417 real(real64), intent(inout), dimension(:) :: u, v
4418 real(real64), intent(out), target, optional, dimension(:) :: work
4419 class(errors), intent(inout), optional, target :: err
4420 end subroutine
4421
4422 module subroutine qr_rank1_update_cmplx(q, r, u, v, work, rwork, err)
4423 complex(real64), intent(inout), dimension(:,:) :: q, r
4424 complex(real64), intent(inout), dimension(:) :: u, v
4425 complex(real64), intent(out), target, optional, dimension(:) :: work
4426 real(real64), intent(out), target, optional, dimension(:) :: rwork
4427 class(errors), intent(inout), optional, target :: err
4428 end subroutine
4429
4430 module subroutine cholesky_factor_dbl(a, upper, err)
4431 real(real64), intent(inout), dimension(:,:) :: a
4432 logical, intent(in), optional :: upper
4433 class(errors), intent(inout), optional, target :: err
4434 end subroutine
4435
4436 module subroutine cholesky_factor_cmplx(a, upper, err)
4437 complex(real64), intent(inout), dimension(:,:) :: a
4438 logical, intent(in), optional :: upper
4439 class(errors), intent(inout), optional, target :: err
4440 end subroutine
4441
4442 module subroutine cholesky_rank1_update_dbl(r, u, work, err)
4443 real(real64), intent(inout), dimension(:,:) :: r
4444 real(real64), intent(inout), dimension(:) :: u
4445 real(real64), intent(out), target, optional, dimension(:) :: work
4446 class(errors), intent(inout), optional, target :: err
4447 end subroutine
4448
4449 module subroutine cholesky_rank1_update_cmplx(r, u, work, err)
4450 complex(real64), intent(inout), dimension(:,:) :: r
4451 complex(real64), intent(inout), dimension(:) :: u
4452 real(real64), intent(out), target, optional, dimension(:) :: work
4453 class(errors), intent(inout), optional, target :: err
4454 end subroutine
4455
4456 module subroutine cholesky_rank1_downdate_dbl(r, u, work, err)
4457 real(real64), intent(inout), dimension(:,:) :: r
4458 real(real64), intent(inout), dimension(:) :: u
4459 real(real64), intent(out), target, optional, dimension(:) :: work
4460 class(errors), intent(inout), optional, target :: err
4461 end subroutine
4462
4463 module subroutine cholesky_rank1_downdate_cmplx(r, u, work, err)
4464 complex(real64), intent(inout), dimension(:,:) :: r
4465 complex(real64), intent(inout), dimension(:) :: u
4466 real(real64), intent(out), target, optional, dimension(:) :: work
4467 class(errors), intent(inout), optional, target :: err
4468 end subroutine
4469
4470 module subroutine rz_factor_dbl(a, tau, work, olwork, err)
4471 real(real64), intent(inout), dimension(:,:) :: a
4472 real(real64), intent(out), dimension(:) :: tau
4473 real(real64), intent(out), target, optional, dimension(:) :: work
4474 integer(int32), intent(out), optional :: olwork
4475 class(errors), intent(inout), optional, target :: err
4476 end subroutine
4477
4478 module subroutine rz_factor_cmplx(a, tau, work, olwork, err)
4479 complex(real64), intent(inout), dimension(:,:) :: a
4480 complex(real64), intent(out), dimension(:) :: tau
4481 complex(real64), intent(out), target, optional, dimension(:) :: work
4482 integer(int32), intent(out), optional :: olwork
4483 class(errors), intent(inout), optional, target :: err
4484 end subroutine
4485
4486 module subroutine mult_rz_mtx(lside, trans, l, a, tau, c, work, olwork, err)
4487 logical, intent(in) :: lside, trans
4488 integer(int32), intent(in) :: l
4489 real(real64), intent(inout), dimension(:,:) :: a, c
4490 real(real64), intent(in), dimension(:) :: tau
4491 real(real64), intent(out), target, optional, dimension(:) :: work
4492 integer(int32), intent(out), optional :: olwork
4493 class(errors), intent(inout), optional, target :: err
4494 end subroutine
4495
4496 module subroutine mult_rz_mtx_cmplx(lside, trans, l, a, tau, c, work, olwork, err)
4497 logical, intent(in) :: lside, trans
4498 integer(int32), intent(in) :: l
4499 complex(real64), intent(inout), dimension(:,:) :: a, c
4500 complex(real64), intent(in), dimension(:) :: tau
4501 complex(real64), intent(out), target, optional, dimension(:) :: work
4502 integer(int32), intent(out), optional :: olwork
4503 class(errors), intent(inout), optional, target :: err
4504 end subroutine
4505
4506 module subroutine mult_rz_vec(trans, l, a, tau, c, work, olwork, err)
4507 logical, intent(in) :: trans
4508 integer(int32), intent(in) :: l
4509 real(real64), intent(inout), dimension(:,:) :: a
4510 real(real64), intent(in), dimension(:) :: tau
4511 real(real64), intent(inout), dimension(:) :: c
4512 real(real64), intent(out), target, optional, dimension(:) :: work
4513 integer(int32), intent(out), optional :: olwork
4514 class(errors), intent(inout), optional, target :: err
4515 end subroutine
4516
4517 module subroutine mult_rz_vec_cmplx(trans, l, a, tau, c, work, olwork, err)
4518 logical, intent(in) :: trans
4519 integer(int32), intent(in) :: l
4520 complex(real64), intent(inout), dimension(:,:) :: a
4521 complex(real64), intent(in), dimension(:) :: tau
4522 complex(real64), intent(inout), dimension(:) :: c
4523 complex(real64), intent(out), target, optional, dimension(:) :: work
4524 integer(int32), intent(out), optional :: olwork
4525 class(errors), intent(inout), optional, target :: err
4526 end subroutine
4527
4528 module subroutine svd_dbl(a, s, u, vt, work, olwork, err)
4529 real(real64), intent(inout), dimension(:,:) :: a
4530 real(real64), intent(out), dimension(:) :: s
4531 real(real64), intent(out), optional, dimension(:,:) :: u, vt
4532 real(real64), intent(out), target, optional, dimension(:) :: work
4533 integer(int32), intent(out), optional :: olwork
4534 class(errors), intent(inout), optional, target :: err
4535 end subroutine
4536
4537 module subroutine svd_cmplx(a, s, u, vt, work, olwork, rwork, err)
4538 complex(real64), intent(inout), dimension(:,:) :: a
4539 real(real64), intent(out), dimension(:) :: s
4540 complex(real64), intent(out), optional, dimension(:,:) :: u, vt
4541 complex(real64), intent(out), target, optional, dimension(:) :: work
4542 integer(int32), intent(out), optional :: olwork
4543 real(real64), intent(out), target, optional, dimension(:) :: rwork
4544 class(errors), intent(inout), optional, target :: err
4545 end subroutine
4546
4547 module subroutine lq_factor_no_pivot(a, tau, work, olwork, err)
4548 real(real64), intent(inout), dimension(:,:) :: a
4549 real(real64), intent(out), dimension(:) :: tau
4550 real(real64), intent(out), target, dimension(:), optional :: work
4551 integer(int32), intent(out), optional :: olwork
4552 class(errors), intent(inout), optional, target :: err
4553 end subroutine
4554
4555 module subroutine lq_factor_no_pivot_cmplx(a, tau, work, olwork, err)
4556 complex(real64), intent(inout), dimension(:,:) :: a
4557 complex(real64), intent(out), dimension(:) :: tau
4558 complex(real64), intent(out), target, dimension(:), optional :: work
4559 integer(int32), intent(out), optional :: olwork
4560 class(errors), intent(inout), optional, target :: err
4561 end subroutine
4562
4563 module subroutine form_lq_no_pivot(l, tau, q, work, olwork, err)
4564 real(real64), intent(inout), dimension(:,:) :: l
4565 real(real64), intent(in), dimension(:) :: tau
4566 real(real64), intent(out), dimension(:,:) :: q
4567 real(real64), intent(out), target, dimension(:), optional :: work
4568 integer(int32), intent(out), optional :: olwork
4569 class(errors), intent(inout), optional, target :: err
4570 end subroutine
4571
4572 module subroutine form_lq_no_pivot_cmplx(l, tau, q, work, olwork, err)
4573 complex(real64), intent(inout), dimension(:,:) :: l
4574 complex(real64), intent(in), dimension(:) :: tau
4575 complex(real64), intent(out), dimension(:,:) :: q
4576 complex(real64), intent(out), target, dimension(:), optional :: work
4577 integer(int32), intent(out), optional :: olwork
4578 class(errors), intent(inout), optional, target :: err
4579 end subroutine
4580
4581 module subroutine mult_lq_mtx(lside, trans, a, tau, c, work, olwork, err)
4582 logical, intent(in) :: lside, trans
4583 real(real64), intent(in), dimension(:,:) :: a
4584 real(real64), intent(in), dimension(:) :: tau
4585 real(real64), intent(inout), dimension(:,:) :: c
4586 real(real64), intent(out), target, dimension(:), optional :: work
4587 integer(int32), intent(out), optional :: olwork
4588 class(errors), intent(inout), optional, target :: err
4589 end subroutine
4590
4591 module subroutine mult_lq_mtx_cmplx(lside, trans, a, tau, c, work, olwork, err)
4592 logical, intent(in) :: lside, trans
4593 complex(real64), intent(in), dimension(:,:) :: a
4594 complex(real64), intent(in), dimension(:) :: tau
4595 complex(real64), intent(inout), dimension(:,:) :: c
4596 complex(real64), intent(out), target, dimension(:), optional :: work
4597 integer(int32), intent(out), optional :: olwork
4598 class(errors), intent(inout), optional, target :: err
4599 end subroutine
4600
4601 module subroutine mult_lq_vec(trans, a, tau, c, work, olwork, err)
4602 logical, intent(in) :: trans
4603 real(real64), intent(in), dimension(:,:) :: a
4604 real(real64), intent(in), dimension(:) :: tau
4605 real(real64), intent(inout), dimension(:) :: c
4606 real(real64), intent(out), target, dimension(:), optional :: work
4607 integer(int32), intent(out), optional :: olwork
4608 class(errors), intent(inout), optional, target :: err
4609 end subroutine
4610
4611 module subroutine mult_lq_vec_cmplx(trans, a, tau, c, work, olwork, err)
4612 logical, intent(in) :: trans
4613 complex(real64), intent(in), dimension(:,:) :: a
4614 complex(real64), intent(in), dimension(:) :: tau
4615 complex(real64), intent(inout), dimension(:) :: c
4616 complex(real64), intent(out), target, dimension(:), optional :: work
4617 integer(int32), intent(out), optional :: olwork
4618 class(errors), intent(inout), optional, target :: err
4619 end subroutine
4620end interface
4621
4622! ******************************************************************************
4623! LINALG_SOLVE.F90
4624! ------------------------------------------------------------------------------
4625interface
4626 module subroutine solve_tri_mtx(lside, upper, trans, nounit, alpha, a, b, err)
4627 logical, intent(in) :: lside, upper, trans, nounit
4628 real(real64), intent(in) :: alpha
4629 real(real64), intent(in), dimension(:,:) :: a
4630 real(real64), intent(inout), dimension(:,:) :: b
4631 class(errors), intent(inout), optional, target :: err
4632 end subroutine
4633
4634 module subroutine solve_tri_mtx_cmplx(lside, upper, trans, nounit, alpha, a, b, err)
4635 logical, intent(in) :: lside, upper, trans, nounit
4636 complex(real64), intent(in) :: alpha
4637 complex(real64), intent(in), dimension(:,:) :: a
4638 complex(real64), intent(inout), dimension(:,:) :: b
4639 class(errors), intent(inout), optional, target :: err
4640 end subroutine
4641
4642 module subroutine solve_tri_vec(upper, trans, nounit, a, x, err)
4643 logical, intent(in) :: upper, trans, nounit
4644 real(real64), intent(in), dimension(:,:) :: a
4645 real(real64), intent(inout), dimension(:) :: x
4646 class(errors), intent(inout), optional, target :: err
4647 end subroutine
4648
4649 module subroutine solve_tri_vec_cmplx(upper, trans, nounit, a, x, err)
4650 logical, intent(in) :: upper, trans, nounit
4651 complex(real64), intent(in), dimension(:,:) :: a
4652 complex(real64), intent(inout), dimension(:) :: x
4653 class(errors), intent(inout), optional, target :: err
4654 end subroutine
4655
4656 module subroutine solve_lu_mtx(a, ipvt, b, err)
4657 real(real64), intent(in), dimension(:,:) :: a
4658 integer(int32), intent(in), dimension(:) :: ipvt
4659 real(real64), intent(inout), dimension(:,:) :: b
4660 class(errors), intent(inout), optional, target :: err
4661 end subroutine
4662
4663 module subroutine solve_lu_mtx_cmplx(a, ipvt, b, err)
4664 complex(real64), intent(in), dimension(:,:) :: a
4665 integer(int32), intent(in), dimension(:) :: ipvt
4666 complex(real64), intent(inout), dimension(:,:) :: b
4667 class(errors), intent(inout), optional, target :: err
4668 end subroutine
4669
4670 module subroutine solve_lu_vec(a, ipvt, b, err)
4671 real(real64), intent(in), dimension(:,:) :: a
4672 integer(int32), intent(in), dimension(:) :: ipvt
4673 real(real64), intent(inout), dimension(:) :: b
4674 class(errors), intent(inout), optional, target :: err
4675 end subroutine
4676
4677 module subroutine solve_lu_vec_cmplx(a, ipvt, b, err)
4678 complex(real64), intent(in), dimension(:,:) :: a
4679 integer(int32), intent(in), dimension(:) :: ipvt
4680 complex(real64), intent(inout), dimension(:) :: b
4681 class(errors), intent(inout), optional, target :: err
4682 end subroutine
4683
4684 module subroutine solve_qr_no_pivot_mtx(a, tau, b, work, olwork, err)
4685 real(real64), intent(inout), dimension(:,:) :: a, b
4686 real(real64), intent(in), dimension(:) :: tau
4687 real(real64), intent(out), target, optional, dimension(:) :: work
4688 integer(int32), intent(out), optional :: olwork
4689 class(errors), intent(inout), optional, target :: err
4690 end subroutine
4691
4692 module subroutine solve_qr_no_pivot_mtx_cmplx(a, tau, b, work, olwork, err)
4693 complex(real64), intent(inout), dimension(:,:) :: a, b
4694 complex(real64), intent(in), dimension(:) :: tau
4695 complex(real64), intent(out), target, optional, dimension(:) :: work
4696 integer(int32), intent(out), optional :: olwork
4697 class(errors), intent(inout), optional, target :: err
4698 end subroutine
4699
4700 module subroutine solve_qr_no_pivot_vec(a, tau, b, work, olwork, err)
4701 real(real64), intent(inout), dimension(:,:) :: a
4702 real(real64), intent(in), dimension(:) :: tau
4703 real(real64), intent(inout), dimension(:) :: b
4704 real(real64), intent(out), target, optional, dimension(:) :: work
4705 integer(int32), intent(out), optional :: olwork
4706 class(errors), intent(inout), optional, target :: err
4707 end subroutine
4708
4709 module subroutine solve_qr_no_pivot_vec_cmplx(a, tau, b, work, olwork, err)
4710 complex(real64), intent(inout), dimension(:,:) :: a
4711 complex(real64), intent(in), dimension(:) :: tau
4712 complex(real64), intent(inout), dimension(:) :: b
4713 complex(real64), intent(out), target, optional, dimension(:) :: work
4714 integer(int32), intent(out), optional :: olwork
4715 class(errors), intent(inout), optional, target :: err
4716 end subroutine
4717
4718 module subroutine solve_qr_pivot_mtx(a, tau, jpvt, b, work, olwork, err)
4719 real(real64), intent(inout), dimension(:,:) :: a
4720 real(real64), intent(in), dimension(:) :: tau
4721 integer(int32), intent(in), dimension(:) :: jpvt
4722 real(real64), intent(inout), dimension(:,:) :: b
4723 real(real64), intent(out), target, optional, dimension(:) :: work
4724 integer(int32), intent(out), optional :: olwork
4725 class(errors), intent(inout), optional, target :: err
4726 end subroutine
4727
4728 module subroutine solve_qr_pivot_mtx_cmplx(a, tau, jpvt, b, work, olwork, err)
4729 complex(real64), intent(inout), dimension(:,:) :: a
4730 complex(real64), intent(in), dimension(:) :: tau
4731 integer(int32), intent(in), dimension(:) :: jpvt
4732 complex(real64), intent(inout), dimension(:,:) :: b
4733 complex(real64), intent(out), target, optional, dimension(:) :: work
4734 integer(int32), intent(out), optional :: olwork
4735 class(errors), intent(inout), optional, target :: err
4736 end subroutine
4737
4738 module subroutine solve_qr_pivot_vec(a, tau, jpvt, b, work, olwork, err)
4739 real(real64), intent(inout), dimension(:,:) :: a
4740 real(real64), intent(in), dimension(:) :: tau
4741 integer(int32), intent(in), dimension(:) :: jpvt
4742 real(real64), intent(inout), dimension(:) :: b
4743 real(real64), intent(out), target, optional, dimension(:) :: work
4744 integer(int32), intent(out), optional :: olwork
4745 class(errors), intent(inout), optional, target :: err
4746 end subroutine
4747
4748 module subroutine solve_qr_pivot_vec_cmplx(a, tau, jpvt, b, work, olwork, err)
4749 complex(real64), intent(inout), dimension(:,:) :: a
4750 complex(real64), intent(in), dimension(:) :: tau
4751 integer(int32), intent(in), dimension(:) :: jpvt
4752 complex(real64), intent(inout), dimension(:) :: b
4753 complex(real64), intent(out), target, optional, dimension(:) :: work
4754 integer(int32), intent(out), optional :: olwork
4755 class(errors), intent(inout), optional, target :: err
4756 end subroutine
4757
4758 module subroutine solve_cholesky_mtx(upper, a, b, err)
4759 logical, intent(in) :: upper
4760 real(real64), intent(in), dimension(:,:) :: a
4761 real(real64), intent(inout), dimension(:,:) :: b
4762 class(errors), intent(inout), optional, target :: err
4763 end subroutine
4764
4765 module subroutine solve_cholesky_mtx_cmplx(upper, a, b, err)
4766 logical, intent(in) :: upper
4767 complex(real64), intent(in), dimension(:,:) :: a
4768 complex(real64), intent(inout), dimension(:,:) :: b
4769 class(errors), intent(inout), optional, target :: err
4770 end subroutine
4771
4772 module subroutine solve_cholesky_vec(upper, a, b, err)
4773 logical, intent(in) :: upper
4774 real(real64), intent(in), dimension(:,:) :: a
4775 real(real64), intent(inout), dimension(:) :: b
4776 class(errors), intent(inout), optional, target :: err
4777 end subroutine
4778
4779 module subroutine solve_cholesky_vec_cmplx(upper, a, b, err)
4780 logical, intent(in) :: upper
4781 complex(real64), intent(in), dimension(:,:) :: a
4782 complex(real64), intent(inout), dimension(:) :: b
4783 class(errors), intent(inout), optional, target :: err
4784 end subroutine
4785
4786 module subroutine solve_least_squares_mtx(a, b, work, olwork, err)
4787 real(real64), intent(inout), dimension(:,:) :: a, b
4788 real(real64), intent(out), target, optional, dimension(:) :: work
4789 integer(int32), intent(out), optional :: olwork
4790 class(errors), intent(inout), optional, target :: err
4791 end subroutine
4792
4793 module subroutine solve_least_squares_mtx_cmplx(a, b, work, olwork, err)
4794 complex(real64), intent(inout), dimension(:,:) :: a, b
4795 complex(real64), intent(out), target, optional, dimension(:) :: work
4796 integer(int32), intent(out), optional :: olwork
4797 class(errors), intent(inout), optional, target :: err
4798 end subroutine
4799
4800 module subroutine solve_least_squares_vec(a, b, work, olwork, err)
4801 real(real64), intent(inout), dimension(:,:) :: a
4802 real(real64), intent(inout), dimension(:) :: b
4803 real(real64), intent(out), target, optional, dimension(:) :: work
4804 integer(int32), intent(out), optional :: olwork
4805 class(errors), intent(inout), optional, target :: err
4806 end subroutine
4807
4808 module subroutine solve_least_squares_vec_cmplx(a, b, work, olwork, err)
4809 complex(real64), intent(inout), dimension(:,:) :: a
4810 complex(real64), intent(inout), dimension(:) :: b
4811 complex(real64), intent(out), target, optional, dimension(:) :: work
4812 integer(int32), intent(out), optional :: olwork
4813 class(errors), intent(inout), optional, target :: err
4814 end subroutine
4815
4816 module subroutine solve_least_squares_mtx_pvt(a, b, ipvt, arnk, work, olwork, err)
4817 real(real64), intent(inout), dimension(:,:) :: a, b
4818 integer(int32), intent(inout), target, optional, dimension(:) :: ipvt
4819 integer(int32), intent(out), optional :: arnk
4820 real(real64), intent(out), target, optional, dimension(:) :: work
4821 integer(int32), intent(out), optional :: olwork
4822 class(errors), intent(inout), optional, target :: err
4823 end subroutine
4824
4825 module subroutine solve_least_squares_mtx_pvt_cmplx(a, b, ipvt, arnk, &
4826 work, olwork, rwork, err)
4827 complex(real64), intent(inout), dimension(:,:) :: a, b
4828 integer(int32), intent(inout), target, optional, dimension(:) :: ipvt
4829 integer(int32), intent(out), optional :: arnk
4830 complex(real64), intent(out), target, optional, dimension(:) :: work
4831 integer(int32), intent(out), optional :: olwork
4832 real(real64), intent(out), target, optional, dimension(:) :: rwork
4833 class(errors), intent(inout), optional, target :: err
4834 end subroutine
4835
4836 module subroutine solve_least_squares_vec_pvt(a, b, ipvt, arnk, work, olwork, err)
4837 real(real64), intent(inout), dimension(:,:) :: a
4838 real(real64), intent(inout), dimension(:) :: b
4839 integer(int32), intent(inout), target, optional, dimension(:) :: ipvt
4840 integer(int32), intent(out), optional :: arnk
4841 real(real64), intent(out), target, optional, dimension(:) :: work
4842 integer(int32), intent(out), optional :: olwork
4843 class(errors), intent(inout), optional, target :: err
4844 end subroutine
4845
4846 module subroutine solve_least_squares_vec_pvt_cmplx(a, b, ipvt, arnk, &
4847 work, olwork, rwork, err)
4848 complex(real64), intent(inout), dimension(:,:) :: a
4849 complex(real64), intent(inout), dimension(:) :: b
4850 integer(int32), intent(inout), target, optional, dimension(:) :: ipvt
4851 integer(int32), intent(out), optional :: arnk
4852 complex(real64), intent(out), target, optional, dimension(:) :: work
4853 integer(int32), intent(out), optional :: olwork
4854 real(real64), intent(out), target, optional, dimension(:) :: rwork
4855 class(errors), intent(inout), optional, target :: err
4856 end subroutine
4857
4858 module subroutine solve_least_squares_mtx_svd(a, b, s, arnk, work, olwork, err)
4859 real(real64), intent(inout), dimension(:,:) :: a, b
4860 integer(int32), intent(out), optional :: arnk
4861 real(real64), intent(out), target, optional, dimension(:) :: work, s
4862 integer(int32), intent(out), optional :: olwork
4863 class(errors), intent(inout), optional, target :: err
4864 end subroutine
4865
4866 module subroutine solve_least_squares_mtx_svd_cmplx(a, b, s, arnk, work, &
4867 olwork, rwork, err)
4868 complex(real64), intent(inout), dimension(:,:) :: a, b
4869 integer(int32), intent(out), optional :: arnk
4870 complex(real64), intent(out), target, optional, dimension(:) :: work
4871 real(real64), intent(out), target, optional, dimension(:) :: rwork, s
4872 integer(int32), intent(out), optional :: olwork
4873 class(errors), intent(inout), optional, target :: err
4874 end subroutine
4875
4876 module subroutine solve_least_squares_vec_svd(a, b, s, arnk, work, olwork, err)
4877 real(real64), intent(inout), dimension(:,:) :: a
4878 real(real64), intent(inout), dimension(:) :: b
4879 integer(int32), intent(out), optional :: arnk
4880 real(real64), intent(out), target, optional, dimension(:) :: work, s
4881 integer(int32), intent(out), optional :: olwork
4882 class(errors), intent(inout), optional, target :: err
4883 end subroutine
4884
4885 module subroutine solve_least_squares_vec_svd_cmplx(a, b, s, arnk, work, &
4886 olwork, rwork, err)
4887 complex(real64), intent(inout), dimension(:,:) :: a
4888 complex(real64), intent(inout), dimension(:) :: b
4889 integer(int32), intent(out), optional :: arnk
4890 complex(real64), intent(out), target, optional, dimension(:) :: work
4891 real(real64), intent(out), target, optional, dimension(:) :: rwork, s
4892 integer(int32), intent(out), optional :: olwork
4893 class(errors), intent(inout), optional, target :: err
4894 end subroutine
4895
4896 module subroutine mtx_inverse_dbl(a, iwork, work, olwork, err)
4897 real(real64), intent(inout), dimension(:,:) :: a
4898 integer(int32), intent(out), target, optional, dimension(:) :: iwork
4899 real(real64), intent(out), target, optional, dimension(:) :: work
4900 integer(int32), intent(out), optional :: olwork
4901 class(errors), intent(inout), optional, target :: err
4902 end subroutine
4903
4904 module subroutine mtx_inverse_cmplx(a, iwork, work, olwork, err)
4905 complex(real64), intent(inout), dimension(:,:) :: a
4906 integer(int32), intent(out), target, optional, dimension(:) :: iwork
4907 complex(real64), intent(out), target, optional, dimension(:) :: work
4908 integer(int32), intent(out), optional :: olwork
4909 class(errors), intent(inout), optional, target :: err
4910 end subroutine
4911
4912 module subroutine mtx_pinverse_dbl(a, ainv, tol, work, olwork, err)
4913 real(real64), intent(inout), dimension(:,:) :: a
4914 real(real64), intent(out), dimension(:,:) :: ainv
4915 real(real64), intent(in), optional :: tol
4916 real(real64), intent(out), target, dimension(:), optional :: work
4917 integer(int32), intent(out), optional :: olwork
4918 class(errors), intent(inout), optional, target :: err
4919 end subroutine
4920
4921 module subroutine mtx_pinverse_cmplx(a, ainv, tol, work, olwork, rwork, err)
4922 complex(real64), intent(inout), dimension(:,:) :: a
4923 complex(real64), intent(out), dimension(:,:) :: ainv
4924 real(real64), intent(in), optional :: tol
4925 complex(real64), intent(out), target, dimension(:), optional :: work
4926 integer(int32), intent(out), optional :: olwork
4927 real(real64), intent(out), target, dimension(:), optional :: rwork
4928 class(errors), intent(inout), optional, target :: err
4929 end subroutine
4930
4931 module subroutine solve_lq_mtx(a, tau, b, work, olwork, err)
4932 real(real64), intent(in), dimension(:,:) :: a
4933 real(real64), intent(in), dimension(:) :: tau
4934 real(real64), intent(inout), dimension(:,:) :: b
4935 real(real64), intent(out), target, optional, dimension(:) :: work
4936 integer(int32), intent(out), optional :: olwork
4937 class(errors), intent(inout), optional, target :: err
4938 end subroutine
4939
4940 module subroutine solve_lq_mtx_cmplx(a, tau, b, work, olwork, err)
4941 complex(real64), intent(in), dimension(:,:) :: a
4942 complex(real64), intent(in), dimension(:) :: tau
4943 complex(real64), intent(inout), dimension(:,:) :: b
4944 complex(real64), intent(out), target, optional, dimension(:) :: work
4945 integer(int32), intent(out), optional :: olwork
4946 class(errors), intent(inout), optional, target :: err
4947 end subroutine
4948
4949 module subroutine solve_lq_vec(a, tau, b, work, olwork, err)
4950 real(real64), intent(in), dimension(:,:) :: a
4951 real(real64), intent(in), dimension(:) :: tau
4952 real(real64), intent(inout), dimension(:) :: b
4953 real(real64), intent(out), target, optional, dimension(:) :: work
4954 integer(int32), intent(out), optional :: olwork
4955 class(errors), intent(inout), optional, target :: err
4956 end subroutine
4957
4958 module subroutine solve_lq_vec_cmplx(a, tau, b, work, olwork, err)
4959 complex(real64), intent(in), dimension(:,:) :: a
4960 complex(real64), intent(in), dimension(:) :: tau
4961 complex(real64), intent(inout), dimension(:) :: b
4962 complex(real64), intent(out), target, optional, dimension(:) :: work
4963 integer(int32), intent(out), optional :: olwork
4964 class(errors), intent(inout), optional, target :: err
4965 end subroutine
4966end interface
4967
4968! ******************************************************************************
4969! LINALG_EIGEN.F90
4970! ------------------------------------------------------------------------------
4971interface
4972 module subroutine eigen_symm(vecs, a, vals, work, olwork, err)
4973 logical, intent(in) :: vecs
4974 real(real64), intent(inout), dimension(:,:) :: a
4975 real(real64), intent(out), dimension(:) :: vals
4976 real(real64), intent(out), pointer, optional, dimension(:) :: work
4977 integer(int32), intent(out), optional :: olwork
4978 class(errors), intent(inout), optional, target :: err
4979 end subroutine
4980
4981 module subroutine eigen_asymm(a, vals, vecs, work, olwork, err)
4982 real(real64), intent(inout), dimension(:,:) :: a
4983 complex(real64), intent(out), dimension(:) :: vals
4984 complex(real64), intent(out), optional, dimension(:,:) :: vecs
4985 real(real64), intent(out), pointer, optional, dimension(:) :: work
4986 integer(int32), intent(out), optional :: olwork
4987 class(errors), intent(inout), optional, target :: err
4988 end subroutine
4989
4990 module subroutine eigen_gen(a, b, alpha, beta, vecs, work, olwork, err)
4991 real(real64), intent(inout), dimension(:,:) :: a, b
4992 complex(real64), intent(out), dimension(:) :: alpha
4993 real(real64), intent(out), optional, dimension(:) :: beta
4994 complex(real64), intent(out), optional, dimension(:,:) :: vecs
4995 real(real64), intent(out), optional, pointer, dimension(:) :: work
4996 integer(int32), intent(out), optional :: olwork
4997 class(errors), intent(inout), optional, target :: err
4998 end subroutine
4999
5000 module subroutine eigen_cmplx(a, vals, vecs, work, olwork, rwork, err)
5001 complex(real64), intent(inout), dimension(:,:) :: a
5002 complex(real64), intent(out), dimension(:) :: vals
5003 complex(real64), intent(out), optional, dimension(:,:) :: vecs
5004 complex(real64), intent(out), target, optional, dimension(:) :: work
5005 real(real64), intent(out), target, optional, dimension(:) :: rwork
5006 integer(int32), intent(out), optional :: olwork
5007 class(errors), intent(inout), optional, target :: err
5008 end subroutine
5009end interface
5010
5011! ******************************************************************************
5012! LINALG_SORTING.F90
5013! ------------------------------------------------------------------------------
5014interface
5015 module subroutine sort_dbl_array(x, ascend)
5016 real(real64), intent(inout), dimension(:) :: x
5017 logical, intent(in), optional :: ascend
5018 end subroutine
5019
5020 module subroutine sort_dbl_array_ind(x, ind, ascend, err)
5021 real(real64), intent(inout), dimension(:) :: x
5022 integer(int32), intent(inout), dimension(:) :: ind
5023 logical, intent(in), optional :: ascend
5024 class(errors), intent(inout), optional, target :: err
5025 end subroutine
5026
5027 module subroutine sort_cmplx_array(x, ascend)
5028 complex(real64), intent(inout), dimension(:) :: x
5029 logical, intent(in), optional :: ascend
5030 end subroutine
5031
5032 module subroutine sort_cmplx_array_ind(x, ind, ascend, err)
5033 complex(real64), intent(inout), dimension(:) :: x
5034 integer(int32), intent(inout), dimension(:) :: ind
5035 logical, intent(in), optional :: ascend
5036 class(errors), intent(inout), optional, target :: err
5037 end subroutine
5038
5039 module subroutine sort_eigen_cmplx(vals, vecs, ascend, err)
5040 complex(real64), intent(inout), dimension(:) :: vals
5041 complex(real64), intent(inout), dimension(:,:) :: vecs
5042 logical, intent(in), optional :: ascend
5043 class(errors), intent(inout), optional, target :: err
5044 end subroutine
5045
5046 module subroutine sort_eigen_dbl(vals, vecs, ascend, err)
5047 real(real64), intent(inout), dimension(:) :: vals
5048 real(real64), intent(inout), dimension(:,:) :: vecs
5049 logical, intent(in), optional :: ascend
5050 class(errors), intent(inout), optional, target :: err
5051 end subroutine
5052
5053end interface
5054
5055end module
Multiplies a banded matrix, A, with a diagonal matrix, B, such that A = alpha * A * B,...
Definition linalg.f90:4002
Multiplies a banded matrix, A, by a vector x such that alpha * op(A) * x + beta * y = y.
Definition linalg.f90:3897
Converts a banded matrix stored in dense form to a full matrix.
Definition linalg.f90:3939
Computes the Cholesky factorization of a symmetric, positive definite matrix.
Definition linalg.f90:1574
Computes the rank 1 downdate to a Cholesky factored matrix (upper triangular).
Definition linalg.f90:1780
Computes the rank 1 update to a Cholesky factored matrix (upper triangular).
Definition linalg.f90:1673
Computes the determinant of a square matrix.
Definition linalg.f90:571
Multiplies a diagonal matrix with another matrix or array.
Definition linalg.f90:466
Computes the eigenvalues, and optionally the eigenvectors, of a matrix.
Definition linalg.f90:3240
Forms the orthogonal matrix Q from the elementary reflectors returned by the LQ factorization algorit...
Definition linalg.f90:3551
Extracts the L and U matrices from the condensed [L\U] storage format used by the lu_factor.
Definition linalg.f90:854
Forms the full M-by-M orthogonal matrix Q from the elementary reflectors returned by the base QR fact...
Definition linalg.f90:1168
Computes the LQ factorization of an M-by-N matrix.
Definition linalg.f90:3437
Computes the LU factorization of an M-by-N matrix.
Definition linalg.f90:732
Computes the inverse of a square matrix.
Definition linalg.f90:2920
Performs the matrix operation: .
Definition linalg.f90:296
Computes the Moore-Penrose pseudo-inverse of a M-by-N matrix using the singular value decomposition o...
Definition linalg.f90:3026
Computes the rank of a matrix.
Definition linalg.f90:538
Multiplies a general matrix by the orthogonal matrix Q from a LQ factorization.
Definition linalg.f90:3700
Multiplies a general matrix by the orthogonal matrix Q from a QR factorization.
Definition linalg.f90:1325
Multiplies a general matrix by the orthogonal matrix Z from an RZ factorization.
Definition linalg.f90:1944
Computes the QR factorization of an M-by-N matrix.
Definition linalg.f90:1008
Computes the rank 1 update to an M-by-N QR factored matrix A (M >= N) where , and such that ....
Definition linalg.f90:1475
Performs the rank-1 update to matrix A such that: , where is an M-by-N matrix, is a scalar,...
Definition linalg.f90:331
Multiplies a vector by the reciprocal of a real scalar.
Definition linalg.f90:612
Factors an upper trapezoidal matrix by means of orthogonal transformations such that ....
Definition linalg.f90:1853
Solves a system of Cholesky factored equations.
Definition linalg.f90:2532
Solves the overdetermined or underdetermined system of M equations of N unknowns,...
Definition linalg.f90:2723
Solves the overdetermined or underdetermined system of M equations of N unknowns using a singular va...
Definition linalg.f90:2825
Solves the overdetermined or underdetermined system of M equations of N unknowns....
Definition linalg.f90:2622
Solves a system of M LQ-factored equations of N unknowns. N must be greater than or equal to M.
Definition linalg.f90:3795
Solves a system of LU-factored equations.
Definition linalg.f90:2291
Solves a system of M QR-factored equations of N unknowns.
Definition linalg.f90:2426
Solves a triangular system of equations.
Definition linalg.f90:2203
Sorts an array.
Definition linalg.f90:3323
Computes the singular value decomposition of a matrix A. The SVD is defined as: , where is an M-by-M...
Definition linalg.f90:2069
Swaps the contents of two arrays.
Definition linalg.f90:593
Computes the trace of a matrix (the sum of the main diagonal elements).
Definition linalg.f90:490
Computes the triangular matrix operation: , or , where A is a triangular matrix.
Definition linalg.f90:646
Provides a set of common linear algebra routines.
Definition linalg.f90:145