Program Library

- Provenance of code.
- Purpose of code.
- Specification.
- Description of subroutine's operation.
- References.
- Parameter descriptions.
- Error indicators.
- Accuracy estimate.
- Any additional information.
- Example of code
- Auxiliary subroutines required.
- Keywords.
- Download source code.
- Links.

Phase Transformations Group,

Department of Materials Science and Metallurgy,

University of Cambridge,

Cambridge CB2 3QZ, U.K.

E-mail: dg241@cam.ac.uk

Added to MAP: 2006.

Language: | FORTRAN |

Product form: | Source code. |

SUBROUTINE D3SOLV(N, DA, UA, LA, B, X) INTEGER N DOUBLE PRECISION DA(N), UA(N), LA(N), B(N), X(N)Top | Next | Prev

The main diagonal and the lower and upper subdiagonals are sent to the routine in vectors DA(1-N), LA(1-(N-1)), UA(2-N), respectively. The independent coefficient vector B is sent in vector B(1-N). The system is solved and the results are returned to the main program in the vector B(1-N).

- Bonet, C.; Jorba, A.; M-Seara, M.T.; Masdemont, J.; Olle, M.; Susin, A.; Valencia, M.
*Calcul numeric.*Universitat Politecnica de Catalunya, Barcelona, 1993.

**N**- integer- N is the dimension of the system.
**DA**- double precision array of dimension N- DA is an array containing the main diagonal of the coefficient matrix A.
**UA**- double precision array of dimension N.- UA is an array containing the upper subdiagonal of the coefficient matrix A. Only positions 1 to (N-1) are used.
**LA**- double precision array of dimension N- LA is an array containing the lower subdiagonal of the coefficient matrix A. Only positions 2 to N are used.
**B**- double precision array of dimension N- B is an array containing the elements of the independent coefficient vector B.

**B**- double precision array of dimension N- B is an array containing the result of solving the system, X.

1. Program text

PROGRAM TEST3DS C C ...PARAMETERS... INTEGER NMAX PARAMETER (NMAX=100) INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) C C ...LOCAL SCALARS... C INTEGER I, N C C ...Arrays... C DOUBLE PRECISION DA(NMAX), UA(NMAX), LA(NMAX), B(NMAX), X(NMAX) C C ...Program starts... C ...Reads entries... C WRITE(NOUT,*) 'Dimension?' READ(NIN,*) N WRITE(NOUT,*) 'Main diagonal:', N, 'values' READ(NIN,*) (DA(I), I=1, N) WRITE(NOUT,*) 'Upper diagonal:', (N-1), ' values' READ(NIN,*) (UA(I), I=1, (N-1)) WRITE(NOUT,*) 'Lower diagonal:', (N-1), 'values' READ(NIN,*) (LA(I), I=2, N) WRITE(NOUT,*) 'Independent terms:', N, 'values' READ(NIN,*) (B(I), I=1, N) CC C ...Calls routine... C CALL D3SOLV(N, DA, UA, LA, B, X) C C ...and shows results... C WRITE(NOUT,*) 'Solution vector' WRITE(NOUT,*)(X(I), I=1, N) WRITE(NOUT,*)'and new upper diagonal' WRITE(NOUT,*)(UA(I), I=1, (N-1)) C C ...End of program... C STOP END

5

3.0 2.3 -5.0 -0.9 7.1

2.1 -1.0 1.9 8.0

3.4 3.6 7.0 -6.0

2.7 0.5 2.6 0.6 2.7

-4.000 7.000 3.000 -4.000 -3.000Top | Next | Prev

**MAP originated from a joint project of the National Physical Laboratory and the University of Cambridge.**