[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ob-fortran behaviour
From: |
Christopher Dimech |
Subject: |
ob-fortran behaviour |
Date: |
Thu, 6 May 2021 01:09:51 +0200 |
Fortran is behaving in a weird way
#+BEGIN_SRC fortran
program matrx_vectr_mult
implicit none
integer :: m, n, i, j, k
real :: a(5,3), u(3), v(5), rsum
m = 5; n = 3
a = 0.0; u = 0.0; v = 0.0
k = 0
do j = 1, n
do i = 1, m
k = i + j
a(i,j) = real(k)
u(i) = real(3*i)
end do
end do
do i = 1, m
rsum = 0.0
do j = 1, n
rsum = (a(i,j) * u(j)) + rsum
end do
v(i) = rsum
end do
write (*,*) "a * *", " * ", "u", " * ", "v"
write (*,*) a(1,:), "*", u(1), "*", v(1)
write (*,*) a(2,:), "*", u(2), "*", v(2)
write (*,*) a(3,:), "*", u(3), "*", v(3)
write (*,*) a(4,:), "* * *", v(4)
write (*,*) a(5,:), "* * *", v(5)
print *, "---"
write (*,*) a
end program
#+END_SRC
#+RESULTS:
| a | * | * | * | u | * | v | | | | | |
| | |
| 12.0 | 3.0 | 4.0 | * | 3.0 | * | 90.0 | | | | | |
| | |
| 15.0 | 4.0 | 5.0 | * | 6.0 | * | 114.0 | | | | | |
| | |
| 4.0 | 5.0 | 6.0 | * | 9.0 | * | 96.0 | | | | | |
| | |
| 5.0 | 6.0 | 7.0 | * | * | * | 114.0 | | | | | |
| | |
| 6.0 | 7.0 | 8.0 | * | * | * | 132.0 | | | | | |
| | |
| --- | | | | | | | | | | | |
| | |
| 12.0 | 15.0 | 4.0 | 5.0 | 6.0 | 3.0 | 4.0 | 5.0 | 6.0 | 7.0 | 4.0 | 5.0 |
6.0 | 7.0 | 8.0 |
---------------------
Christopher Dimech
General Administrator - Naiad Informatics - GNU Project (Geocomputation)
- Geophysical Simulation
- Geological Subsurface Mapping
- Disaster Preparedness and Mitigation
- Natural Resource Exploration and Production
- Free Software Advocacy
- Re: Multiple calc commands with orgbabel, (continued)
- Re: Multiple calc commands with orgbabel, Eric S Fraga, 2021/05/05
- Re: Multiple calc commands with orgbabel, Tom Gillespie, 2021/05/05
- Re: Multiple calc commands with orgbabel, Bastien, 2021/05/06
- Re: Multiple calc commands with orgbabel, Tom Gillespie, 2021/05/06
- Re: Multiple calc commands with orgbabel, Bastien, 2021/05/07
- Re: Multiple calc commands with orgbabel, Tom Gillespie, 2021/05/07
- Re: Multiple calc commands with orgbabel, Bastien, 2021/05/07
- Re: Multiple calc commands with orgbabel, pietru, 2021/05/05
- ob-fortran behaviour,
Christopher Dimech <=
- Re: ob-fortran behaviour, Christopher Dimech, 2021/05/05
- ob-fortran fixes to column position 6 and subroutine keywords, pietru, 2021/05/05
Re: Multiple calc commands with orgbabel, Dr. Arne Babenhauserheide, 2021/05/05