Compact Crout

Thisprogram will solve the system of linear equations, A*X=B, where A is a symmetric, positive definite matrix as is commonly used in structural analysis.  Since the matrix is symmetric, only the upper triangular potion is input using columns.  So, given a 4x4 matrix, for example, only the following elements are input::

A11 A12 A13 A14

  -    A22 A23 A24

  -      -    A33 A34

  -      -       -    A41 

Downloads:

Basic program - ccrout.bas

 

Test case:

Linear Equations - Compact Crout
to solve multiple symmetric equations of the form
A1*x1+A2*x2+...+An*xn=B
data is input by columns using the upper triangle of matrix A
enter 'q' at any prompt to quit

Enter A matrix dimension: 4

Enter A matrix upper triangle

upper part of column 1

A(1,1)=  1

data correct (y/n)? y

upper part of column 2

A(1,2)=  .5
A(2,2)=  .33333

data correct (y/n)? y

upper part of column 3

A(1,3)=  .33333
A(2,3)=  .25
A(3,3)=  .2

data correct (y/n)? y

upper part of column 4

A(1,4)=  .25
A(2,4)=  .2
A(3,4)=  .16667
A(4,4)=  .14286

data correct (y/n)? y


Determinant of A

Det = 0.16111108e-6


input vector B (constants)

B(1)=  .58333
B(2)=  .21667
B(3)=  .11666
B(4)=  .07381


Solution

X(1)= 1.0
X(2)= -1.0
X(3)= 1.0
X(4)= -1.0

Do you want to input another vector B (y/n)? n