This is the matrix-vector product routine required by subroutines LSQR and CRAIG for a test matrix of the form A = HYDHZ. The quantities defining D, HY, HZ are in the work array rw, followed by a work array w. These are passed to aprod1 and aprod2 in order to make the code readable.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(test_solver), | intent(inout) | :: | me | |||
| integer, | intent(in) | :: | mode | |||
| integer, | intent(in) | :: | m | |||
| integer, | intent(in) | :: | n | |||
| real(kind=wp), | intent(inout), | dimension(:) | :: | x |
dimension n |
|
| real(kind=wp), | intent(inout), | dimension(:) | :: | y |
dimension m |
subroutine aprod_test_solver (me, mode, m, n, x, y) class(test_solver),intent(inout) :: me integer,intent(in) :: mode integer,intent(in) :: m integer,intent(in) :: n real(wp),dimension(:),intent(inout) :: x !! dimension n real(wp),dimension(:),intent(inout) :: y !! dimension m integer :: locd, lochy, lochz, locw, maxmn, minmn maxmn = max( m, n ) minmn = min( m, n ) locd = 1 lochy = locd + minmn lochz = lochy + m locw = lochz + n if (mode == 1) then call me%aprod1( m, n, maxmn, minmn, x, y, & me%rw(locd), me%rw(lochy), me%rw(lochz), me%rw(locw) ) else call me%aprod2( m, n, maxmn, minmn, x, y, & me%rw(locd), me%rw(lochy), me%rw(lochz), me%rw(locw) ) end if end subroutine aprod_test_solver