forked from JackS9/phatpsy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sympak.f
30 lines (30 loc) · 884 Bytes
/
sympak.f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
SUBROUTINE SYMPAK(A,ASYM,N,N2)
IMPLICIT REAL*8(A-H,O-Z)
C-----------------------------------------------------------------------
C
C SYMPAK...
C
C THIS ROUTINE PACKS A SYMMETRIC MATRIX WHICH IS IN SQUARE
C FORM INTO A MATRIX WHICH IS LOWER TRIANGULAR PACKED.
C IF NOT SYMMETRIC THEN AN ARITHMETIC AVERAGE OF THE
C TRANSPOSE ELEMENTS IS USED.
C
C VARIABLE DEFINITIONS:
C
C A(*,*)...... SQUARE INPUT MATRIX.
C ASYM(*)..... SYMMETRY-PACKED OUTPUT MATRIX.
C N........... DIMENSION OF A(*,*).
C N2.......... =N(N+1)/2, DIMENSION OF ASYM(*).
C
C-----------------------------------------------------------------------
DIMENSION A(N,N),ASYM(N2)
DATA TWO/2.0D0/
IJ=0
DO 20 I=1,N
DO 10 J=1,I
IJ=IJ+1
ASYM(IJ)=(A(I,J)+A(J,I))/TWO
10 CONTINUE
20 CONTINUE
RETURN
END