#$ #$=head1 NAME #$ #$cgmeth - conjugate gradient method #$ #$=head1 SYNOPSIS #$ #$C #$ #$=head1 INPUT PARAMETERS #$ #$=over 4 #$ #$=item yy - C #$ #$=item rr - C #$ #$=item fff - C #$ #$=back #$ #$=head1 OUTPUT PARAMETERS #$ #$=over 4 #$ #$=item x - C #$ #$=back #$ #$=head1 DESCRIPTION #$ #$ setup of conjugate gradient descent, minimize SUM rr(i)**2 #$ nx #$ rr(i) = sum fff(i,j) * x(j) - yy(i) #$ j=1 #$ #$ #$=head1 SEE ALSO #$ #$L, L,L #$ #$=head1 LIBRARY #$ #$B #$ #$=cut #$ module cgmeth { use matmult use cgstep_mod use simple_solver contains # setup of conjugate gradient descent, minimize SUM rr(i)**2 # nx # rr(i) = sum fff(i,j) * x(j) - yy(i) # j=1 subroutine cgtest( x, yy, rr, fff, niter) { real, dimension (:), intent (out) :: x, rr real, dimension (:), intent (in) :: yy real, dimension (:,:), pointer :: fff integer, intent (in) :: niter call matmult_init( fff) call solver( matmult_lop, cgstep, x, yy, niter, res = rr) call cgstep_close () } }