Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cptsl(3P) — Sun WorkShop 5.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

cptsl(3P)

NAME

cptsl - solve the linear system Ax = b for a symmetric positive definite tridiagonal matrix A and vectors b and x. 

SYNOPSIS

SUBROUTINE DPTSL (N, DDIAG, DOFFD, DB)

SUBROUTINE SPTSL (N, SDIAG, SOFFD, SB)

SUBROUTINE ZPTSL (N, ZDIAG, ZOFFD, ZB)

SUBROUTINE CPTSL (N, CDIAG, COFFD, CB)

 

#include <sunperf.h>

void dptsl(int n, double ∗d, double ∗e, double ∗b) ;

void sptsl(int n, float ∗d, float ∗e, float ∗b) ;

void zptsl(int n, doublecomplex ∗d, doublecomplex ∗e, doublecomplex ∗b) ;

void cptsl(int n, complex ∗d, complex ∗e, complex ∗b) ;

ARGUMENTS

N Order of the matrix A.  N >= 0. 

xDIAG Main diagonal elements of A. 

xOFFD Off diagonal elements of A.  OFFD(1) through OFFD(N∗1) contains the off diagonal elements; OFFD(N) is not referenced. 

xB On entry, the right-hand side vector b.  On exit, the solution vector x. 

SAMPLE PROGRAM

 
      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           N
      PARAMETER        (N = 4)
C
      DOUBLE PRECISION  B(N), SUBD(N), DIAG(N)
C
      EXTERNAL          DPTSL
C
C     Initialize the arrays SUBD and DIAG to store the subdiagonal
C     and diagonal of the tridiagonal positive definite matrix A
C     shown below.  Initialize the array B to store the right hand
C     side vector b shown below.
C
C          2  -1                 6
C     A = -1   2  -1        b = 12
C             -1   2  -1        12
C                 -1   2         6
C
      DATA SUBD / -1.0D0, -1.0D0, -1.0D0, 8D8 /
      DATA DIAG / 4∗2.0D0 /
      DATA B / 6.0D0, 1.2D1, 1.2D1, 6.0D0 /
C
      PRINT 1000
      PRINT 1010, DIAG(1), SUBD(1)
      PRINT 1020, SUBD(1), DIAG(2), SUBD(2)
      PRINT 1030,          SUBD(2), DIAG(3), SUBD(3)
      PRINT 1040,                   SUBD(3), DIAG(4)
      PRINT 1050
      PRINT 1060, B
      CALL DPTSL (N, DIAG, SUBD, B)
      PRINT 1070
      PRINT 1060, B
C
 1000 FORMAT (1X, ’A:’)
 1010 FORMAT (1X, 2(2X, F4.1))
 1020 FORMAT (1X, 3(2X, F4.1))
 1030 FORMAT (1X,  6X, 3(2X, F4.1))
 1040 FORMAT (1X, 12X, 2(2X, F4.1))
 1050 FORMAT (/1X, ’b:’)
 1060 FORMAT (3X, F6.1)
 1070 FORMAT (/1X, ’A∗∗(-1) ∗ b:’)
C
      END

SAMPLE OUTPUT

 
 A:
    2.0  -1.0
   -1.0   2.0  -1.0
         -1.0   2.0  -1.0
               -1.0   2.0
 
 b:
      6.0
     12.0
     12.0
      6.0
 
 A∗∗(-1) ∗ b:
     18.0
     30.0
     30.0
     18.0

SunOS 5.0  —  Last change: 10 Dec 1998

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026