Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/Identity-matrix/Fortran/identity-matrix-1.f
Normal file
23
Task/Identity-matrix/Fortran/identity-matrix-1.f
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
program identitymatrix
|
||||
|
||||
real, dimension(:, :), allocatable :: I
|
||||
character(len=8) :: fmt
|
||||
integer :: ms, j
|
||||
|
||||
ms = 10 ! the desired size
|
||||
|
||||
allocate(I(ms,ms))
|
||||
I = 0 ! Initialize the array.
|
||||
forall(j = 1:ms) I(j,j) = 1 ! Set the diagonal.
|
||||
|
||||
! I is the identity matrix, let's show it:
|
||||
|
||||
write (fmt, '(A,I2,A)') '(', ms, 'F6.2)'
|
||||
! if you consider to have used the (row, col) convention,
|
||||
! the following will print the transposed matrix (col, row)
|
||||
! but I' = I, so it's not important here
|
||||
write (*, fmt) I(:,:)
|
||||
|
||||
deallocate(I)
|
||||
|
||||
end program identitymatrix
|
||||
9
Task/Identity-matrix/Fortran/identity-matrix-2.f
Normal file
9
Task/Identity-matrix/Fortran/identity-matrix-2.f
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Program Identity
|
||||
Integer N
|
||||
Parameter (N = 666)
|
||||
Real A(N,N)
|
||||
Integer i,j
|
||||
|
||||
ForAll(i = 1:N, j = 1:N) A(i,j) = (i/j)*(j/i)
|
||||
|
||||
END
|
||||
3
Task/Identity-matrix/Fortran/identity-matrix-3.f
Normal file
3
Task/Identity-matrix/Fortran/identity-matrix-3.f
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
DO 1 I = 1,N
|
||||
DO 1 J = 1,N
|
||||
1 A(I,J) = (I/J)*(J/I)
|
||||
Loading…
Add table
Add a link
Reference in a new issue