-
Notifications
You must be signed in to change notification settings - Fork 0
/
LinearEquations.f90
158 lines (141 loc) · 2.72 KB
/
LinearEquations.f90
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
Program LinearEquations
! solving the matrix equation A*x=b using LAPACK
implicit none
integer, PARAMETER :: M = 5
integer, dimension(4) :: iseed
real * 8, dimension(M, M) :: A, B, C
real * 8, dimension(3, 3) :: ATEST, CTEST, BTEST
real * 8, dimension(M) :: D
integer MODE
real * 8 COND
real * 8 DMAX
real * 8, dimension(M) :: DL
real * 8, dimension(M) :: DR
integer, dimension(M) :: IPIVOT, IWORK
integer :: INFO, i, j, KU, KL
! ATEST = reshape((/4, 12, -16, 12, 37, -43, -16, -43, 98/), (/3, 3/))
! call DPOTRF('U', 3, ATEST, 3, INFO)
!
!
!
!
! do, i = 1,3
! do, j = 1,3
! CTEST(i, j) = 0
! if (j.lt.i) then
! ATEST(i, j) = 0
! end if
! enddo
! enddo
!
! BTEST = transpose(ATEST)
!
! do, i = 1, 3
! write(*, *) (ATEST(i,j), j=1,3)
! enddo
!
! do, i = 1, 3
! write(*, *) (BTEST(i,j), j=1,3)
! enddo
!
! do, i = 1, 3
! write(*, *) (CTEST(i,j), j=1,3)
! enddo
!
! ! C := alpha*op( A )*op( B ) + beta*C,
! call DGEMM('N', 'N', 3, 3, 3, 1.d0, BTEST, 3, ATEST, 3, 0.d0, CTEST, 3)
!
! do, i = 1, 3
! write(*, *) (CTEST(i,j), j=1,3)
! enddo
!
! do, i = 1, 3
! write(*, *) (ATEST(i,j), j=1,3)
! enddo
iseed = (/2, 3 , 5, 7/)
!D = (/1, 2, 3, 4, 5/)
MODE = 5
COND = 103.0
DMAX = 107.8
!DL = (/0, 0, 0, 0, 0/)
!DR = (/0, 0, 0, 0, 0/)
!IPIVOT = (/0, 0, 0, 0, 0/)
KL = M-1
KU = M-1
do i = 1, M
do j = 1, M
A(i, j) = 0.0
C(i, j) = 1.0
end do
end do
call DLATMR(&
M, &!M
M, &!N
'S', &!DIST
iseed, &!ISEED
'S', &!SYM
D, &!D
MODE, &!MODE
COND, &!COND
DMAX, &!DMAX
'F', &!RSIGN
'N', &!GRADE
DL, &!DL
0, &!MODEL
0.0, &!CONDL
DR, &!DR
0, &!MODER
0.0, &!CONDR
'N', &!PIVTING
IPIVOT, &!IPIVOT
KL, &!KL
KU, &!KU
0.0, &!SPARSE
-1.0, &!ANORM
'N', &!PACK
A, &!A
M, &!LDA
IWORK, &!IWORK
INFO) !INFO
! write(*, *) INFO
! do i = 1, M
! do j = 1, M
! write(*,*) A(i, j)
! end do
! end do
do, i = 1, M
write(*, *) (A(i,j), j=1,M)
enddo
OPEN(234, FILE="matrix-0-0.bin", FORM='UNFORMATTED', STATUS='REPLACE', ACCESS="STREAM")
WRITE(234) M
WRITE(234) M
WRITE(234) A
CLOSE (234)
! do i = 1, M
! write(*,*) D(i)
! end do
!
! call DPOTRF('U', M, A, M, INFO)
!
!
!
! write(*, *) INFO
!
! do, i = 1, M
! write(*, *) (A(i,j), j=1,M)
! enddo
!
!! B = transpose(A)
!!!
!! do, i = 1, M
!! write(*, *) (B(i,j), j=1,M)
!! enddo
!
!! C := alpha*op( A )*op( B ) + beta*C,
! call DGEMM('T', 'N', M, M, M, 1.d0, A, M, A, M, 0.d0, C, M)
!
! do, i = 1, M
! write(*, *) (C(i,j), j=1,M)
! enddo
! write (*, *) iseed
end