Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
13
Task/Matrix-transposition/Fortran/matrix-transposition-1.f
Normal file
13
Task/Matrix-transposition/Fortran/matrix-transposition-1.f
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
integer, parameter :: n = 3, m = 5
|
||||
real, dimension(n,m) :: a = reshape( (/ (i,i=1,n*m) /), (/ n, m /) )
|
||||
real, dimension(m,n) :: b
|
||||
|
||||
b = transpose(a)
|
||||
|
||||
do i = 1, n
|
||||
print *, a(i,:)
|
||||
end do
|
||||
|
||||
do j = 1, m
|
||||
print *, b(j,:)
|
||||
end do
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
REAL A(3,5), B(5,3)
|
||||
DATA ((A(I,J),I=1,3),J=1,5) /1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15/
|
||||
|
||||
DO I = 1, 3
|
||||
DO J = 1, 5
|
||||
B(J,I) = A(I,J)
|
||||
END DO
|
||||
END DO
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
REAL A(3,5), B(5,3)
|
||||
DATA ((A(I,J),I=1,3),J=1,5) /1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15/
|
||||
|
||||
DO 10 I = 1, 3
|
||||
DO 20 J = 1, 5
|
||||
B(J,I) = A(I,J)
|
||||
20 CONTINUE
|
||||
10 CONTINUE
|
||||
28
Task/Matrix-transposition/Fortran/matrix-transposition-4.f
Normal file
28
Task/Matrix-transposition/Fortran/matrix-transposition-4.f
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
DIMENSION A(3,5),B(5,3),C(5,3)
|
||||
EQUIVALENCE (A,C) !Occupy the same storage.
|
||||
DATA A/
|
||||
1 1, 2, 3, 4, 5,
|
||||
2 6, 7, 8, 9,10,
|
||||
3 11,12,13,14,15/ !Supplies values in storage order.
|
||||
|
||||
WRITE (6,*) "Three rows of five values:"
|
||||
WRITE (6,1) A !This shows values in storage order.
|
||||
WRITE (6,*) "...written as C(row,column):"
|
||||
WRITE (6,2) ((C(I,J),J = 1,3),I = 1,5)
|
||||
WRITE (6,*) "... written as A(row,column):"
|
||||
WRITE (6,1) ((A(I,J),J = 1,5),I = 1,3)
|
||||
|
||||
WRITE (6,*)
|
||||
WRITE (6,*) "B = Transpose(A)"
|
||||
DO 10 I = 1,3
|
||||
DO 10 J = 1,5
|
||||
10 B(J,I) = A(I,J)
|
||||
|
||||
WRITE (6,*) "Five rows of three values:"
|
||||
WRITE (6,2) B
|
||||
WRITE (6,*) "... written as B(row,column):"
|
||||
WRITE (6,2) ((B(I,J),J = 1,3),I = 1,5)
|
||||
|
||||
1 FORMAT (5F6.1) !Five values per line.
|
||||
2 FORMAT (3F6.1) !Three values per line.
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue