Download Forte/Sun Performance Library 6 Collection User`s Guide
Transcript
CODE EXAMPLE 4-4 Solving an Unsymmetric System–Regular Interface my_system% cat example_uu.f program example_uu c c This program is an example driver that calls the sparse solver. c It factors and solves an unsymmetric system. c implicit none integer character double precision integer double precision integer neqns, ier, msglvl, outunt, ldrhs, nrhs mtxtyp*2, pivot*1, ordmthd*3 handle(150) colstr(6), rowind(10) values(10), rhs(5), xexpct(5) i c c Sparse matrix structure and value arrays. Unsummetric matrix A. c Ax = b, (solve for x) where: c c 1.0 0.0 0.0 0.0 0.0 1.0 1.0 c 2.0 6.0 0.0 0.0 9.0 2.0 59.0 c A = 3.0 0.0 7.0 0.0 0.0 x = 3.0 b = 24.0 c 4.0 0.0 0.0 8.0 0.0 4.0 36.0 c 5.0 0.0 0.0 0.0 10.0 5.0 55.0 c data colstr / 1, 6, 7, 8, 9, 11 / data rowind / 1, 2, 3, 4, 5, 2, 3, 4, 2, 5 / data values / 1.0d0, 2.0d0, 3.0d0, 4.0d0, 5.0d0, 6.0d0, 7.0d0, & 8.0d0, 9.0d0, 10.0d0 / data rhs / 1.0d0, 59.0d0, 24.0d0, 36.0d0, 55.0d0 / data xexpct / 1.0d0, 2.0d0, 3.0d0, 4.0d0, 5.0d0 / c c initialize solver c mtxtyp= 'uu' pivot = 'n' neqns = 5 outunt = 6 msglvl = 3 call dgssin ( mtxtyp, pivot, neqns , colstr, rowind, & outunt, msglvl, handle, ier ) if ( ier .ne. 0 ) goto 110 Chapter 4 Working With Matrices 61