emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christopher Dimech <dimech@gmx.com>
To: Eric S Fraga <e.fraga@ucl.ac.uk>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: ob-fortran behaviour
Date: Thu, 6 May 2021 01:09:51 +0200	[thread overview]
Message-ID: <trinity-7e218b1b-73f6-4387-8924-5bcf705c094e-1620256191880@3c-app-mailcom-bs16> (raw)
In-Reply-To: <87eeelrv6s.fsf@ucl.ac.uk>

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


  parent reply	other threads:[~2021-05-05 23:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05  5:46 Multiple calc commands with orgbabel pietru
2021-05-05  6:33 ` Eric S Fraga
2021-05-05  6:40   ` pietru
2021-05-05  6:41     ` Eric S Fraga
2021-05-05  6:45       ` pietru
2021-05-05 15:11   ` Matt Price
2021-05-05 15:29     ` pietru
2021-05-05 16:19       ` Tom Gillespie
2021-05-05 16:39     ` Eric S Fraga
2021-05-05 17:03       ` Tom Gillespie
2021-05-06 11:16         ` Bastien
2021-05-06 15:21           ` Tom Gillespie
2021-05-07  4:04             ` Bastien
2021-05-07  7:01               ` Tom Gillespie
2021-05-07  7:31                 ` Bastien
2021-05-05 20:24       ` pietru
2021-05-05 23:09       ` Christopher Dimech [this message]
2021-05-05 23:29         ` ob-fortran behaviour Christopher Dimech
2021-05-06  2:24       ` ob-fortran fixes to column position 6 and subroutine keywords pietru
2021-05-05  7:12 ` Multiple calc commands with orgbabel Dr. Arne Babenhauserheide
2021-05-05  7:20   ` pietru
2021-05-05  7:23   ` Eric S Fraga
2021-05-05  7:26     ` pietru
2021-05-05  7:59       ` Eric S Fraga
2021-05-05  8:00         ` pietru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-7e218b1b-73f6-4387-8924-5bcf705c094e-1620256191880@3c-app-mailcom-bs16 \
    --to=dimech@gmx.com \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).