zad4
Essential Lahey Fortran 90 Compiler Release 4.00b Sat Mar 27 08:49:11 2010 Page: 1
Copyright (C) 1994-1998 Lahey Computer Systems. Ali rights reserved.
PROGRAM ZADl Compi1 ing Options: -lst -nsyn -nxref
------------------------------------------------ Source Listing
1 PROGRAM zadl
2 IMPLICIT nonę
3 REAL,ALLOCATABLE: :A(:,:) ,XS(:) ,XN(:) ,B(:) ,C(:, :),D(:, :),D_1(:,
4 REAL::EPS,BLAD
5 INTEGER::i,j,n,iTE
6 WRITEC*,*)'Podaj wartość n: '
7 readC*,*)n
8 WRITE(*,*)'Podaj wartość EPS: '
9 READC*,*)EPS
10 WRITE(*,*)' wymiar macierzy wynosi ',n
11 ALLOCATE (A(n,n),XS(n),XN(n),B(n),C(n,n),D(n,n),D_l(n,n),WB(n))
12 |
DO i=l,n | |
13 |
DO j=l,n | |
14 * “5 |
writeC*,*)'Podaj element macierzy A wiersz |
nr',i ,'kolumna |
»J 15 |
READC*,*)A(i,j) | |
16 |
END DO | |
17 |
END DO | |
18 |
DO i=l,n | |
19 |
WRITE(*,*)'Podaj element macierzy B wiersz READ(*,*)B(i) |
nr' ,i |
20 | ||
21 |
END DO | |
22 |
C=0 | |
23 |
do i=l,n | |
24 |
D(i ,i)=A(i ,i) | |
25 |
END DO | |
26 |
DO i=l,n | |
27 |
D_l(i,i)=l/D(i,i) | |
28 |
END DO | |
29 |
C=A-D | |
30 |
xs=o | |
31 |
ITE=0 | |
32 |
DO | |
33 |
ITE=ITE+1 | |
34 |
XS=XN | |
35 |
XN=MATMUL(D_l,B)-MATMUL(MATMUL(D_l,C),XN) | |
36 |
DO j=l,n | |
37 |
writeC*,*)'wynik z iteracji ',ite,'x',j,' |
=',XNCj) |
38 |
END DO | |
39 |
WB=ABS CXN-XS) /ABS CXS) | |
40 |
blad=sumCwb) | |
41 |
ifCeps>blad) exit | |
42 |
END DO | |
43 |
!X=MATMULCA,B) | |
44 |
!do i=l,n | |
45 |
! DO 3=1,n | |
46 |
! writeC*,*)'Element macierzy c wiersz nr' |
,i,'kolumna nr |
wynosi ' |
,cCi,j) | |
47 |
! END DO | |
48 |
!END DO | |
49 |
!DO i =1,n | |
50 |
! DO 3=1,n | |
51 |
! writeC*,*)'Element macierzy D wiersz nr' |
,i,'kolumna nr |
wynosi ' |
,DCi,j) | |
52 |
! END DO | |
53 |
!END DO |
^Essential Lahey Fortran 90 Compiler Release 4.00b Sat Mar 27 08:49:11 2010 Page: 2
Copyright (C) 1994-1998 Lahey Computer Systems. Ali rights reserved.
Compiling options: -lst -nsyn -nxref
Strona 1