forked from JackS9/phatpsy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
addmat.f
41 lines (41 loc) · 1007 Bytes
/
addmat.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
31
32
33
34
35
36
37
38
39
40
41
SUBROUTINE ADDMAT(A,B,C,N)
IMPLICIT REAL*8(A-H,O-Z)
C-----------------------------------------------------------------------
C
C ADDMAT...
C
C THIS ROUTINE ADDS TWO ARRAYS WHICH ARE STORED CONTIGUOUSLY.
C THE RESULTANT MATRIX IS ALSO ASSUMED CONTIGUOUS.
C
C C = A + B
C
C VARIABLE DEFINITIONS:
C
C A(*)... FIRST ARRAY TO BE ADDED.
C B(*)... SECOND ARRAY.
C C(*)... RESULTANT MATRIX.
C N...... NUMBER OF CONTIGUOUS STORAGE ELEMENTS TO BE ADDED.
C
C ENTRY: SUBMAT...
C
C THIS ENTRY POINT SUBRACTS THE TWO ARRAYS.
C
C NOTE: NONE OF THE THREE ARRAYS NEED BE UNIQUE.
C
C-----------------------------------------------------------------------
DIMENSION A(N),B(N),C(N)
DO 10 I=1,N
C(I)=A(I)+B(I)
10 CONTINUE
RETURN
END
C
C...
SUBROUTINE SUBMAT(A,B,C,N)
IMPLICIT REAL*8(A-H,O-Z)
DIMENSION A(N),B(N),C(N)
DO 10 I=1,N
C(I)=A(I)-B(I)
10 CONTINUE
RETURN
END