emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: pietru@caramail.com
Cc: help Emacs Orgmode <emacs-orgmode@gnu.org>
Subject: Re: orgbabel with fortran code
Date: Wed, 05 May 2021 07:52:31 +0100	[thread overview]
Message-ID: <87lf8t65ao.fsf@ucl.ac.uk> (raw)
In-Reply-To: <trinity-88a75c88-2d43-493c-afae-d8a59c15f52d-1620196623773@3c-app-mailcom-bs02> (pietru@caramail.com's message of "Wed, 5 May 2021 08:37:03 +0200")

[-- Attachment #1: Type: text/plain, Size: 468 bytes --]

On Wednesday,  5 May 2021 at 08:37, pietru@caramail.com wrote:
> Make a function and then run it with different values.

Have a look at the attachment.  Doesn't create a /function/ in the
Fortran sense but shows how you can definitely call some code with
different values.

That's about all I can help with as it's been years since I used Fortran
(although I did cut my teeth on Fortran 66... ;-)).

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.5-395-g82fbdd

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: f.org --]
[-- Type: text/x-org, Size: 1668 bytes --]

* testing ob fortran
#+name: ftest
#+begin_src fortran :var m=20 :var n=30 :results output
  real, dimension(m,n) :: a
  real, dimension(n,m) :: c
  real, dimension(m) :: b
  integer :: i
  print *, m, n
  a = reshape( (/ (real(i), i=1,m*n) /), (/ m, n /) )
  b = (/ (2*i, i=1,m) /)
  c = reshape( a, (/ n, m /) )
  print *, b
#+end_src

#+results: ftest
: 20          30
: 2.00000000       4.00000000       6.00000000       8.00000000       10.0000000       12.0000000       14.0000000       16.0000000       18.0000000       20.0000000       22.0000000       24.0000000       26.0000000       28.0000000       30.0000000       32.0000000       34.0000000       36.0000000       38.0000000       40.0000000

#+results:
: 2.00000000       4.00000000       6.00000000       8.00000000       10.0000000       12.0000000       14.0000000       16.0000000       18.0000000       20.0000000       22.0000000       24.0000000       26.0000000       28.0000000       30.0000000       32.0000000       34.0000000       36.0000000       38.0000000       40.0000000

#+call: ftest(m=10,n=40)

#+results:
: 10          40
: 2.00000000       4.00000000       6.00000000       8.00000000       10.0000000       12.0000000       14.0000000       16.0000000       18.0000000       20.0000000

#+call: ftest(m=20,n=10)

#+results:
: 20          10
: 2.00000000       4.00000000       6.00000000       8.00000000       10.0000000       12.0000000       14.0000000       16.0000000       18.0000000       20.0000000       22.0000000       24.0000000       26.0000000       28.0000000       30.0000000       32.0000000       34.0000000       36.0000000       38.0000000       40.0000000

  reply	other threads:[~2021-05-05  6:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05  5:41 pietru
2021-05-05  6:24 ` Eric S Fraga
2021-05-05  6:37   ` pietru
2021-05-05  6:52     ` Eric S Fraga [this message]
2021-05-05  7:09       ` pietru
2021-05-05  7:14       ` pietru
2021-05-05  7:20         ` Eric S Fraga
2021-05-05  7:24           ` pietru
2021-05-05  7:14 ` Dr. Arne Babenhauserheide
2021-05-05  7:23   ` pietru
2021-05-05 19:50     ` Dr. Arne Babenhauserheide
2021-05-05 20:36       ` Christopher Dimech
2021-05-05 20:46       ` pietru
2021-05-05 20:53         ` Dr. Arne Babenhauserheide
2021-05-05 21:04           ` pietru
2021-05-05 21:02       ` pietru
2021-05-05 21:08       ` 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=87lf8t65ao.fsf@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=pietru@caramail.com \
    --subject='Re: orgbabel with fortran code' \
    /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

Code repositories for project(s) associated with this 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).