Download Sun Performance Library User`s Guide

Transcript
Sparse Solver Examples
CODE EXAMPLE 4-1 shows solving a symmetric system using the one-call interface,
and CODE EXAMPLE 4-2 shows solving a symmetric system using the regular
interface.
CODE EXAMPLE 4-1
Solving a Symmetric System–One-Call Interface
my_system% cat example_1call.f
program example_1call
c
c This program is an example driver that calls the sparse solver.
c
It factors and solves a symmetric system, by calling the
c
one-call interface.
c
implicit none
integer
character
double precision
integer
double precision
integer
c
c
c
c
c
c
c
c
c
c
c
Sparse matrix structure and value arrays.
page 3.
Ax = b, (solve for x) where:
4.0
1.0
A = 2.0
0.5
2.0
1.0
0.5
0.0
0.0
0.0
data colstr
data rowind
data values /
&
data rhs
data xexpct
c
c
62
neqns, ier, msglvl, outunt, ldrhs, nrhs
mtxtyp*2, pivot*1, ordmthd*3
handle(150)
colstr(6), rowind(9)
values(9), rhs(5), xexpct(5)
i
2.0
0.0
3.0
0.0
0.0
0.5
2.0
0.0
0.0
0.0
0.0
0.625 0.0
0.0 16.0
2.0
2.0
x = 1.0
-8.0
-0.5
From George and Liu,
7.0
3.0
b = 7.0
-4.0
-4.0
/ 1, 6, 7, 8, 9, 10 /
/ 1, 2, 3, 4, 5, 2, 3, 4, 5 /
4.0d0, 1.0d0, 2.0d0, 0.5d0, 2.0d0, 0.5d0, 3.0d0,
0.625d0, 16.0d0 /
/ 7.0d0, 3.0d0, 7.0d0, -4.0d0, -4.0d0 /
/ 2.0d0, 2.0d0, 1.0d0, -8.0d0, -0.5d0 /
set calling parameters
Sun Performance Library User’s Guide • May 2003