integer :: A(10) - PowerPoint PPT Presentation

About This Presentation
Title:

integer :: A(10)

Description:

Chapter 6 6-1 integer :: A(10) 10 A A(1) A(2) A(10) 6-1 ... – PowerPoint PPT presentation

Number of Views:83
Avg rating:3.0/5.0
Slides: 31
Provided by: Sibvei
Category:
Tags: fortran | integer

less

Transcript and Presenter's Notes

Title: integer :: A(10)


1
Chapter 6 ??
2
6-1 ????????
  • ????
  • integer A(10)
  • ??10????????A,????A(1)? A(2)A(10)

3
6-1 ????????
  • ????
  • ??????
  • integer A(10)??10????????A,????
    A(1),A(2),,A(10)
  • integer A(-18)??10????????A,????
    A(-1), A(0), A(1), A(2),,A(8)
  • integer A(0102)??6???????,????
    A(0),A(2),A(4),A(6),A(8), A(10)
  • integer A(0102)??6???????,????
    A(10),A(8),A(6),A(4),A(2),A(0)

4
6-1 ????????
  • ????
  • ??????
  • integer A(3,3)????33?????
  • integer A(03,03)????44?????
  • integer A(3,3,3)????333?????

5
6-2 ???????
  • ?????
  • integer a(5) (/ 1, 2, 3, 4, 5 /) ??a(1)
    1, a(2) 2, a(3) 3, a(4) 4, a(5) 5
  • integer a(5) (/ (3, i 1, 5) /)??a(1)
    a(2) a(3) a(4) a(5) 3

6
6-2 ???????
  • ?????
  • integer a(5) (/( i, i 1, 5) /)??a(1) 1,
    a(2) 2, a(3) 3, a(4) 4, a(5) 5
  • integer a(5) (/ (3, i 1, 5) /)??a(1)
    a(2) a(3) a(4) a(5) 3
  • integer a(5) (/ 0, ( i, i 2, 4 ), 5
    /)??a(1) 0, a(2) 2, a(3) 3, a(4) 4, a(5)
    5

7
6-3 ??????????????
  • ????????
  • integer A(5)
  • ??????????????????A(1)?A(2)?A(3)?A(4)?A(5)
  • integer A(0102)??????????????????A(0)?A(2)?
    A(4)?A(6)?A(8)?A(10)

8
6-3 ??????????????
  • ????????
  • integer A(3,3)??A??????????
  • A(1,1) ? A(2,1) ? A(3,1) ?
    A(1,2) ? A(2,2) ? A(3,2) ? A(1,3) ? A(2,3)
    ? A(3,3)

9
6-3 ??????????????
  • ?????????

10
6-3 ??????????????
  • ?????????

11
6-4 Fortran90?????????
  • ???????
  • a b ?b?????????????a??
  • ???
  • do i 1, k (a,b,c??k????????)
  • a(i) b(i)
  • end do
  • a b c ?b???c????????????????a??
  • ???
  • do i 1, k
  • a(i) b(i) c(i)
  • end do

12
6-4 Fortran90?????????
  • ???????
  • a b - c ?b???c????????????????a??
  • ???
  • do i 1, k
  • a(i) b(i) c(i)
  • end do
  • a b c ?b???c????????????????a??
  • ???
  • do i 1, k
  • a(i) b(i) c(i)
  • end do

13
6-4 Fortran90?????????
  • ???????
  • a b / c ?b???c????????????????a??
  • ???
  • do i 1, k
  • a(i) b(i) / c(i)
  • end do
  • a(13) b(46)b???????????a??
  • ???
  • a(1) b(4), a(2) b(5), a(3) b(6)

14
6-4 Fortran90?????????
  • ???????
  • a(152) 3a?????????
  • ???
  • a(1) 3, a(3) 3, a(5) 3
  • a(110) a(101-1)?a(110)??????
  • ???
  • do i 1, k/2
  • temp a(i)
  • a(i)a(k1-i)
  • a(k1-i)temp
  • end do

15
6-4 Fortran90?????????
  • Where
  • where (logical_expr??????????)
  • (????)
  • else where
  • (????)
  • end where

16
6-4 Fortran90?????????
  • Where

17
6-4 Fortran90?????????
  • Forall (Fortran95??????)
  • forall ( i 12, j 12 ) a(i,j) i j
  • ???
  • do j 1, 2
  • do i 1, 2
  • a(i,j) i j
  • end do
  • end do

18
6-4 Fortran90?????????
  • Forall
  • forall ( i 12, j 12 ) a(i,j) i j
    a(j,i) i jend forall
  • ???
  • do j 1, 2
  • do i 1, 2
  • a(i,j) i j
  • a(j,i) i - j
  • end do
  • end do

19
6-4 Fortran90?????????
  • Forall
  • forall ( i 110, j 110, a(i,j) gt 0 )
    where ( a lt 10 ) b 10end forall
  • ???
  • do j 1, 10
  • do i 1, 10
  • if ( a(i,j) gt 0 ) then
  • if ( a(i,j) lt 10 ) then
  • b(i,j) 10
  • end if
  • end if
  • end do
  • end do

20
6-4 Fortran90?????????
  • ???????
  • ???????????????????????
  • ????????
  • integer, allocatable A()
  • integer, allocatable, dimension() A

21
6-4 Fortran90?????????
  • ???????
  • ????????????,????allocate????
  • ????????????????
  • allocate(A(m))
  • allocate(A(mninc))

22
6-4 Fortran90?????????
  • ??????
  • ??????,????????,????????
  • ??
  • deallocate(A)

23
6-4 Fortran90?????????
  • ???????

24
6-4 Fortran90?????????
  • ???????

25
6-4 Fortran90?????????
  • ???????

26
6-4 Fortran90?????????
  • ???????

27
6-4 Fortran90?????????
  • allocate,deallocate???
  • allocate,deallocate????stat?????????
  • allocate(A(m), stat error)
  • deallocate(A(m), stat error)

28
6-4 Fortran90?????????
  • ???????
  • dot_product(vector_a, vector_b)
  • ????????vector_a?vector_b???(dot product)??
  • matmul(matrix_A, matrix_B)
  • ????matrix_A?matrix_B???????????
  • maxloc(array, mask) ltgt minloc(array, mask)
  • ???mask????,????????/????????,?
  • ??????
  • mask?????????where????????????

Ex. bmaxloc(a,alt50) ???????50??????????
29
6-4 Fortran90?????????
  • ???????
  • maxval(array, mask) ltgt minval(array, mask)
  • ???mask????,????????/???,?????/
  • ???
  • reshape(data_source, shape)
  • ???????,???????,???????????
  • ?

30
6-4 Fortran90?????????
  • ???????
  • sum(array, mask)
  • ???mask????,????????????mask,??
  • ????????????
  • transpose(matrix)
  • ????????
Write a Comment
User Comments (0)
About PowerShow.com